Bugzilla – Full Text Bug Listing |
Summary: | module linkflags are dismissed when creating module (cxxshlib) | ||
---|---|---|---|
Product: | ns-3 | Reporter: | Laurynas Riliskis <laurynas.riliskis> |
Component: | documentation | Assignee: | Tom Henderson <tomh> |
Status: | CONFIRMED --- | ||
Severity: | normal | CC: | laurynas.riliskis, ns-bugs, pdbarnes, rohitgec, tomh |
Priority: | P5 | ||
Version: | ns-3.11 | ||
Hardware: | PC | ||
OS: | Linux | ||
Attachments: |
wscript file from ns-3.18 main directory
wscript file from ns-3.18/src/lte directory lena-simple.cc in ns-3.18/src/lte/examples directory |
Description
Laurynas Riliskis
2012-08-23 10:27:10 EDT
I solved the problem http://shieldroute.blogspot.se/2012/08/extending-ns3-with-your-module-and.html However, I am still unsure if the behaviour described above and in http://www.nsnam.org/wiki/index.php/HOWTO_use_ns-3_with_other_libraries is correct. According to the wiki it should be sufficient to add the LINKFLAG but that only compiles individual object with the flag it do not link module with libraries. Which it should? (In reply to comment #1) > I solved the problem > http://shieldroute.blogspot.se/2012/08/extending-ns3-with-your-module-and.html > > However, I am still unsure if the behaviour described above and in > http://www.nsnam.org/wiki/index.php/HOWTO_use_ns-3_with_other_libraries is > correct. According to the wiki it should be sufficient to add the LINKFLAG but > that only compiles individual object with the flag it do not link module with > libraries. Which it should? Laurynas, sorry this was a headache for you. We'll look at waf changes and update the documentation; in the meantime, I edited the wiki to point new readers to your blog post until things are fixed. Marking down severity; will update documentation along these lines: ================================ While before this would work, module.env['LINKFLAGS'] = '-lfoo' Now you have to do this: def configure(conf): conf.env['LINKFLAGS_FOO'] = '-lfoo' ... def build(bld): ... module = bld.create_ns3_module(...) # say we need to "use" the FOO library module.use.append('FOO') ============================== Created attachment 1679 [details]
wscript file from ns-3.18 main directory
wscript file from ns-3.18 main directory
Created attachment 1680 [details]
wscript file from ns-3.18/src/lte directory
wscript file from ns-3.18/src/lte directory
Created attachment 1681 [details]
lena-simple.cc in ns-3.18/src/lte/examples directory
lena-simple.cc in ns-3.18/src/lte/examples directory.
This is the main file that contains code to boost serialization library
Hi Tom, I am trying to compile ns-3.18 with boost serialization library. I followed your instructions in last comment and did following. I made changes in wscript file in ns3.18 main directory by inserting lines below. conf.env['LINKFLAGS_BOOST_SERIALIZATION'] = '-lboost_serialization' env.append_value('LINKFLAGS', '-lboost_serialization') I also modified wscript file in ns-3.18/src/lte directory and added these lines at module.use.extend(['BOOST_SERIALIZATION']) module_test.use.extend(['BOOST_SERIALIZATION']) The code for boost serilization library is in ns-3.18/src/lte/examples/lena-simple.cc I have also attached all the three files so you can reproduce the problem on a fresh ns-3.18 repository. Any help from you will be much appreciated. Regards, Rohit P.S. Here is an excerpt of error from build system usr/include/boost/archive/basic_text_iprimitive.hpp:93: undefined reference to `boost::archive::archive_exception::archive_exception(boost::archive::archive_exception::exception_code, char const*, char const*)' /usr/include/boost/archive/basic_text_iprimitive.hpp:93: undefined reference to `boost::archive::archive_exception::~archive_exception()' /usr/include/boost/archive/basic_text_iprimitive.hpp:93: undefined reference to `boost::archive::archive_exception::~archive_exception()' collect2: ld returned 1 exit status Waf: Leaving directory `/home/user/Downloads/TestBoostBuild/ns-allinone-3.18/ns-3.18/build' Build failed -> task in 'lena-simple' failed (exit status 1): {task 33965072: cxxprogram lena-simple.cc.10.o -> ns3.18-lena-simple-debug} ['/usr/bin/g++', '-lboost_serialization', '-pthread', '-pthread', '-lboost_serialization', 'src/lte/examples/lena-simple.cc.10.o', '-o', '/home/user/Downloads/TestBoostBuild/ns-allinone-3.18/ns-3.18/build/src/lte/examples/ns3.18-lena-simple-debug', '-Wl,-Bstatic', '-Wl,-Bdynamic', '-Wl,--no-as-needed', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-lns3.18-lte-debug', '-lns3.18-spectrum-debug', '-lns3.18-csma-debug', '-lns3.18-applications-debug', '-lns3.18-virtual-net-device-debug', '-lns3.18-internet-debug', '-lns3.18-bridge-debug', '-lns3.18-point-to-point-debug', '-lns3.18-mpi-debug', '-lns3.18-buildings-debug', '-lns3.18-propagation-debug', '-lns3.18-mobility-debug', '-lns3.18-config-store-debug', '-lns3.18-network-debug', '-lns3.18-stats-debug', '-lns3.18-antenna-debug', '-lns3.18-core-debug', '-lrt', '-lsqlite3', '-lgtk-x11-2.0', '-lgdk-x11-2.0', '-latk-1.0', '-lgio-2.0', '-lpangoft2-1.0', '-lpangocairo-1.0', '-lgdk_pixbuf-2.0', '-lcairo', '-lpango-1.0', '-lfreetype', '-lfontconfig', '-lgobject-2.0', '-lglib-2.0', '-lxml2'] Hi there, Okay now I found the problem, but still someone needs to help me with the solution. Looking at the log when build fails, this is what happens. Build failed -> task in 'lena-simple' failed (exit status 1): {task 33965072: cxxprogram lena-simple.cc.10.o -> ns3.18-lena-simple-debug} ['/usr/bin/g++', '-lboost_serialization', '-pthread', '-pthread', '-lboost_serialization', 'src/lte/examples/lena-simple.cc.10.o', '-o', '/home/user/Downloads/TestBoostBuild/ns-allinone-3.18/ns-3.18/build/src/lte/examples/ns3.18-lena-simple-debug', '-Wl,-Bstatic', '-Wl,-Bdynamic', '-Wl,--no-as-needed', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-lns3.18-lte-debug', '-lns3.18-spectrum-debug', '-lns3.18-csma-debug', '-lns3.18-applications-debug', '-lns3.18-virtual-net-device-debug', '-lns3.18-internet-debug', '-lns3.18-bridge-debug', '-lns3.18-point-to-point-debug', '-lns3.18-mpi-debug', '-lns3.18-buildings-debug', '-lns3.18-propagation-debug', '-lns3.18-mobility-debug', '-lns3.18-config-store-debug', '-lns3.18-network-debug', '-lns3.18-stats-debug', '-lns3.18-antenna-debug', '-lns3.18-core-debug', '-lrt', '-lsqlite3', '-lgtk-x11-2.0', '-lgdk-x11-2.0', '-latk-1.0', '-lgio-2.0', '-lpangoft2-1.0', '-lpangocairo-1.0', '-lgdk_pixbuf-2.0', '-lcairo', '-lpango-1.0', '-lfreetype', '-lfontconfig', '-lgobject-2.0', '-lglib-2.0', '-lxml2'] It is strange that even though I have included -lboost_serialization, g++ complains that it cant find boost libraries. However, if I add '-lboost_serialization' at the end of the list, the compilation works fine if I compile manually!!! So, if I do something like, ['/usr/bin/g++', '-pthread', '-pthread', '-lboost_serialization', 'src/lte/examples/lena-simple.cc.10.o', '-o', '/home/user/Downloads/TestBoostBuild/ns-allinone-3.18/ns-3.18/build/src/lte/examples/ns3.18-lena-simple-debug', '-Wl,-Bstatic', '-Wl,-Bdynamic', '-Wl,--no-as-needed', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-lns3.18-lte-debug', '-lns3.18-spectrum-debug', '-lns3.18-csma-debug', '-lns3.18-applications-debug', '-lns3.18-virtual-net-device-debug', '-lns3.18-internet-debug', '-lns3.18-bridge-debug', '-lns3.18-point-to-point-debug', '-lns3.18-mpi-debug', '-lns3.18-buildings-debug', '-lns3.18-propagation-debug', '-lns3.18-mobility-debug', '-lns3.18-config-store-debug', '-lns3.18-network-debug', '-lns3.18-stats-debug', '-lns3.18-antenna-debug', '-lns3.18-core-debug', '-lrt', '-lsqlite3', '-lgtk-x11-2.0', '-lgdk-x11-2.0', '-latk-1.0', '-lgio-2.0', '-lpangoft2-1.0', '-lpangocairo-1.0', '-lgdk_pixbuf-2.0', '-lcairo', '-lpango-1.0', '-lfreetype', '-lfontconfig', '-lgobject-2.0', '-lglib-2.0', '-lxml2','-lboost_serialization',] Any help on how I add '-boost_serialization' at the end of list of link flags?? Regards, Rohit Is this a documentation bug? or build-system? |