Building NS-3.29 with CentOS 7.6.1810

143 views
Skip to first unread message

Ricardo

unread,
Dec 20, 2019, 9:10:28 PM12/20/19
to ns-3-users
Hi,

I'm trying to install NS-3 in a server at my school.

The server has installed CentOS version 7.6.1810 and I don't have sudo privileges.

The server has installed gcc and g++ version 4.8.5-36. So, if I try to build NS-3.29 with those compilers it complains that it needs the minimum version 4.9.2. To solve this, I compiled from the sources gcc/g++ version 8.1.0. With this, I generated the executables xgcc and xg++ that are located in the directory /prime/apps/gcc/8.1.0/gcc.

So, I have the following directory hierarchy:

/prime/apps/gcc/8.1.0/gcc/
  xgcc
  xg++


Now I should be ready to build NS-3. I execute the following commands:

$ cd ~/NS3-Workspace

$ tar xjf
ns-allinone-3.29.tar.bz2

$ cd ns-allinone-3.29/
ns-3.29

This extracted NS-3's source code. Now I add the directory where xgcc and xg++ are to the PATH environment variable:

$ PATH=$PATH":/prime/apps/gcc/8.1.0/gcc"

And try to configure and build NS-3:

$ CXX="xg++" CC="xgcc" ./waf configure --build-profile=optimized --enable-examples --enable-tests

Setting top to                           : /prime/users/ricardo/NS3-Workspace/ns-allinone-3.29/ns-3.29 
Setting out to                           : /prime/users/ricardo/NS3-Workspace/ns-allinone-3.29/ns-3.29/build 
Checking for 'gcc' (C compiler)          : xgcc 
Checking for cc version                  : 8.1.0 
Checking for 'g++' (C++ compiler)        : xg++ 
Checking for compilation flag -march=native support : ok 
Checking for compilation flag -Wl,--soname=foo support : ok 
Checking for compilation flag -std=c++11 support       : ok 
Checking for program 'python'                          : /usr/bin/python 
Checking for python version >= 2.3                     : 2.7.5 
python-config                                          : /usr/bin/python-config 
Asking python-config for pyembed '--cflags --libs --ldflags' flags : yes 
Testing pyembed configuration                                      : Could not build a python embedded interpreter 
Testing pyembed configuration                                      : Could not build a python embedded interpreter 
Checking boost includes                                            : headers not found, please provide a --boost-includes argument (see help) 
Checking boost includes                                            : headers not found, please provide a --boost-includes argument (see help) 
Checking for click location                                        : not found 
Checking for program 'pkg-config'                                  : /usr/bin/pkg-config 
Checking for 'gtk+-3.0'                                            : not found 
Checking for 'libxml-2.0'                                          : not found 
checking for uint128_t                                             : not found 
checking for __uint128_t                                           : not found 
Checking high precision implementation                             : cairo 128-bit integer (default) 
Checking for header stdint.h                                       : not found 
Checking for header inttypes.h                                     : not found 
Checking for header sys/inttypes.h                                 : not found 
Checking for header sys/types.h                                    : not found 
Checking for header sys/stat.h                                     : not found 
Checking for header dirent.h                                       : not found 
Checking for header stdlib.h                                       : not found 
Checking for header signal.h                                       : not found 
Checking for header pthread.h                                      : Could not find pthread support (build/config.log for details) 
Checking for header stdint.h                                       : not found 
Checking for header inttypes.h                                     : not found 
Checking for header sys/inttypes.h                                 : not found 
Checking for library rt                                            : not found 
Checking for NSC location                                          : not found 
Checking for 'sqlite3'                                             : not found 
Checking for program 'sudo'                                        : /usr/bin/sudo 
Checking for program 'valgrind'                                    : not found 
Checking for 'gsl'                                                 : not found 
python-config                                                      : not found 
Checking for compilation flag -fstrict-aliasing support            : ok 
Checking for compilation flag -fstrict-aliasing support            : ok 
Checking for compilation flag -Wstrict-aliasing support            : ok 
Checking for compilation flag -Wstrict-aliasing support            : ok 
Checking for program 'doxygen'                                     : not found 
---- Summary of optional NS-3 features:
Build profile                 : optimized
Build directory               : 
BRITE Integration             : not enabled (BRITE not enabled (see option --with-brite))
DES Metrics event collection  : not enabled (defaults to disabled)
Examples                      : enabled
File descriptor NetDevice     : not enabled (needs threading support which is not available)
GNU Scientific Library (GSL)  : not enabled (GSL not found)
Gcrypt library                : not enabled (libgcrypt not found: you can use libgcrypt-config to find its location.)
GtkConfigStore                : not enabled (library 'gtk+-3.0 >= 3.0' not found)
MPI Support                   : not enabled (option --enable-mpi not selected)
NS-3 Click Integration        : not enabled (nsclick not enabled (see option --with-nsclick))
NS-3 OpenFlow Integration     : not enabled (Required boost libraries not found)
Network Simulation Cradle     : not enabled (NSC not found (see option --with-nsc))
PyViz visualizer              : not enabled (Python Bindings are needed but not enabled)
Python Bindings               : not enabled (Python library or headers missing)
Real Time Simulator           : not enabled (librt is not available)
SQlite stats data output      : not enabled (library 'sqlite3' not found)
Tap Bridge                    : not enabled (needs threading support which is not available)
Tests                         : enabled
Threading Primitives          : not enabled (<pthread.h> include not detected)
Use sudo to set suid bit      : not enabled (option --enable-sudo not selected)
XmlIo                         : not enabled (library 'libxml-2.0 >= 2.7' not found)
'configure' finished successfully (1.436s)

As you can see, when checking for headers it got a lot of not found messages.

I opened the build/config.log file to try to see what happened, and I noticed a lot of similar messages:

/usr/include/stdlib.h:32:10: fatal error: stddef.h: No such file or directory
 #include <stddef.h>

...

/usr/include/signal.h:350:11: fatal error: stddef.h: No such file or directory
 # include <stddef.h>

...

/usr/include/limits.h:124:26: error: no include path in which to search for limits.h
 # include_next <limits.h>

...

(etc)

I don't know why this happens, because if I go to /usr/include I can see that most of the supposedly not found headers are there.

I tried adding /usr/include explicitly to the PATH variable, but the result was the same: the headers are not found.


I continued with the building process to see what happened:

$ ./waf

Waf: Entering directory `/prime/users/ricardo/NS3-Workspace/ns-allinone-3.29/ns-3.29/build'
[   1/2539] Compiling install-ns3-header: ns3/angles.h
[   2/2539] Compiling install-ns3-header: ns3/antenna-model.h
[   3/2539] Compiling install-ns3-header: ns3/cosine-antenna-model.h
[   4/2539] Compiling install-ns3-header: ns3/isotropic-antenna-model.h
[   5/2539] Compiling install-ns3-header: ns3/parabolic-antenna-model.h
...
...
[ 883/2539] Processing gen-module-header: ns3/wave-module.h
[ 884/2539] Processing gen-module-header: ns3/wifi-module.h
[ 885/2539] Processing gen-module-header: ns3/wimax-module.h
[ 886/2539] Compiling src/core/model/time.cc
In file included from ../src/core/model/nstime.h:24,
                 from ../src/core/model/time.cc:22:
../src/core/model/attribute.h:23:10: fatal error: string: No such file or directory
 #include <string>
          ^~~~~~~~
compilation terminated.

Waf: Leaving directory `/prime/users/ricardo/NS3-Workspace/ns-allinone-3.29/ns-3.29/build'
Build failed
 -> task in 'ns3-core' failed with exit status 1 (run with -v to display more information)

Now it fails because it can't find string header, but, just like last time, I can see that string.h header does exist in /usr/include.


I don't know for sure, but I think that for some unknown reason waf is not looking in /usr/include directory.


Does anyone know how to fix this issue I'm having?

Thanks in advance :)



Tom Henderson

unread,
Dec 21, 2019, 5:19:33 PM12/21/19
to Ricardo, ns-3-users
On 12/20/19 6:10 PM, Ricardo wrote:
Hi,

I'm trying to install NS-3 in a server at my school.

The server has installed CentOS version 7.6.1810 and I don't have sudo privileges.

The server has installed gcc and g++ version 4.8.5-36. So, if I try to build NS-3.29 with those compilers it complains that it needs the minimum version 4.9.2.

Yes, 4.8 series or earlier will no longer work.

Although you are not an admin on this server, someone may have installed a newer compiler via the software collections framework, in which case it may exist on a different path.  Check this path, for instance:

/opt/rh/devtoolset-8/root/usr/bin/gcc

To read more about it, please consult https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/

If it exists, you can try 'scl enable devtoolset-8 bash' and it should extend your environment variables so that you can preferentially use that alternative version.

Not all headers are in /usr/include; stddef.h typically is not.

I don't know whether your problems stem from not having done the 'make install' step on gcc.

Here is a wiki page that lists how to build a different version of gcc and how to modify environment variables to get Waf to default to it.  Please let us know if it doesn't work for you:

https://www.nsnam.org/wiki/HOWTO_use_latest_gcc_release

- Tom


Ricardo

unread,
Dec 25, 2019, 7:23:27 AM12/25/19
to ns-3-users
Hi Tom, thank you for your reply.

I tried the two solutions that you proposed. Fortunately, one of them worked.


On Saturday, December 21, 2019 at 3:19:33 PM UTC-7, Tom Henderson wrote:
On 12/20/19 6:10 PM, Ricardo wrote:
Hi,

I'm trying to install NS-3 in a server at my school.

The server has installed CentOS version 7.6.1810 and I don't have sudo privileges.

The server has installed gcc and g++ version 4.8.5-36. So, if I try to build NS-3.29 with those compilers it complains that it needs the minimum version 4.9.2.

Yes, 4.8 series or earlier will no longer work.

Although you are not an admin on this server, someone may have installed a newer compiler via the software collections framework, in which case it may exist on a different path.  Check this path, for instance:

/opt/rh/devtoolset-8/root/usr/bin/gcc

To read more about it, please consult https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/

If it exists, you can try 'scl enable devtoolset-8 bash' and it should extend your environment variables so that you can preferentially use that alternative version.


I checked the route /opt/rh/devtoolset-8/root/usr/bin/gcc and it doesn't exist, I think that the software collections framework is not installed in this server.
Yes! You are absolutely right. I forgot to execute make install. Now I've executed it and all my problems are gone.

I think that the guide you shared (https://www.nsnam.org/wiki/HOWTO_use_latest_gcc_release) is very helpful for all others who have the same problem because it resumes all the steps that involve the build and installing of gcc.

Thanks a lot :)


PS. I read all the sections of the manual to install GCC (https://gcc.gnu.org/install/) and executed the testing (https://gcc.gnu.org/install/test.html). I'm worried because it is showing some unexpected fails and some unexpected passes:

 === gcc Summary ===


# of expected passes 138393
# of unexpected failures 49
# of unexpected successes 20

# of expected failures 433
# of unsupported tests 2293

Reply all
Reply to author
Forward
0 new messages