Could not build correctly with option enable-tests

60 views
Skip to first unread message

Jin L

unread,
Oct 15, 2016, 9:30:45 AM10/15/16
to ns-3-users
Hi,

after reading manual of NS-3, I would like to run some tests provided by NS-3 just described in the section about test.

However, when I configure NS-3 to enable tests I can't successfully build it by running ./waf. If I just enable examples, I can build it correct. 

The operating system I'm using is MAC OS X, but to build module BRITE, I actually configure to use gcc compiler.

Here is my steps for successful and failed configuration and building(I build with optional module BRITE):

Successful configuration and building:

./waf configure --check-c-compiler=gcc --check-cxx-compiler=g++ --with-brite=/Users/XXX/BRITE --enable-examples


./waf 


Failed configuration and buildiing:


./waf configure --check-c-compiler=gcc --check-cxx-compiler=g++ --with-brite=/Users/XXX/BRITE --enable-examples --enable-tests


./waf 


the failure I encountered is :


[1540/2528] Compiling src/brite/test/brite-test-topology.cc

[2412/2528] Linking build/libns3.25-brite-test-debug.dylib

Undefined symbols for architecture x86_64:

  "ns3::OnOffHelper::OnOffHelper(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, ns3::Address)", referenced from:

      BriteTopologyFunctionTestCase::DoRun()      in brite-test-topology.cc.3.o

  "ns3::PacketSinkHelper::PacketSinkHelper(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, ns3::Address)", referenced from:

      BriteTopologyFunctionTestCase::DoRun()      in brite-test-topology.cc.3.o

  "ns3::OnOffHelper::Install(ns3::Ptr<ns3::Node>) const", referenced from:

      BriteTopologyFunctionTestCase::DoRun()      in brite-test-topology.cc.3.o

  "ns3::PacketSinkHelper::Install(ns3::Ptr<ns3::Node>) const", referenced from:

      BriteTopologyFunctionTestCase::DoRun()      in brite-test-topology.cc.3.o

  "typeinfo for ns3::PacketSink", referenced from:

      ns3::Ptr<ns3::PacketSink> ns3::DynamicCast<ns3::PacketSink, ns3::Application>(ns3::Ptr<ns3::Application> const&) in brite-test-topology.cc.3.o

ld: symbol(s) not found for architecture x86_64

collect2: error: ld returned 1 exit status


I guess the problem is somehow related to dynamic library. But I don't know how this happened and how to solve it. If it is problem of building the module BRITE, examples of BRITE should also not functional. But the test failed to compile, however examples compile well.



 




pdbarnes

unread,
Oct 15, 2016, 11:37:04 AM10/15/16
to ns-3-users
If I remember correctly the way to select (not just check) the compiler us

$ CXX=... waf configure ...

That alone probably won't fix your issue, however.

Peter

Jin L

unread,
Oct 20, 2016, 5:18:50 AM10/20/16
to ns-3-users
I am not sure of it. I use macport to select my default c and c++ compiler. However, without the checking of c and c++ compiler, waf will still try to first find the c and c++ compiler first and use this compiler first instead of my default setting. Then it would become problematic because the library that generated by BRITE is compiled with gcc, and waf configuration will prompt error when they checking the BRITE library. 

pdbarnes於 2016年10月15日星期六 UTC+2下午5時37分04秒寫道:

pdbarnes

unread,
Oct 20, 2016, 8:43:10 AM10/20/16
to ns-3-users
Using a package system only sets the default in so far as it's found first in the PATH. To set the compiler for waf do what I wrote above.

Peter

Reply all
Reply to author
Forward
0 new messages