Bugzilla – Bug 1093
Problem building nsc with g++ 4.6.0 (Fedora): scons: *** [test/test_interface] Error -11
Last modified: 2011-06-14 09:14:16 UTC
When building ns-3-allinone-dev on Fedora 15 prerelease version with g++ 4.6.0, I get the following: # Build NSC Entering directory `nsc' => python scons.py scons: Reading SConscript files ... Checking target architecure...(cached) x86 scons: done reading SConscript files. scons: Building targets ... g++ -o test/test_interface test/test_interface.o -Ltest -lsimulator -ldl LD_LIBRARY_PATH=/home/vedranm/bin/ns-3-allinone/nsc/lib test/test_interface scons: *** [test/test_interface] Error -11 scons: building terminated because of errors. # Build NSC: failure (ignoring NSC) Leaving directory `nsc'
That's a segmentation fault. A backtrace would be useful. You could run the test in gdb to see this, e.g. export LD_LIBRARY_PATH=`pwd` gdb test/test_interface run backtrace It might be useful to build with debugging enabled... I think this can be accomplished with: ./scons CC='gcc -g' CXX='g++ -g' All of the above would need to be executed in the NSC directory.
Hope this helps: [vedranm@kalopsia nsc]$ g++ --version g++ (GCC) 4.6.0 20110413 (Red Hat 4.6.0-4) Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [vedranm@kalopsia nsc]$ gcc --version gcc (GCC) 4.6.0 20110413 (Red Hat 4.6.0-4) Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE [vedranm@kalopsia nsc]$ CC='gcc -g' CXX='g++ -g' ./scons.py scons: Reading SConscript files ... Checking target architecure...(cached) x86 scons: done reading SConscript files. scons: Building targets ... g++ -o test/test_interface test/test_interface.o -Ltest -lsimulator -ldl LD_LIBRARY_PATH=/home/vedranm/bin/ns-3-allinone/nsc/lib test/test_interface scons: *** [test/test_interface] Error -11 scons: building terminated because of errors. [vedranm@kalopsia nsc]$ gdb test/test_interface GNU gdb (GDB) Fedora (7.2.90.20110411-34.fc15) Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-redhat-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /home/vedranm/bin/ns-3-allinone/nsc/test/test_interface...done. (gdb) run Starting program: /home/vedranm/bin/ns-3-allinone/nsc/test/test_interface Program received signal SIGSEGV, Segmentation fault. std::__detail::_List_node_base::_M_hook (this=0x805b030, __position=0x805ae2c) at ../../../../libstdc++-v3/src/list.cc:129 129 __position->_M_prev->_M_next = this; (gdb) backtrace #0 std::__detail::_List_node_base::_M_hook (this=0x805b030, __position=0x805ae2c) at ../../../../libstdc++-v3/src/list.cc:129 #1 0x08051e03 in std::list<ST_TestInfo, std::allocator<ST_TestInfo> >::_M_insert (this=0x805ae2c, __position=..., __x=...) at /usr/lib/gcc/i686-redhat-linux/4.6.0/../../../../include/c++/4.6.0/bits/stl_list.h:1516 #2 0x08051cd8 in std::list<ST_TestInfo, std::allocator<ST_TestInfo> >::push_back (this=0x805ae2c, __x=...) at /usr/lib/gcc/i686-redhat-linux/4.6.0/../../../../include/c++/4.6.0/bits/stl_list.h:988 #3 0x080519d9 in ST_RegisterTest (name=0x80522b0 "TestNewLinuxInterface", func= 0x8049364 <TestNewLinuxInterface(ST_TestInfo*)>) at test/simple_test.cc:14 #4 0x0804a784 in TestNewLinuxInterface__test_init::TestNewLinuxInterface__test_init ( this=0x805ae14) at test/test_interface.cc:6 #5 0x0804a728 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at test/test_interface.cc:6 #6 0x0804a768 in _GLOBAL__sub_I_TestNewLinuxInterface__test_initialiser () at test/test_interface.cc:128 #7 0x08052202 in __libc_csu_init () #8 0x4dbaf4aa in __libc_start_main (main=0x804a6d1 <main()>, argc=1, ubp_av=0xbffff0e4, init=0x80521b0 <__libc_csu_init>, fini=0x8052220 <__libc_csu_fini>, rtld_fini=0x4db829b0 <_dl_fini>, stack_end=0xbffff0dc) at libc-start.c:185 #9 0x080492d1 in _start ()
Even i can report issues building using nsc with g++4.6.0 (Fedora 15-beta) python ./scons.py linux-2.6.18 [?1034hscons: Reading SConscript files ... Checking target architecure...(cached) amd64, checking userland ...amd64 scons: done reading SConscript files. scons: Building targets ... flex -t globaliser/lexer.l > globaliser/lexer.lex.cc bison --defines=globaliser//parser.tab.hh globaliser/parser.yc -o globaliser/parser.tab.cc globaliser/parser.yc: conflicts: 1 shift/reduce g++ -o globaliser/lexer.lex.o -c -Wall -g -O globaliser/lexer.lex.cc g++ -o globaliser/parser.tab.o -c -Wall -g -O globaliser/parser.tab.cc g++ -o globaliser/ilex.o -c -Wall -g -O globaliser/ilex.cc g++ -o globaliser/handle_global.o -c -Wall -g -O globaliser/handle_global.cc g++ -o globaliser/node.o -c -Wall -g -O globaliser/node.cc globaliser/node.cc: In member function 'bool node_t::handle_global(std::string, std::list<std::basic_string<char> >*, std::list<std::basic_string<char> >*)': globaliser/node.cc:883:36: warning: variable 'str_start' set but not used [-Wunused-but-set-variable] globaliser/node.cc:749:40: warning: variable 'declarator' set but not used [-Wunused-but-set-variable] globaliser/node.cc:483:9: warning: variable 'orig_newlines' set but not used [-Wunused-but-set-variable] g++ -o globaliser/globaliser globaliser/lexer.lex.o globaliser/parser.tab.o globaliser/ilex.o globaliser/handle_global.o globaliser/node.o -lfl /usr/bin/ld: cannot find -lfl collect2: ld returned 1 exit status scons: *** [globaliser/globaliser] Error 1 scons: building terminated because of errors.
The crash bug reported by Vedran is now fixed in the NSC mercurial repository. John, the issue you report is the flex development libraries are not installed; the message "/usr/bin/ld: cannot find -lfl" indicates this. I've added a configure step to NSC to check for this and warn the user. NSC now appears to work for me using Ubuntu with gcc-4.6 installed. I'd appreciate any further testing though, and I'll hold off on making a release until I get an "all clear".
(In reply to comment #4) > The crash bug reported by Vedran is now fixed in the NSC mercurial repository. > > John, the issue you report is the flex development libraries are not installed; > the message "/usr/bin/ld: cannot find -lfl" indicates this. I've added a > configure step to NSC to check for this and warn the user. > > NSC now appears to work for me using Ubuntu with gcc-4.6 installed. I'd > appreciate any further testing though, and I'll hold off on making a release > until I get an "all clear". Thanks Sam, installing flex-static gave me libfl.a. Now the build is able to proceed.
Seems to go further. Great. On Fedora 15 fully updated as of today, I'm getting: g++ -o test/app.o -c -Wall -g -Isim -Itest test/app.cc g++ -o test/sim.o -c -Wall -g -Isim -Itest test/sim.cc g++ -o test/net.o -c -Wall -g -Isim -Itest test/net.cc g++ -o test/nsc_support.o -c -Wall -g -Isim -Itest test/nsc_support.cc g++ -o test/simple_test.o -c -Wall -g -Isim -Itest test/simple_test.cc ar rc test/libsimulator.a test/sim.o test/net.o test/nsc_support.o test/app.o test/simple_test.o ranlib test/libsimulator.a g++ -o test/test_interface.o -c -Wall -g -Isim -Itest test/test_interface.cc g++ -o test/test_interface test/test_interface.o -Ltest -lfl -lsimulator -ldl LD_LIBRARY_PATH=/home/vedranm/bin/ns-3-allinone/nsc/lib test/test_interface TEST: TestNewLinuxInterface ... PASS TEST: TestFreeBSDInterface ... scons: *** [test/test_interface] Error -11 scons: building terminated because of errors. # Build NSC: failure (ignoring NSC) Is that OK?
Looks like it was crashing on 32-bit with gcc-4.6. I've pushed another fix for the crash you are seeing Vedran. Please feel free to update and re-test, I believe it should be working now for this configuration as well.
It seems to work now: g++ -o test/test_interface test/test_interface.o -Ltest -lfl -lsimulator -ldl LD_LIBRARY_PATH=/home/vedranm/bin/ns-3-allinone/nsc/lib test/test_interface TEST: TestNewLinuxInterface ... PASS TEST: TestFreeBSDInterface ... PASS TEST: TestOpenBSDInterface ... PASS TEST: TestLwipInterface ... PASS g++ -o test/test_tcp_stream.o -c -Wall -g -Isim -Itest test/test_tcp_stream.cc g++ -o test/test_tcp_stream test/test_tcp_stream.o -Ltest -lfl -lsimulator -ldl LD_LIBRARY_PATH=/home/vedranm/bin/ns-3-allinone/nsc/lib test/test_tcp_stream TEST: TestTcpStream ... PASS scons: done building targets. Leaving directory `nsc' Thanks.