Bash script to install gcc 4.8.4 and boost 1.57 on CentOS and Mac OS X

The script provided installs gcc 4.8.4 and boost 1.57.0 on CentOS and Mac OS X for testing. It is another entry in my continuing series of releases for different versions of g++. Hopefully this will make it easier for folks that want to experiment with this version of the GNU C++ compiler to use C++-11 constructs.

This script is also available on github:

There is also a very simple Makefile: that is not required but that I found useful.

This text version is also available so that you can cut-n-paste from a web page:

Please note that this is not a product. It is simply my best attempt to get it working in my development environments. For example, it does not check for packages because I try to build it on different systems that have different package managers (yum, apt, port, etc.). What this means is that if it doesn’t work for you, you will have to do some debugging. If you find a problem, please post a fix in the comment section here so that others can benefit from it.

1 Download and Install It

Here are the steps to download and install it. Root access is not required unless you need to install support packages.

The build process can take a long time depending on the speed of your CPU(s) and disks. On my test system it took several 5 hours.

If the process fails it is most likely because packages are missing on the system.

If a problem does occur, install the package, then delete the src and bld directories and try again. If you have installed the option Makefile you can type “make clean” and then “make”.

The rtf (release to field) directory contains the releases for each package.

2 How to Use the Compiler

This section shows how to compile, link and execute a simple program using the newly installed compiler by setting up your environment properly. This program is src/LOCAL-TEST/ and is used to test the installation.

You compile, link and run it as follows:

3 Disk Space Requirements

You will need about 5.5GB to download and build all of the packages. Once the build is finished you can reclaim most of the space because the released files only require about 600 MB. Here is the breakdown:

Note that the logs directory exists because I used the “make” command instead of running directly.

Once it is built you can remove everything except the contents of the rtf directory tree to save disk space.

4 Packages

This is the list of packages that are installed in the release area.

5 Tested Platforms

These are the platforms that I actually tested the installation on.

Distro Version Arch Status Date Notes
x86_64 Passed 2015-03-01 Had to manually install the glibc_devel.i686 and texinfo packages.
x86_64 Passed 2015-03-01 Used macports for setting up the environment.

Unfortunately, I do not have the bandwidth to try to get this to work on other distros (even though I have several Ubuntu boxes at hand) but it should be fairly straightforward to port because it does not rely on distro specific package management.

If you port it to another distro, please send me the changes to that I can incorporate them.


2 thoughts on “Bash script to install gcc 4.8.4 and boost 1.57 on CentOS and Mac OS X”

  1. I got this error during the compilation: (any idea)

    cc1plus: error: unrecognized command line option “-Wno-overlength-strings”
    make[3]: *** [build/genconstants.o] Error 1
    make[3]: Leaving directory /home/adminapp/apps/gcc-4.8.3/bld/gcc-4.8.3/gcc'
    make[2]: *** [all-stage1-gcc] Error 2
    make[2]: Leaving directory
    make[1]: *** [stage1-bubble] Error 2
    make[1]: Leaving directory `/home/adminapp/apps/gcc-4.8.3/bld/gcc-4.8.3′
    make: *** [all] Error 2
    STATUS = 2

    1. Sorry about the delay, I have been out of town.

      I know that this does not directly address the issue but I thought that this option was for C99 to catch strings longer than 4095. As far as I know, C++ does not have a limit on string length so removing it should have no affect.

      What is your command line?
      What is the setting of LD_LIBRARY_PATH? it is possible that you are using components from an older compiler for some reason
      Are you specifying “-x c++” or compiling a C++ source file (i.e., *.cc)?
      Do you have the output of a “-v” run? I would like to see what is going on in more detail.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.