Bug 1075 - Python examples fail when static built is enabled
Python examples fail when static built is enabled
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: build system
pre-release
All All
: P5 major
Assigned To: Gustavo J. A. M. Carneiro
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-18 17:26 EDT by Mitch Watrous
Modified: 2011-03-20 08:18 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mitch Watrous 2011-03-18 17:26:48 EDT
If you do build the non-static (shared dynamic) version of ns-3, all of the tests in test.py pass.

But, if you do

    /waf configure --enable-static

or

    /waf configure --enable-static -d release

all of the Python examples fail:

    FAIL: Example examples/routing/simple-routing-ping6.py
    FAIL: Example examples/wireless/wifi-ap.py
    FAIL: Example examples/wireless/mixed-wireless.py
    FAIL: Example examples/tutorial/first.py
    FAIL: Example src/bridge/examples/csma-bridge.py

I think the reason is that I changed the wscript files to make the bindings be a static library. Before, they were always being created as shared libraries.

To be specific, I added to following to bindings/python/wscript:

        if bld.env['ENABLE_STATIC_NS3']:
            features = 'cxx cstaticlib pyext'
        else:
            features = 'cxx cshlib pyext'
        if env['ENABLE_PYTHON_PCH']:
            features += ' pch'

I also added following to wscript:

    if env['ENABLE_STATIC_NS3']:
        if sys.platform == 'darwin':
            env.STATICLIB_MARKER = '-Wl,-all_load'
        else:
            env.STATICLIB_MARKER = '-Wl,--whole-archive,-Bstatic'
            env.SHLIB_MARKER = '-Wl,-Bdynamic,--no-whole-archive'
Comment 1 Gustavo J. A. M. Carneiro 2011-03-19 11:57:05 EDT
Note to Mitch, please add me to CC of any bug report assigned to me, otherwise I might miss it.  I do not subscribe to all bugmail. I only subscribe to the RSS feed, from which sometimes I miss items.
Comment 2 Gustavo J. A. M. Carneiro 2011-03-20 08:18:59 EDT
Of course, Python bindings have to be dynamic libraries, period.

changeset:   6918:614b5388a1ae
tag:         tip
user:        Gustavo J. A. M. Carneiro  <gjc@inescporto.pt>
date:        Sun Mar 20 12:18:15 2011 +0000
summary:     Bug 1075 - Python examples fail when static built is enabled