[Ns-developers] Static NS-3 (Was: icc and "patched" waf)
mathieu.lacage at sophia.inria.fr
Fri Jan 23 10:48:53 PST 2009
On Fri, 2009-01-23 at 16:10 +0000, Gustavo Carneiro wrote:
> You can hold the beer. Unfortunately it's not so simple.
I know, that is why it is not yet implemented :)
> Building NS-3 objects statically is easy, but if I link them into a
> static library (.a file), unit tests will fail:
> Assert in TypeId::LookupByName: ns3::DefaultSimulatorImpl not found
> That is a known problem with static libraries and initialization of C
> ++ global class instances. Craig wrote a document describing the
> problem: http://www.nsnam.org/docs/linker-problems.doc
> I can work around by adding all object files directly when linking
> every NS-3 program, without even creating a static library, but then
> linking N programs each with dozens of object files is very slow and
> painful. But works. The attached patch does it.
This is what I expected you would do.
> Finally there is the problem of the Python bindings. Python extension
> modules of course need to be 100% -fPIC enabled, including the NS-3
> part. So to make Python bindings work one would need to compile NS-3
> twice, once with -fPIC and another time without. An alternative to
> this would be to do it NS-2 style, i.e. create a NS-3 static program
> which embeds a Python library and regsitering a statically built
> Python builtin module interfacing with NS-3.
This does not seem worth it.
thanks a lot !
More information about the Ns-developers