HOWTO build old versions of ns-3 on newer compilers

From Nsnam
Revision as of 21:27, 15 June 2012 by Tomh (Talk | contribs) (HOWTO on old versions)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 errors 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', 
 '-DNS3_LOG_ENABLE', '-DNETWORK_SIMULATION_CRADLE', '-DNS3_MODULE_COMPILATION', '../src/common/spectrum-model.cc', 
 '-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', 
 '-DNS3_LOG_ENABLE', '-DNETWORK_SIMULATION_CRADLE', '-DNS3_MODULE_COMPILATION', '../src/common/spectrum-model.cc', '-c', 
 '-o', 'debug/src/common/spectrum-model_1.o']
 In file included from ../src/common/spectrum-model.cc:22:0:
 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: