https://www.nsnam.org/mediawiki/index.php?title=HOWTO_use_latest_gcc_release&feed=atom&action=historyHOWTO use latest gcc release - Revision history2024-03-29T05:45:57ZRevision history for this page on the wikiMediaWiki 1.24.1https://www.nsnam.org/mediawiki/index.php?title=HOWTO_use_latest_gcc_release&diff=10354&oldid=prevTomh: notes on building for new gcc2017-05-07T15:21:11Z<p>notes on building for new gcc</p>
<p><b>New page</b></p><div>{{TOC}}<br />
<br />
This is a brief HOWTO on building latest gcc to test ns-3 compatibility, for Linux.<br />
<br />
This page draws heavily from [http://openwall.info/wiki/internal/gcc-local-build this wiki page].<br />
<br />
== Goal ==<br />
<br />
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.<br />
<br />
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).<br />
<br />
== Steps ==<br />
<br />
1. Download latest gcc archive (e.g. gcc-7.1.0.tar.gz) and unpack in your directory.<br />
2. Create a 'gcc-build' directory in parallel to this archive directory, and build there:<br />
<br />
$ cd ~<br />
$ mkdir gcc-7.1.0-build<br />
<br />
3. Create a 'gcc-local' directory in parallel also, and configure the install prefix accordingly:<br />
<br />
$ mkdir gcc-7.1.0-local<br />
$ cd gcc-7.1.0-build<br />
$ ../gcc-7.1.0/configure --prefix=/home/<username>/gcc-7.1.0-local --enable-cxx<br />
<br />
4. build and install<br />
<br />
$ make && make install<br />
<br />
5. set your path appropriately for your shell (you may want to put this into a shell script).<br />
<br />
$ export PATH=/home/<username>/gcc-7.1.0-local/bin:$PATH<br />
$ export LD_LIBRARY_PATH=/home/<username>/gcc-7.1.0-local/lib64:$LD_LIBRARY_PATH<br />
<br />
6. test that the correct gcc is found <br />
<br />
$ gcc -v<br />
<br />
7. try to build ns-3 from this configuration<br />
<br />
$ cd /path/to/ns-3-dev<br />
$ ./waf configure ... (check that the listed gcc version matches your new version)</div>Tomh