Bug 2667

Summary: ns-allinone-3.26 build fails on Centos 6.8
Product: bake Reporter: Roman Ronge <roman.ronge>
Component: bakeAssignee: Daniel Camara <daniel.camara>
Status: RESOLVED INVALID    
Severity: normal CC: ns-bugs, tomh
Priority: P3    
Version: unspecified   
Hardware: PC   
OS: Linux   

Description Roman Ronge 2017-03-08 16:06:50 EST
Hi,
I just downloaded ns-allinone-3.26 and trying to build it on our Centos 6.8 with g++ 4.4.7, however, unsuccessfully. After replacing "c++11" options with "c++0x" in wscripts, the build still fails with the following error in building the arp-cache:

[ 968/1892] Compiling src/internet/model/udp-l4-protocol.cc
In file included from /usr/lib/gcc/i686-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_algobase.h:66,
                 from /usr/lib/gcc/i686-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/char_traits.h:41,
                 from /usr/lib/gcc/i686-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ios:41,
                 from /usr/lib/gcc/i686-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ostream:40,
                 from /usr/lib/gcc/i686-redhat-linux/4.4.7/../../../../include/c++/4.4.7/iostream:40,
                 from ./ns3/assert.h:54,
                 from ../src/internet/model/arp-cache.cc:20:
/usr/lib/gcc/i686-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_pair.h: In constructor ‘std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U1 = int, _U2 = ns3::Ipv4Header&, _T1 = ns3::Ptr<ns3::Packet>, _T2 = ns3::Ipv4Header]’:
../src/internet/model/arp-cache.cc:516:   instantiated from here
/usr/lib/gcc/i686-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_pair.h:90: error: invalid conversion from ‘int’ to ‘ns3::Packet*’
/usr/lib/gcc/i686-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_pair.h:90: error:   initializing argument 1 of ‘ns3::Ptr<T>::Ptr(T*) [with T = ns3::Packet]’

Waf: Leaving directory `/home/me/ns-allinone-3.26/ns-3.26/build'
Build failed
 -> task in 'ns3-internet' failed (exit status 1):
        {task 165866220: cxx arp-cache.cc -> arp-cache.cc.1.o}
['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-std=c++0x', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-fPIC', '-pthread', '-I.', '-I..', '-DNS3_BUILD_PROFILE_DEBUG', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DHAVE_SYS_IOCTL_H=1', '-DHAVE_IF_NETS_H=1', '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_PACKET_H=1', '-DHAVE_IF_TUN_H=1', '-DHAVE_=1', '-DHAVE_GSL=1', '-DHAVE_SQLITE3=1', '../src/internet/model/arp-cache.cc', '-c', '-o', '/home/me/ns-allinone-3.26/ns-3.26/build/src/internet/model/arp-cache.cc.1.o']
Traceback (most recent call last):
  File "./build.py", line 171, in <module>
    sys.exit(main(sys.argv))
  File "./build.py", line 162, in main
    build_ns3(config, build_examples, build_tests, args, build_options)
  File "./build.py", line 82, in build_ns3
    run_command([sys.executable, "waf", "build"] + build_options)
  File "/home/me/ns-allinone-3.26/util.py", line 25, in run_command
    raise CommandError("Command %r exited with code %i" % (argv, retval))
util.CommandError: Command ['/usr/bin/python', 'waf', 'build'] exited with code 1
Comment 1 Tom Henderson 2017-03-08 16:39:31 EST
Thanks for reporting an issue with your system, but gcc versions less than 4.8 are no longer supported as of ns-3.26, due to lack of C++-11 support.  For the upcoming release, gcc-4.9 series will be the minimal version supported.

I have a Centos 6 machine and I needed to do two things:

1) Install devtoolset-3 package and use scl to enable it (see these instructions):

http://superuser.com/questions/834862/how-to-install-g-4-9-2-in-cent-os-6-5

2) enable python-2.7, again using scl:

scl enable python27 bash
export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.6/site-packages

With python-2.7 and gcc-4.9.2, you should be able to use most features of ns-3.26.