HOWTO use latest gcc release

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

This is a brief HOWTO on building latest gcc to test ns-3 compatibility, for Linux.

This page draws heavily from this wiki page.

Goal

Let's say that your system runs a version of gcc (e.g. 6.3) but a new release has just been published (e.g. 7.1). Binary packages may not yet exist for this new release. However, you can still download and build a local copy of gcc to use to test ns-3 compatibility.

The prerequisites are some disk space (about 5 GB for the 7.1 release), and prerequisite development packages for gmp (e.g. gmp-devel), mpfr (e.g. mpfr-devel), and mpc (e.g. libmpc-devel).

Steps

1. Download latest gcc archive (e.g. gcc-7.1.0.tar.gz) and unpack in your directory. 2. Create a 'gcc-build' directory in parallel to this archive directory, and build there:

 $ cd ~
 $ mkdir gcc-7.1.0-build

3. Create a 'gcc-local' directory in parallel also, and configure the install prefix accordingly:

 $ mkdir gcc-7.1.0-local
 $ cd gcc-7.1.0-build
 $ ../gcc-7.1.0/configure --prefix=/home/<username>/gcc-7.1.0-local --enable-cxx

4. build and install

 $ make && make install

5. set your path appropriately for your shell (you may want to put this into a shell script).

 $ export PATH=/home/<username>/gcc-7.1.0-local/bin:$PATH
 $ export LD_LIBRARY_PATH=/home/<username>/gcc-7.1.0-local/lib64:$LD_LIBRARY_PATH

6. test that the correct gcc is found

 $ gcc -v

7. try to build ns-3 from this configuration

 $ cd /path/to/ns-3-dev
 $ ./waf configure ...  (check that the listed gcc version matches your new version)