HOWTO build old versions of ns-3 on newer compilers

From Nsnam
Jump to: navigation, search

Main Page - Current Development - Developer FAQ - Tools - Related Projects - Project Ideas - Summer Projects

Installation - Troubleshooting - User FAQ - HOWTOs - Samples - Models - Education - Contributed Code - Papers

ns-3 builds with the following flags by default: "-Wall -Werror". This causes build warnings to trigger an error and stop the build. This causes problems when trying to build older versions of ns-3 on newer systems with newer compilers, since over time, gcc gets more strict.

To disable warnings from breaking your build, do the following:

 CXXFLAGS="-Wall" ./waf configure
 ./waf -vv

Now you will observe that all files are built with -Wall and not -Werror; e.g.

 14:16:16 runner system command -> ['/bin/g++', '-Wall', '-fPIC', '-DPIC', '-Idebug', '-I..', '-DNS3_ASSERT_ENABLE', 
 '-c', '-o', 'debug/src/common/spectrum-model_1.o']

You may run into other issues (such as missing header files) in trying to build on newer platforms. e.g.

 14:16:16 runner system command -> ['/bin/g++', '-Wall', '-fPIC', '-DPIC', '-Idebug', '-I..', '-DNS3_ASSERT_ENABLE', 
 '-o', 'debug/src/common/spectrum-model_1.o']
 In file included from ../src/common/
 debug/ns3/spectrum-model.h:91:3: error: ‘size_t’ does not name a type

This particular error is due to a change in C++ STL; the STL headers no longer incorporate c-style headers, so one must include <cstddef> explicitly.

This page describes other tricks to configure how waf builds things. Pass these flags at 'waf configure' time.

Specific tips

If there is a specific tip for getting past one of these types of issues, please enter it below: