Bash script to install gcc 4.7.2 and boost 1.51.0 on CentOS 5.5+ and 6.3

I recently installed gcc 4.7.2 and boost 1.51.0 on CentOS 5.5, 5.8 and 6.3 to take advantage of the improved support for C++-11. It was painful to do manually so I automated the process with this script: http://projects.joelinoff.com/gcc-4.7.2/bld.sh. Hopefully this will make it easier for folks that want to experiment with the latest version of the GNU C++ compiler.

If you are interested in a more recent version, I recently added a post that provides a script to install gcc-4.8.3 and boost 1.55.0.


This text version is also available so that you can cut-n-paste from a web page: http://projects.joelinoff.com/gcc-4.7.2/bld.sh.txt.

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 systems it took more than 4 hours.

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

2 Use It

This section shows how to compile, link and execute a simple program using the newly installed compiler by setting up your environment properly.

You compile, link and run it as follows:

3 Disk Space Requirements

You will need about 8GB 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 1 GB. Here is the breakdown:

4 Packages

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

Package Version Web Site Notes
binutils
2.22
http://ftp.gnu.org/gnu/binutils  
boost
1.51.0
http://sourceforge.net/projects/boost/files/boost  
cloog
0.17
http://www.bastoul.net/cloog”>http://www.bastoul.net/cloog  
gcc
4.7.2
http://ftp.gnu.org/gnu/gcc  
gmp
5.0.5
http://gmplib.org/  
libiconv
1.14
http://ftp.gnu.org/pub/gnu/libiconv  
mpc
1.0
http://www.multiprecision.org/mpc  
mpfr
3.1.1
http://www.mpfr.org  
ppl
1.0
http://bugseng.com/products/ppl Not recognized by gcc which looks for 0.11 or later.

5 Tested Platforms

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

Distro Version Arch Notes
CentOS
6.3
x86_64 Had to manually install the glibc_devel.i686 package.
CentOS
5.8
x86_64 Worked out of the box.
CentOS
5.5
x86_64 Worked out of the box.
CentOS
5.2
x86_64 Verified 2012/09/26 by quentin.

Unfortunately, I do not have the bandwidth to try to get this to work on other distros 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.

Enjoy!

44 thoughts on “Bash script to install gcc 4.7.2 and boost 1.51.0 on CentOS 5.5+ and 6.3

  1. Pingback: Bash script to install gcc 4.7.0 and boost 1.49 | Joe's Blog

  2. N.T

    It worked perfectly on my CentOS 6.3 boxes, Thank you so much!

    Here’s some feedbacks I noticed:
    + The “Minimal” installation of CentOS lacks several packages like bzip2-devel, python-devel etc…
    Specifically, binutils requires bison, or the build aborts halfway.
    May time permit, I’ll test on a clean box for a more thorough list.
    + The OS bundles python-2.6, not 2.7, and anyway the header-file name ‘pyconfig-64.h’ mismatches what boost expects: ‘pyconfig.h’.
    A trivial workaround I used is: # ln -s /usr/include/python2.6/pyconfig-64.h /usr/include/pyconfig.h
    + To install the toolchain into the system’s default location, say ‘/usr’, the following steps apply:
    # cd rtf
    # find . -print | cpio -pvdm /usr
    Of course, you need the root privilege and SHOULD BE AWARE OF WHAT YOU’RE DOING.

    Thanks again for this awesome work!

  3. Vitt

    Thank You for new version of very useful script.
    I found that the script work is completed without error if I use the system’s GCC.
    If I use the GCC built with previous script I get the error “missing -lpwl”.

  4. wolfpack

    For what it’s worth, sudo yum install -y glibc_devel.i686 doesn’t give any hits.
    It should be sudo yum install -y glibc-devel.i686.
    Replaced that and everything else worked like a charm. Thanks.

  5. ruslan

    Didn’t work for me on Centos 6.3 with following errors

    make[5]: Entering directory /root/bld/gcc-4.7.2/x86_64-unknown-linux-gnu/32/libgcc'
    # If this is the top-level multilib, build all the other
    # multilibs.
    DEFINES='' HEADERS='/root/src/gcc-4.7.2/libgcc/config/i386/value-unwind.h' \
    /root/src/gcc-4.7.2/libgcc/mkheader.sh > tmp-libgcc_tm.h
    /bin/sh /root/src/gcc-4.7.2/libgcc/../move-if-change tmp-libgcc_tm.h libgcc_tm.h
    echo timestamp > libgcc_tm.stamp
    /root/bld/gcc-4.7.2/./gcc/xgcc -B/root/bld/gcc-4.7.2/./gcc/ -B/root/rtf/x86_64-unknown-linux-gnu/bin/ -B/root/rtf/x86_64-unknown-linux-gnu/lib/ -isystem /root/rtf/x86_64-unknown-linux-gnu/include -isystem /root/rtf/x86_64-unknown-linux-gnu/sys-include -g -O2 -m32 -O2 -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fpic -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fpic -I. -I. -I../../.././gcc -I/root/src/gcc-4.7.2/libgcc -I/root/src/gcc-4.7.2/libgcc/. -I/root/src/gcc-4.7.2/libgcc/../gcc -I/root/src/gcc-4.7.2/libgcc/../include -I/root/src/gcc-4.7.2/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS -DUSE_TLS -o _muldi3.o -MT _muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c /root/src/gcc-4.7.2/libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS
    In file included from /usr/include/features.h:385:0,
    from /usr/include/stdio.h:28,
    from /root/src/gcc-4.7.2/libgcc/../gcc/tsystem.h:88,
    from /root/src/gcc-4.7.2/libgcc/libgcc2.c:29:
    /usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory
    compilation terminated.
    make[5]: *** [_muldi3.o] Error 1
    make[5]: Leaving directory
    /root/bld/gcc-4.7.2/x86_64-unknown-linux-gnu/32/libgcc’
    make[4]: *** [multi-do] Error 1
    make[4]: Leaving directory /root/bld/gcc-4.7.2/x86_64-unknown-linux-gnu/libgcc'
    make[3]: *** [all-multi] Error 2
    make[3]: Leaving directory
    /root/bld/gcc-4.7.2/x86_64-unknown-linux-gnu/libgcc’
    make[2]: *** [all-stage1-target-libgcc] Error 2
    make[2]: Leaving directory /root/bld/gcc-4.7.2'
    make[1]: *** [stage1-bubble] Error 2
    make[1]: Leaving directory
    /root/bld/gcc-4.7.2′
    make: *** [all] Error 2
    STATUS = 2

      1. Nick

        I had the same problem:
        $ uname -a
        Linux localhost.localdomain 2.6.32-279.14.1.el6.x86_64 #1 SMP Tue Nov 6 23:43:09 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

        $ cat /etc/redhat-release
        CentOS release 6.3 (Final)

        ========================
        /data/shared/tools/gcc/4.7.2/bld/gcc-4.7.2/./gcc/xgcc -B/data/shared/tools/gcc/4
        .7.2/bld/gcc-4.7.2/./gcc/ -B/data/shared/tools/gcc/4.7.2/rtf/x86_64-unknown-linu
        x-gnu/bin/ -B/data/shared/tools/gcc/4.7.2/rtf/x86_64-unknown-linux-gnu/lib/ -isy
        stem /data/shared/tools/gcc/4.7.2/rtf/x86_64-unknown-linux-gnu/include -isystem
        /data/shared/tools/gcc/4.7.2/rtf/x86_64-unknown-linux-gnu/sys-include -g -O2
        -m32 -O2 -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-protot
        ypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fpic -g
        -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fpic -I. -I. -I../../../.
        /gcc -I/data/shared/tools/gcc/4.7.2/src/gcc-4.7.2/libgcc -I/data/shared/tools/gc
        c/4.7.2/src/gcc-4.7.2/libgcc/. -I/data/shared/tools/gcc/4.7.2/src/gcc-4.7.2/libg
        cc/../gcc -I/data/shared/tools/gcc/4.7.2/src/gcc-4.7.2/libgcc/../include -I/data
        /shared/tools/gcc/4.7.2/src/gcc-4.7.2/libgcc/config/libbid -DENABLE_DECIMAL_BID_
        FORMAT -DHAVE_CC_TLS -DUSE_TLS -o _muldi3.o -MT _muldi3.o -MD -MP -MF _muldi3.d
        ep -DL_muldi3 -c /data/shared/tools/gcc/4.7.2/src/gcc-4.7.2/libgcc/libgcc2.c -fv
        isibility=hidden -DHIDE_EXPORTS
        In file included from /usr/include/features.h:385:0,
        from /usr/include/stdio.h:28,
        from /data/shared/tools/gcc/4.7.2/src/gcc-4.7.2/libgcc/../gcc/t
        system.h:88,
        from /data/shared/tools/gcc/4.7.2/src/gcc-4.7.2/libgcc/libgcc2.
        c:29:
        /usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or dire
        ctory
        compilation terminated.
        make[5]: *** [_muldi3.o] Error 1
        make[5]: Leaving directory /data/shared/tools/gcc/4.7.2/bld/gcc-4.7.2/x86_64-un
        known-linux-gnu/32/libgcc'
        make[4]: *** [multi-do] Error 1
        make[4]: Leaving directory
        /data/shared/tools/gcc/4.7.2/bld/gcc-4.7.2/x86_64-un
        known-linux-gnu/libgcc’
        make[3]: *** [all-multi] Error 2
        make[3]: Leaving directory /data/shared/tools/gcc/4.7.2/bld/gcc-4.7.2/x86_64-un
        known-linux-gnu/libgcc'
        make[2]: *** [all-stage1-target-libgcc] Error 2
        make[2]: Leaving directory
        /data/shared/tools/gcc/4.7.2/bld/gcc-4.7.2′
        make[1]: *** [stage1-bubble] Error 2
        make[1]: Leaving directory `/data/shared/tools/gcc/4.7.2/bld/gcc-4.7.2′
        make: *** [all] Error 2
        STATUS = 2

  6. Salehram

    First thanks a lot for this…
    I am having issues on Centos 6.2, basically I belive some missing libraries and packages, is it possible for someone who did it on Centos 6.3 OR 6.2 to post something about the required packages for this to work?
    Regards

    1. jlinoff Post author

      You can diagnose missing packages by looking at the error messages (i.e., missing libfoobarspam.so) and running “yum whatprovides '*/libfoobarspam.so'” to determine the associated packages.

      Here are the installed groups from the output of “yum grouplist” on one of my hosts. It may be helpful but it is definitely overkill (meaning some groups can definitely be removed). It might help you get started.

      Installed Groups:
      Additional Development
      Base
      Client management tools
      Compatibility libraries
      Debugging Tools
      Desktop
      Desktop Debugging and Performance Tools
      Desktop Platform
      Desktop Platform Development
      Development tools
      Dial-up Networking Support
      Directory Client
      E-mail server
      Eclipse
      Electronic Lab
      Emacs
      Fonts
      General Purpose Desktop
      Graphical Administration Tools
      Graphics Creation Tools
      Hardware monitoring utilities
      Identity Management Server
      Input Methods
      Internet Browser
      Java Platform
      Large Systems Performance
      Legacy UNIX compatibility
      Legacy X Window System compatibility
      Messaging Client Support
      Milkymist
      MySQL Database client
      NFS file server
      Network Infrastructure Server
      Network file system client
      Networking Tools
      PHP Support
      Performance Tools
      Perl Support
      PostgreSQL Database client
      PostgreSQL Database server
      Print Server
      Printing client
      Remote Desktop Clients
      Ruby Support
      SNMP Support
      Scientific support
      Security Tools
      Server Platform
      Server Platform Development
      Systems Management Messaging Server support
      TeX support
      Technical Writing
      Virtualization
      Virtualization Client
      Virtualization Platform
      Web Server
      X Window System
      iSCSI Storage Client

  7. Vladimir Mikhelson

    Thank you for posting the script.
    Unfortunately it crashed half-way for me. Tried to build on CentOS 5.8 with GCC 4.1.2. Received the following:
    ………………………….
    mv -f .deps/ppl_c_implementation_common.Tpo .deps/ppl_c_implementation_common.Plo
    /bin/sh ../../libtool –tag=CXX –mode=compile g++ -DHAVE_CONFIG_H -I. -I/usr/src/gcc/src/ppl-1.0/interfaces/C -I../.. -I/usr/src/gcc/src/ppl-1.0/interfaces -I../../interfaces/C -I../../src -I/usr/src/gcc/rtf/include -g -O2 -frounding-math -W -Wall -MT ppl_c_Polyhedron.lo -MD -MP -MF .deps/ppl_c_Polyhedron.Tpo -c -o ppl_c_Polyhedron.lo ppl_c_Polyhedron.cc
    libtool: compile: g++ -DHAVE_CONFIG_H -I. -I/usr/src/gcc/src/ppl-1.0/interfaces/C -I../.. -I/usr/src/gcc/src/ppl-1.0/interfaces -I../../interfaces/C -I../../src -I/usr/src/gcc/rtf/include -g -O2 -frounding-math -W -Wall -MT ppl_c_Polyhedron.lo -MD -MP -MF .deps/ppl_c_Polyhedron.Tpo -c ppl_c_Polyhedron.cc -fPIC -DPIC -o .libs/ppl_c_Polyhedron.o
    In file included from /usr/src/gcc/src/ppl-1.0/interfaces/C/ppl_c_implementation_common.defs.hh:28,
    from ppl_c_Polyhedron.cc:24:
    ../../src/ppl.hh:107316:9: warning: undefining “__STDC_LIMIT_MACROS”
    libtool: compile: g++ -DHAVE_CONFIG_H -I. -I/usr/src/gcc/src/ppl-1.0/interfaces/C -I../.. -I/usr/src/gcc/src/ppl-1.0/interfaces -I../../interfaces/C -I../../src -I/usr/src/gcc/rtf/include -g -O2 -frounding-math -W -Wall -MT ppl_c_Polyhedron.lo -MD -MP -MF .deps/ppl_c_Polyhedron.Tpo -c ppl_c_Polyhedron.cc -o ppl_c_Polyhedron.o >/dev/null 2>&1
    make[6]: *** [ppl_c_Polyhedron.lo] Error 1
    make[6]: Leaving directory /usr/src/gcc/bld/ppl-1.0/interfaces/C'
    make[5]: *** [all-recursive] Error 1
    make[5]: Leaving directory
    /usr/src/gcc/bld/ppl-1.0/interfaces/C’
    make[4]: *** [all] Error 2
    make[4]: Leaving directory /usr/src/gcc/bld/ppl-1.0/interfaces/C'
    make[3]: *** [all-recursive] Error 1
    make[3]: Leaving directory
    /usr/src/gcc/bld/ppl-1.0/interfaces’
    make[2]: *** [all] Error 2
    make[2]: Leaving directory /usr/src/gcc/bld/ppl-1.0/interfaces'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory
    /usr/src/gcc/bld/ppl-1.0′
    make: *** [all] Error 2
    STATUS = 2

  8. Minh

    I got the following error:

    checking for a BSD-compatible install… /usr/bin/install -c
    checking whether build environment is sane… yes
    checking for a thread-safe mkdir -p… /bin/mkdir -p
    checking for gawk… gawk
    checking whether make sets $(MAKE)… yes
    checking whether make sets $(MAKE)… (cached) yes
    checking for gcc… no
    checking for cc… no
    checking for cl.exe… no
    configure: error: in /scratch/tbui/tools/local/bld/libiconv-1.14':
    configure: error: no acceptable C compiler found in $PATH
    See
    config.log’ for more details
    STATUS = 1

    I cannot install the glibc-related packages: headers, common, glibc… cos it looks like they all depends on each other in a loop.

    1. a.gemini

      Dear Minh,

      To fix problem with libiconv-1.14 you will be sure in a C compiler on your compute. In my case I has the same problem when installed gcc4.7 on CentOS 6 with minimal libc. For testing, please do the nest step:

      $ cat >conftest.c
      #define TEST “test”
      int main() {
      ;
      return 0;
      }

      $ gcc conftest.c

      If you will get the compilation error like ‘../crt1.o: could not read symbols: File in wrong format’ then you should check the following installed libraries: glibc, gcclib, libstdc++ for x86_64 and(!) i686. For my this problem was solved by:

      $ sudo yum install -y glibc-devel.x86_64

      Good luck!

  9. alex

    Thank you very much for excellent job.
    I encountered the following errors compiling boost library:
    bld.log
    PLATFORM: linux-centos-6.3-x86_64

    gcc.compile.c++ bin.v2/libs/iostreams/build/gcc-4.4.6/release/threading-multi/zlib.o
    libs/iostreams/src/zlib.cpp:20:76: error: zlib.h: No such file or directory
    libs/iostreams/src/zlib.cpp:31: error: ‘Z_NO_COMPRESSION’ was not declared in this scope

    What am I missing?

    Thanks a lot,

  10. Joshua Chia

    I was able to build all the tools with some customization to boost. The final goal was to copy everything to /usr/local and use it from there, which I did.

    With the resulting g++ binary in /usr/local/bin, I compiled a simple Hello World C++ program and then ran ldd on the resulting a.out. It shows a dependency on a library for gcc 4.4.6, specifically, /lib64/libgcc_s.so.1, instead of /usr/local/lib/libgcc_s.so.1. This seems wrong because I think gcc 4.7.3 generates code that depends on its libgcc. The problem may not show up for a simple Hello World, but will for a more complex program.

    How do I build a gcc that will generate binaries that use libraries in /usr/local/lib?

    $ ldd a.out
    linux-vdso.so.1 => (0x00007fffce7ff000)
    libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000003a3c600000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f6bd9baa000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003a3be00000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f6bd9816000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f6bd9e47000)

    1. Joshua Chia

      To be clear, I was able to get a binary that links to /usr/local/lib64/libgcc_s.so.1 by using -Wl,–rpath=/usr/local/lib64 or LD_RUN_PATH=/usr/local/lib64 when I compile. The question is how do I make this behavior the default? I don’t see why I would not want this to be the default.

  11. Quentin

    This script also works on linux-centos-4.4-x86_64 (!). This version only has Bash 3.00.15 and m4 1.4.1. I don’t know why, but bash choked on the script. Rather than trying to make it compatible, I installed bash 4.2 (surprisingly easy to do), and ran bld.sh with it.

    M4 was added to the script. Everything else worked fine except for a compilation error in GCC, precisely http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40974. It’s not clear if this has been fixed or not, but the suggested work-around (disabling precompiled headers) worked fine for me.

    Here’s the patch: http://paste.debian.net/plain/213226

  12. bulletsweetp

    Compiling for CentOS 6.3 using gcc 4.4.6 I get this error on binutile/gold:

    In file included from /home/ira.woodhead/tmp/gcc-4.7.2/src/binutils-2.22/gold/expression.cc:33:0:
    /home/ira.woodhead/tmp/gcc-4.7.2/src/binutils-2.22/gold/script-c.h:221:7: warning: ‘yylex’ initialized and declared ‘extern’ [enabled by default]
    /home/ira.woodhead/tmp/gcc-4.7.2/src/binutils-2.22/gold/script-c.h:221:7: error: ‘YYSTYPE’ was not declared in this scope
    /home/ira.woodhead/tmp/gcc-4.7.2/src/binutils-2.22/gold/script-c.h:221:15: error: expected primary-expression before ‘,’ token
    /home/ira.woodhead/tmp/gcc-4.7.2/src/binutils-2.22/gold/script-c.h:221:17: error: expected primary-expression before ‘void’
    /home/ira.woodhead/tmp/gcc-4.7.2/src/binutils-2.22/gold/script-c.h:221:30: error: expression list treated as compound expression in initializer [-fpermissive]
    make[4]: *** [expression.o] Error 1
    make[4]: Leaving directory /home/ira.woodhead/tmp/gcc-4.7.2/bld/binutils-2.22/gold'
    make[3]: *** [all-recursive] Error 1
    make[3]: Leaving directory
    /home/ira.woodhead/tmp/gcc-4.7.2/bld/binutils-2.22/gold’
    make[2]: *** [all] Error 2
    make[2]: Leaving directory /home/ira.woodhead/tmp/gcc-4.7.2/bld/binutils-2.22/gold'
    make[1]: *** [all-gold] Error 2
    make[1]: Leaving directory
    /home/ira.woodhead/tmp/gcc-4.7.2/bld/binutils-2.22′
    make: *** [all] Error 2
    STATUS = 2

  13. John

    I would add a note that all platforms will require that flex and bison be installed. These weren’t defaulted on for me on either Centos or Ubuntu.

    I’ve made this to work on Ubuntu 12.04. GCC doesn’t play nicely with Ubuntu’s multiarch layout, to the extent that Ubuntu patches it prior to their compilations. A workaround is to set up a few symlinks, like this:
    sudo ln -s /usr/lib/x86_64-linux-gnu /usr/lib64
    cd /usr/lib
    sudo ln -s x86_64-linux-gnu/crt* .

  14. Daniel

    This script is awesome! Adding to this thread, I would like to share two alternative ways to build gcc-4.7.2, which works on my CentOS 5.4 and 5.8.

    1. use bzr and gsrc (http://www.gnu.org/software/gsrc/)

    After gsrc is configured, simply do these:
    make -C gnu/gcc
    make -C gnu/gcc install

    2. use the script (as seen here: http://gcc.gnu.org/wiki/InstallingGCC): ./contrib/download_prerequisites

    Basically, do these:

    tar xzf gcc-4.7.2.tar.gz
    cd gcc-4.7.2
    ./contrib/download_prerequisites
    cd ..
    mkdir objdir
    cd objdir
    $PWD/../gcc-4.7.2/configure –prefix=/opt/gcc-4.7.2
    make
    make install

  15. Kean

    There is a problem downloading the script with cURL for some reason:

    curl -o bld.sh http://projects.joelinoff.com/gcc-4.7.2/bld.sh

    Error 406 – Not AcceptableError 406 – Not AcceptableAn error has occurred. Generally a 406 error is caused because a request has been blocked by Mod Security. If you believe that your request has been blocked by mistake please contact the web site owner.

  16. ldierk

    Worked like a charm for me:

    I had to:

    yum install gcc-c++
    yum install  glibc-devel.i686 (I just installed it as recommended, I did not try if it works w/o )
    yum install bison (got this error before I installed this package: error: ‘YYSTYPE’ was not declared in this scope)

     

    My uname:

    Linux localhost.localdomain 2.6.32-279.19.1.el6.i686 #1 SMP Wed Dec 19 04:30:58 UTC 2012 i686 i686 i386 GNU/Linux

     

  17. chuck

    Thanks for the nice work. This worked great. I would point out that the current version of mpfr has changed, so in the script I changed

    http://www.mpfr.org/mpfr-current/mpfr-3.1.1.tar.bz2
    to
    http://www.mpfr.org/mpfr-current/mpfr-3.1.2.tar.bz2

    I’m using CentOS 6.2

  18. KS

    Thank you, this is great.

    Is it possible to make the installed version the default (CentOS 6, x64)?  For example, the “gcc” and “g++” commands should call 4.7.2, and the default header and library paths become those used by 4.7.2 only?

  19. Vitt

    1.
    Maybe it would be better to use smp make. For example, like it uses Fedora RPMBUILD’s variable %{?_smp_mflags}:

    %_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\
    && RPM_BUILD_NCPUS=”/usr/bin/getconf _NPROCESSORS_ONLN“; \\\
    if [ "$RPM_BUILD_NCPUS" -gt 16 ]; then echo “-j16″; \\\
    elif [ "$RPM_BUILD_NCPUS" -gt 1 ]; then echo “-j$RPM_BUILD_NCPUS”;
    fi)

    and I changed the script like this:
    docmd $ar make -j /usr/bin/getconf _NPROCESSORS_ONLN

    docmd $ar ./b2 -j /usr/bin/getconf _NPROCESSORS_ONLN

    2.
    New gmp-5.1.0 conflicting with ppl-1.0.
    http://www.cs.unipr.it/pipermail/ppl-devel/2012-December/018574.html
    So I used the snapshot ppl
    http://bugseng.com/external/ppl/download/ftp/snapshots/ppl-1.1pre9.tar.bz2

    3.
    Full list of the actual packages versions which I used to successfully build gcc-4.8.1 on Centos 6.4 x86_64
    http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
    ftp://ftp.gmplib.org/pub/gmp-5.1.2/gmp-5.1.2.tar.bz2
    http://www.mpfr.org/mpfr-current/mpfr-3.1.2.tar.bz2
    http://www.multiprecision.org/mpc/download/mpc-1.0.1.tar.gz
    http://bugseng.com/external/ppl/download/ftp/snapshots/ppl-1.1pre9.tar.bz2
    http://www.bastoul.net/cloog/pages/download/cloog-0.17.0.tar.gz
    http://ftp.gnu.org/gnu/gcc/gcc-4.8.1/gcc-4.8.1.tar.bz2
    http://ftp.gnu.org/gnu/binutils/binutils-2.23.2.tar.bz2
    http://sourceforge.net/projects/boost/files/boost/1.53.0/boost_1_53_0.tar.bz2

    4.
    And again, I used the additional flags to guild gcc: –enable-languages=’c,c++,fortran’ –disable-multilib

    Thanks a lot, again.

  20. Husain

    I have an error after I modified the above script and put all the URL’s as specified for 4.8.1 .

    checking for the GMP library version 4.1.3 or above… no
    configure: error: Cannot find GMP version 4.1.3 or higher.
    GMP is the GNU Multi-Precision library:

    THis is during configuring ppl .

    Can you help ?

  21. Randolph

    Problems with Centos 6.4:

    These must be downloaded manually:

    http://www.mpfr.org/mpfr-current/mpfr-3.1.1.tar.bz2
    http://www.multiprecision.org/mpc/download/mpc-1.0.tar.gz

    This script does not exist: get-platform.sh

    The g++ is left in /shared/tools/gcc/4.7.2/bld/gcc-4.7.2/gcc/g++

    and not  /shared/tools/gcc/4.7.2/rtf/bin

    The gcc is not built but a xgc in bld/gcc-4.7.2/gcc/ might be the same thing?

    Clearly the install is failing silently but I have no idea why…

  22. chandan

    Thank you for providing the script. It was indeed very useful. The installation was successful. After the installation, I could not find the gfortran. Does it ignores. If I want to install it, what changes can be made in the script.

  23. avinashrd

    I am trying to run a simple boost thread program as shown below :

    #include <iostream>
    #include <boost/thread.hpp>
    #include <boost/date_time.hpp>

    void workerFunc()
    {
    boost::posix_time::seconds workTime(3);
    std::cout << “Worker: running” << std::endl;

    // Pretend to do something useful…
    boost::this_thread::sleep(workTime);
    std::cout << “Worker: finished” << std::endl;
    }

    int main(int argc, char* argv[])
    {
    std::cout << “main: startup” << std::endl;
    boost::thread workerThread(workerFunc);

    std::cout << “main: waiting for thread” << std::endl;
    workerThread.join();

    std::cout << “main: done” << std::endl;
    return 0;
    }

    The set value are :

    LD_LIBRARY_PATH=/home/cloudera/Downloads/work/gcc/4.8.3/rtf/lib:/home/cloudera/Downloads/work/gcc/4.8.3/rtf/lib64:

    LD_RUN_PATH=/home/cloudera/Downloads/work/gcc/4.8.3/rtf/lib:/home/cloudera/Downloads/work/gcc/4.8.3/rtf/lib64:/home/cloudera/Downloads/work/gcc/4.8.3/rtf/lib:/home/cloudera/Downloads/work/gcc/4.8.3/rtf/lib64:

    I am getting this below error. I am getting a similar issue in eclipse. Can you please help me out?

    g++ -O3 -std=c++11 -Wall -o Hello.exe Hello.cpp
    /tmp/ccn1QA6T.o: In function workerFunc()':
    Hello.cpp:(.text+0x409): undefined reference to
    boost::this_thread::hiden::sleep_until(timespec const&)’
    /tmp/ccn1QA6T.o: In function boost::detail::thread_data<void (*)()>::~thread_data()':
    Hello.cpp:(.text._ZN5boost6detail11thread_dataIPFvvEED2Ev[_ZN5boost6detail11thread_dataIPFvvEED5Ev]+0x8): undefined reference to
    boost::detail::thread_data_base::~thread_data_base()’
    /tmp/ccn1QA6T.o: In function boost::detail::thread_data<void (*)()>::~thread_data()':
    Hello.cpp:(.text._ZN5boost6detail11thread_dataIPFvvEED0Ev[_ZN5boost6detail11thread_dataIPFvvEED0Ev]+0xc): undefined reference to
    boost::detail::thread_data_base::~thread_data_base()’
    /tmp/ccn1QA6T.o: In function boost::thread_exception::thread_exception(int, char const*)':
    Hello.cpp:(.text._ZN5boost16thread_exceptionC2EiPKc[_ZN5boost16thread_exceptionC5EiPKc]+0x14): undefined reference to
    boost::system::system_category()’
    /tmp/ccn1QA6T.o: In function boost::thread::~thread()':
    Hello.cpp:(.text._ZN5boost6threadD2Ev[_ZN5boost6threadD5Ev]+0x5): undefined reference to
    boost::thread::detach()’
    /tmp/ccn1QA6T.o: In function boost::thread::thread<void (&)()>(void (&)())':
    Hello.cpp:(.text._ZN5boost6threadC2IRFvvEEEOT_[_ZN5boost6threadC5IRFvvEEEOT_]+0x37): undefined reference to
    vtable for boost::detail::thread_data_base’
    Hello.cpp:(.text._ZN5boost6threadC2IRFvvEEEOT_[_ZN5boost6threadC5IRFvvEEEOT_]+0×201): undefined reference to boost::thread::start_thread_noexcept()'
    /tmp/ccn1QA6T.o: In function
    main’:
    Hello.cpp:(.text.startup+0×44): undefined reference to boost::thread::native_handle()'
    Hello.cpp:(.text.startup+0x59): undefined reference to
    boost::thread::join_noexcept()’
    /tmp/ccn1QA6T.o: In function _GLOBAL__sub_I__Z10workerFuncv':
    Hello.cpp:(.text.startup+0x103): undefined reference to
    boost::system::generic_category()’
    Hello.cpp:(.text.startup+0x10f): undefined reference to boost::system::generic_category()'
    Hello.cpp:(.text.startup+0x11b): undefined reference to
    boost::system::system_category()’
    /tmp/ccn1QA6T.o:(.rodata._ZTIN5boost6detail11thread_dataIPFvvEEE[_ZTIN5boost6detail11thread_dataIPFvvEEE]+0×10): undefined reference to `typeinfo for boost::detail::thread_data_base’
    collect2: error: ld returned 1 exit status

     

     

Leave a Reply