NS-3 build fails due to g++ compiler error

3.7k views Asked by At

I am trying to build NS3 on Raspbian (Jessie) and ran into this error:

...
[1507/1924] Compiling src/internet/model/ripng-header.cc
[1508/1924] Compiling src/internet/helper/ripng-helper.cc
[1509/1924] Compiling src/internet/helper/rip-helper.cc
[1510/1924] Compiling build/src/internet/bindings/ns3module.cc
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.

Waf: Leaving directory `/home/pi/tarballs/ns-allinone-3.26/ns-3.26/build'
Build failed
 -> task in 'ns3module_internet' failed (exit status 4):
        {task 3056100368L: cxx ns3module.cc -> ns3module.cc.8.o}
['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-std=c++11', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-fPIC', '-fno-strict-aliasing', '-fstack-protector-strong', '-fwrapv', '-fvisibility=hidden', '-Wno-array-bounds', '-pthread', '-pthread', '-I.', '-I..', '-Isrc/internet/bindings', '-I../src/internet/bindings', '-I/usr/include/python2.7', '-I/usr/include/arm-linux-gnueabihf/python2.7', '-I/usr/include/gtk-2.0', '-I/usr/lib/arm-linux-gnueabihf/gtk-2.0/include', '-I/usr/include/gio-unix-2.0', '-I/usr/include/cairo', '-I/usr/include/pango-1.0', '-I/usr/include/atk-1.0', '-I/usr/include/pixman-1', '-I/usr/include/libpng12', '-I/usr/include/gdk-pixbuf-2.0', '-I/usr/include/harfbuzz', '-I/usr/include/glib-2.0', '-I/usr/lib/arm-linux-gnueabihf/glib-2.0/include', '-I/usr/include/freetype2', '-I/usr/include/libxml2', '-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', '-DNS_DEPRECATED=', '-DNS3_DEPRECATED_H', '-DHAVE_PYEXT=1', '-D_FORTIFY_SOURCE=2', '-DNDEBUG', '-DHAVE_GSL=1', '-DHAVE_SQLITE3=1', '-DHAVE_GTK2=1', '-DHAVE_LIBXML2=1', 'src/internet/bindings/ns3module.cc', '-c', '-o', '/home/pi/tarballs/ns-allinone-3.26/ns-3.26/build/src/internet/bindings/ns3module.cc.8.o']
Waf died. Not running tests

I have searched SO and none of the existing questions seem to be relevant. There definitely seems to be something wrong in general because it takes many hours just to get to this point, when I think(?) it should take < 1 hour to build NS-3.

2

There are 2 answers

0
ericheindl On

I had a similar problem.
It seems to be either a problem with the ns3 version in combination with python, gcc versions, or, a problem with the RAM or GPU memory.

So, I set up a new Ubuntu VM with double the RAM and did not use the latest ns3 version (ns3 3.33) Since ns3 version 2.xx are based on python2, I would recommend versions 3.xx.

1
Joe Stewart On

Not sure if you're still looking for a solution, however the problem seems to be related to memory constraints. I solved the issue by enabling/configuring a swapfile.

sudo dd if=/dev/zero of=/swapfile bs=64M count=16
sudo mkswap /swapfile
sudo swapon /swapfile

After you build the project, you have the option to disable the swapfile (only if you want). To do this type this in your terminal:

sudo swapoff /swapfile
sudo rm /swapfile

Hope this helps!