Bug 1252 - OSX --enable-static unimplemented: code model large not supported in PIC mode
OSX --enable-static unimplemented: code model large not supported in PIC mode
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: core
pre-release
Mac Intel Mac OS
: P5 normal
Assigned To: Mathieu Lacage
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-08-25 11:37 UTC by John Abraham
Modified: 2011-09-25 10:55 UTC (History)
3 users (show)

See Also:


Attachments
Config.log (28.84 KB, application/octet-stream)
2011-08-25 11:37 UTC, John Abraham
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Abraham 2011-08-25 11:37:48 UTC
Created attachment 1226 [details]
Config.log

This works on OSX when cloning ns-3-dev. However the following steps do not work for the RC1 build

   44  cp /Users/john/Downloads/ns-allinone-3.12-RC1.tar.bz2 /Users/john/ns-3/ns-3.12/
   45  cd /Users/john/ns-3/ns-3.12/
   46  ls
   47  tar -xvjpf ns-allinone-3.12-RC1.tar.bz2 
   48  cd ns-allinone-3.12-RC1
   52  cd ns-3.12-RC1/
   53  ./waf -d debug configure --enable-static
   54  ./waf



[ 596/1279] gen-module-header: build/debug/ns3/gnuplot.h build/debug/ns3/delay-jitter-estimation.h build/debug/ns3/average.h build/debug/ns3/event-garbage-collector.h -> build/debug/ns3/tools-module.h
[ 597/1279] gen-module-header: build/debug/ns3/pyviz.h -> build/debug/ns3/visualizer-module.h
[ 598/1279] gen-module-header: build/debug/ns3/point-to-point-grid.h build/debug/ns3/point-to-point-dumbbell.h build/debug/ns3/point-to-point-star.h -> build/debug/ns3/point-to-point-layout-module.h
[ 599/1279] gen-module-header: build/debug/ns3/csma-star-helper.h -> build/debug/ns3/csma-layout-module.h
[ 600/1279] cxx: src/core/model/unix-system-condition.cc -> build/debug/src/core/model/unix-system-condition_2.o
../src/core/model/unix-system-condition.cc:1: sorry, unimplemented: code model large not supported in PIC mode
../src/core/model/unix-system-condition.cc:1: error: code model ‘large’ not supported in the 64 bit mode
Waf: Leaving directory `/Users/john/ns-3/ns-3.12/ns-allinone-3.12-RC1/ns-3.12-RC1/build'
Build failed:  -> task failed (err #1): 
	{task: cxx unix-system-condition.cc -> unix-system-condition_2.o}

config.log is attached
Comment 1 Mathieu Lacage 2011-08-25 14:25:25 UTC

The relevant code is in src/wscript:

        elif module.env['CXX_NAME'] in ['gcc', 'icc'] and \
                os.uname()[4] == 'x86_64' and \
                module.env['ENABLE_PYTHON_BINDINGS']:
            # enable that flag for static builds only on x86-64 platforms
            # when gcc is present and only when we want python bindings
            # (it's more efficient to not use this option if we can avoid it)
            cxxflags = ['-mcmodel=large']
            ccflags = ['-mcmodel=large']


I suspect that it should be safe to add an extra check for darwin here.
Comment 2 John Abraham 2011-08-26 12:04:39 UTC
Wouldn't this be the case in not just darwin but also others which do not support mcmodel==large?


(In reply to comment #1)
> 
> The relevant code is in src/wscript:
> 
>         elif module.env['CXX_NAME'] in ['gcc', 'icc'] and \
>                 os.uname()[4] == 'x86_64' and \
>                 module.env['ENABLE_PYTHON_BINDINGS']:
>             # enable that flag for static builds only on x86-64 platforms
>             # when gcc is present and only when we want python bindings
>             # (it's more efficient to not use this option if we can avoid it)
>             cxxflags = ['-mcmodel=large']
>             ccflags = ['-mcmodel=large']
> 
> 
> I suspect that it should be safe to add an extra check for darwin here.
Comment 3 John Abraham 2011-08-26 14:35:31 UTC
The issue persists on the RC2 image as well. Perhaps we could keep this bug open and make a darwin specific change and deal with this post-ns-3.12


(In reply to comment #2)
> Wouldn't this be the case in not just darwin but also others which do not
> support mcmodel==large?
> 
> 
> (In reply to comment #1)
> > 
> > The relevant code is in src/wscript:
> > 
> >         elif module.env['CXX_NAME'] in ['gcc', 'icc'] and \
> >                 os.uname()[4] == 'x86_64' and \
> >                 module.env['ENABLE_PYTHON_BINDINGS']:
> >             # enable that flag for static builds only on x86-64 platforms
> >             # when gcc is present and only when we want python bindings
> >             # (it's more efficient to not use this option if we can avoid it)
> >             cxxflags = ['-mcmodel=large']
> >             ccflags = ['-mcmodel=large']
> > 
> > 
> > I suspect that it should be safe to add an extra check for darwin here.
Comment 4 Mathieu Lacage 2011-08-26 16:11:04 UTC
just add an extra argument to the if statement to check if you are on linux.
Comment 5 John Abraham 2011-08-26 17:10:00 UTC
author	John Abraham <john.abraham@gatech.edu>
Fri Aug 26 17:06:35 2011 -0400 (40 seconds ago)
changeset 7467	936cb356fb09
parent 7466	d23a92c90eee

Will need to investigate this further

1.  What specific feature or requirement of ns-3 needs mcmodel==large
2.  Some google-searching indicates there may be a performance impact in using mcmode==large.We need some way make some measurements to justify that.
Comment 6 Mathieu Lacage 2011-08-27 03:48:11 UTC
> 1.  What specific feature or requirement of ns-3 needs mcmodel==large

the static build needs it on 64bit systems because the compiler tends to generate binaries that use 64bit displacements.

> 2.  Some google-searching indicates there may be a performance impact in using
> mcmode==large.We need some way make some measurements to justify that.

yes, the large model is slower than the small and medium models but there is no way to avoid using it on a 64bit box if you want to use static linking.
Comment 7 Tom Henderson 2011-08-31 09:52:37 UTC
given the outcome of bug 1253, is this test in src/wscript obsolete now and should be removed?

        elif module.env['CXX_NAME'] in ['gcc', 'icc'] and \
                os.uname()[4] == 'x86_64' and \
                sys.platform != 'darwin' and \
                module.env['ENABLE_PYTHON_BINDINGS']:
            # enable that flag for static builds only on x86-64 platforms
            # when gcc is present and only when we want python bindings
            # (it's more efficient to not use this option if we can avoid it)
            cxxflags = ['-mcmodel=large']
            ccflags = ['-mcmodel=large']
        cxxdefines = ["NS3_MODULE_COMPILATION"]
        ccdefines = ["NS3_MODULE_COMPILATION"]
Comment 8 Mathieu Lacage 2011-08-31 16:26:47 UTC
(In reply to comment #7)
> given the outcome of bug 1253, is this test in src/wscript obsolete now and
> should be removed?

I would think so
Comment 9 Gustavo J. A. M. Carneiro 2011-09-25 10:55:59 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > given the outcome of bug 1253, is this test in src/wscript obsolete now and
> > should be removed?
> 
> I would think so

Removed.