GCCGO Error During GCC-10.4.0 Compilation on CentOS 7

If you encounter “gccgo: error: ../x86_64-pc-linux-gnu/libgo/libgotool.a: No such file or directory”

.....
.....
/home/user1/gcc-10.4.0/host-x86_64-pc-linux-gnu/gcc/gccgo -B/home/user1/gcc-10.4.0/host-x86_64-pc-linux-gnu/gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem /usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include   -g -O2 -I ../x86_64-pc-linux-gnu/libgo -static-libstdc++ -static-libgcc  -L ../x86_64-pc-linux-gnu/libgo -L ../x86_64-pc-linux-gnu/libgo/.libs -o go ../.././gotools/../libgo/go/cmd/go/alldocs.go ../.././gotools/../libgo/go/cmd/go/go11.go ../.././gotools/../libgo/go/cmd/go/main.go ../x86_64-pc-linux-gnu/libgo/libgotool.a  
gccgo: error: ../x86_64-pc-linux-gnu/libgo/libgotool.a: No such file or directory
make[2]: *** [Makefile:821: go] Error 1
make[2]: Leaving directory '/home/user1/gcc-10.4.0/host-x86_64-pc-linux-gnu/gotools'
make[1]: *** [Makefile:14649: all-gotools] Error 2
make[1]: Leaving directory '/home/user1/gcc-10.4.0'
make: *** [Makefile:997: all] Error 2

The issue can be easily resolved by not building gcc in the same directory as the source code. At GCC Home

% ./contrib/download_prerequisites
% mkdir build
% ../configure --prefix=/usr/local/gcc-10.4.0 --disable-multilib --enable-languages=all
% make -j 8
% make install
Advertisement

Compiling GCC 12.1.0 on Rocky Linux 8.5

Option 1: The longer and customised method

Step 1: Download the following prerequisites applications libraries from https://gcc.gnu.org/pub/gcc/infrastructure/

  1. gmp-6.2.1
  2. mpfr-4.1.0
  3. mpc-1.2.1

Step 1. Install gmp-6.2.1

% bunzip2 gmp-6.2.1.tar.bz2
% tar -xvf gmp-6.2.1.tar
% cd gmp-6.2.1
% ./configure --prefix=/usr/local/gmp-6.2.1
% make 
% make install

Step 2: Install mpfr-4.1.0 (requires gmp-6.2.1 as prerequisites)

% bunzip2 mpfr-4.1.0.tar.bz
% tar -xvf mpfr-4.1.0.tar
% cd mpfr-4.1.0/
% ./configure --prefix=/usr/local/mpfr-4.1.0 --with-gmp=/usr/local/gmp-6.2.1/
% make
% make install

Step 3: Install mpc-1.2.1 (requires gmp-6.2.1 and mpfr-4.1.0)

% tar -zxvf mpc-1.2.1.tar.gz
% cd mpc-1.2.1/
% ./configure --prefix=/usr/local/mpc-1.2.1 -with-gmp=/usr/local/gmp-6.2.1 --with-mpfr=/usr/local/mpfr-4.1.0
% make
% make install

Step 4: Install isl-0.24 (requires gmp-6.2.1 as prerequisites)

% bunzip2 isl-0.24.tar.bz2
% tar -xvf isl-0.24.tar
% cd isl-0.24
% ./configure --prefix=/usr/local/isl-0.24 --with-gmp-prefix=/usr/local/gmp-6.2.1/
% make
% make install

Configure and Build GCC

% git clone git://gcc.gnu.org/git/gcc.git
% cd gcc
% mkdir build-gcc
% cd build-gcc
% ../configure --prefix=/usr/local/gcc-12.1 --enable-bootstrap --enable-languages=c,c++,fortran,lto --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux --with-static-standard-libraries --with-gmp=/usr/local/gmp-6.2.1 --with-mpc=/usr/local/mpc-1.2.1 --with-mpfr=/usr/local/mpfr-4.1.0 --with-isl=/usr/local/isl-0.24 --with-isl-lib=/usr/local/isl-0.24/lib --with-isl-include=/usr/local/isl-0.24/include

You may encounter issues like

/usr/local/software/gcc/build-gcc/./gcc/cc1: error while loading shared libraries: libisl.so.23: cannot open shared object file: No such file or directory

An alternative way is to let GCC do the download for you….. Retracing the steps

% git clone git://gcc.gnu.org/git/gcc.git
% cd gcc
% contrib/download_prerequisites
% mkdir build-gcc
% cd build-gcc
% ../configure --prefix=/usr/local/gcc-12.1 --enable-bootstrap --enable-languages=c,c++,fortran,lto --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux --with-static-standard-libraries

If you encounter any errors during make such as

/usr/include/gnu/stubs.h:7:11: fatal error: gnu/stubs-32.h: No such file or directory

It is due to missing glibc-devel and glibc-devel.i686. You have to do a dnf install glibc-devel and glibc-devel.i686

% dnf install glibc-devel glibc-devel.i686

Option 2: The Faster Method

You can take a look at Compiling GCC-10.4.0 on CentOS-7 and tune to GCC-12.1.0

References:

References:

https://gcc.gnu.org/wiki/InstallingGCC

Compiling OpenMPI-3.1.6 with GCC-6.5

We assumed that you have installed GNU 6.5 and isl-0.15

Download the latest OpenMPI 3.1.6 package from OpenMPI site

% ./configure --prefix=/usr/local/gnu/openmpi-3.1.6 --enable-orterun-prefix-by-default --enable-mpi-cxx --enable-openib-rdmacm-ibaddr --enable-mca-no-build=btl-uct

–enable-orterun-prefix-by-default (Configure OMPI –enable-orterun-prefix-by-default and so that you do not need to add the prefix option)
–enable-openib-rdmacm-ibaddr (To enable routing over IB)
–enable-mpi-cxx (C++ bindings are no more built by default)
–enable-mca-no-build=btl-uct (ecent OpenMPI versions contain a BTL component called ‘uct’, which can cause data corruption when enabled, due to conflict on malloc hooks between OPAL and UCM.)

% make all install | tee install.log

References:

  1. Intel Community – Caught Signal 11 (Segmentation Fault: Does not mapped to object at)
  2. Open MPI + Scalasca :Can not run mpirun command with option –prefix?

Reverting back to CMake-3.9.6

When I was compiling CMAKE-3.11.4 with GNU-5.4.0, we encountered the error

"The C++ compiler does not support C++11 (e.g. std::unique_ptr)"

This was rather complex to solve. I believe if I upgrade my GNU Compilers, it might work. Somehow at GNU 5.4, it does not recognize the C++11 support.

But when I downgraded to Cmake-3.9.6, it works immediately without issues. Do look at https://cmake.org/files/v3.9/

# cd $CMAKE_HOME
#./bootstrap
# gmake

Dealing with The compiler /usr/bin/c++ has no C++11 support for CentOS 6

If you compiling using cmake and you make encounter error like this. This is despite the fact that you use the latest compiler like GNU-5.2.0. But somehow the cmake is still looking at the older gnu that comes with CentOS 6

[user1@node1 build]$ cmake ..
-- The C compiler identification is GNU 4.4.7
-- The CXX compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at CMakeLists.txt:24 (message):
The compiler /usr/bin/c++ has no C++11 support. Aborting.

To resolve this, you have to be more explicit in the cmake parameter point to the corrcet g++, gcc

[user1@node1 build]$ cmake .. -DCMAKE_CXX_COMPILER=/usr/local/gcc-5.2.0/bin/g++ -DCMAKE_C_COMPILER=/usr/local/gcc-5.2.0/bin/gcc

Compiling GNU 5.2.0 on CentOS 6

1. Prerequisites:

You will need

  1. gmp 4.3.1-7.el6_2.2
  2. mpfr  2.4.1-6.el6
  3. mpc 0.19-1.el6.rf and
  4. isl-0.14

For 1 to 3, do take a look at Compiling GNU 4.8.1 on CentOS 6. For 4, do take look at Compiling isl-0.15 library

2a. Update linked library at /etc/ld.so.conf

# touch /etc/ld.so.conf.d/library.conf
/usr/local/isl-0.15/lib
/usr/local/mpfr-2.4.2/lib
/usr/local/mpc-0.8.1/lib
/usr/local/gmp-4.3.2/lib

2b. Update your .bashrc

export LD_LIBRARY_PATH=/usr/local/mpfr-2.4.2/lib:/usr/local/mpc-0.8.1/lib:/usr/local/gmp-4.3.2/lib:/usr/local/isl-0.15/lib

3. Compile. This will take a while.

# tar -zxvf  gcc-4.8.1.tar.gz
# cd gcc-4.8.1
# mkdir build-gcc
# cd build-gcc
# ../configure --prefix=/usr/local/gcc-5.2.0 
--with-mpfr=/usr/local/mpfr-2.4.2 
--with-mpc=/usr/local/mpc-0.8.1 
--with-gmp=/usr/local/gmp-4.3.2
--with-isl=/usr/local/isl-0.14
--disable-multilib
--disable-libmpx
--enable-shared
--enable-languages=c,c++,fortran,go,objc,obj-c++  
--host x86_64-redhat-linux-gnu 
--build x86_64-redhat-linux-gnu
# make -j 16
# make install

References:

  1. Encountering error -static-libstdc++ not implemented when compiling GNU 4.8.1 on CentOS 6
  2. Configure Error when compiling GCC 5.2.0 on CentOS 6.6

Compiling GNU Scientific Library (GSL) gsl-1.16 on CentOS 6

The GNU Scientific Library (GSL) is a numerical library for C and C++ programmers. It is free software under the GNU General Public License.

The library provides a wide range of mathematical routines such as random number generators, special functions and least-squares fitting. There are over 1000 functions in total with an extensive test suite.

Step 1: The current version of GSL is gsl-1.16.tar.gz

Step 2: You may want to use the latest GCC 4.8.1 to compile. For more information on how to compile GCC 4.8.1, see Compiling GNU 4.8.1 on CentOS 6. This compilation will help to fix all the components required for gsl-1.16

Step 3: After packing gsl, To compile

# cd /root/gsl-1.15/
# mkdir build-gsl
# cd build-gsl
# ../configure --prefix=/usr/local/gsl-1.16/
# make 
# make install

Compiling GCC 4.7.2 on CentOS 5

Step 1: Download the following prerequistics applications libraries from ftp://gcc.gnu.org/pub/gcc/infrastructure/

  1. gmp-4.3.2.tar.bz2
  2. mpfr-2.4.2.tar.bz2
  3. mpc-0.8.1.tar.gz

1. Install gmp-4.3.2

# bunzip2 gmp-4.3.2.tar.bz2
# tar -zxvf gmp-4.3.2.tar
# cd gmp-4.3.2
# ./configure --prefix=/usr/local/gmp-4.3.2
# make
# make install

2. Install mpfr-2.4.2 (requires gmp-4.3.2 as prerequisites)

# bunzip2 mpfr-2.4.2.tar.bz2
# tar -zxvf mpfr-2.4.2.tar
# cd mpfr-2.4.2
# ./configure --prefix=/usr/local/mpfr-2.4.2 --with-gmp=/usr/local/gmp-4.3.2/
# make
# make install

3. Install mpc-0.8.1 (requires gmp-4.3.2 and mpfr-2.4.2 as prerequisites )

# tar -zxvf mpc-0.8.1.tar.gz
# cd mpc-0.8.1
#./configure --prefix=/usr/local/mpc-0.8.1/ --with-gmp=/usr/local/gmp-4.3.2/ --with-mpfr=/usr/local/mpfr-2.4.2
# make
# make install

4. Update your LD_LIBRARY_PATH at your ~/.bashrc

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mpc-0.8.1:/usr/local/mpfr-2.4.2/lib:/usr/local/gmp-4.3.2/lib

5. Install the glibc-devel.i686. For more information, do look at Error when compiling GCC 4.8.1 (linuxtoolkit.blogspot.com)

6. Finally install GNU CC 4.7.2

# tar -zxvf  gcc-4.7.2.tar.gz
# cd gcc-4.7.2
# mkdir build-gcc
# cd build-gcc
# ../configure --prefix=/usr/local/gcc-4.7.2 \ 
--with-mpfr=/usr/local/mpfr-2.4.2 \ 
--with-mpc=/usr/local/mpc-0.8.1 \
--with-gmp=/usr/local/gmp-4.3.2 \
--with-mpfr-include=/usr/local/mpfr-2.4.2/include \
--with-mpc-include=/usr/local/mpc-0.8.1/include
# make all-gcc
# make install-gcc

Compiling GNU 4.8.1 on CentOS 6

I encountered error when compiling GCC 4.8.1 on CentOS 6 I have the prequistics (via yum installed)

  1. gmp 4.3.1-7.el6_2.2
  2. mpfr  2.4.1-6.el6
  3. mpc 0.19-1.el6.rf

But still I enountered the error

configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+. 
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify their locations.  
Source code for these libraries can be found at their respective hosting sites as well as 
at ftp://gcc.gnu.org/pub/gcc/infrastructure/

To resolve the issue, download from the ftp://gcc.gnu.org/pub/gcc/infrastructure/ the following application and compile them.

  1. gmp-4.3.2.tar.bz2
  2. mpfr-2.4.2.tar.bz2
  3. mpc-0.8.1.tar.gz

1. Install gmp-4.3.2

# bunzip2 gmp-4.3.2.tar.bz2
# tar -zxvf gmp-4.3.2.tar
# cd gmp-4.3.2
# ./configure --prefix=/usr/local/gmp-4.3.2
# make
# make install

2. Install mpfr-2.4.2 (requires gmp-4.3.2 as prerequisites)

# bunzip2 mpfr-2.4.2.tar.bz2
# tar -zxvf mpfr-2.4.2.tar
# cd mpfr-2.4.2
# ./configure --prefix=/usr/local/mpfr-2.4.2 --with-gmp=/usr/local/gmp-4.3.2/
# make
# make install

3. Install mpc-0.8.1 (requires gmp-4.3.2 and mpfr-2.4.2 as prerequisites )

# tar -zxvf mpc-0.8.1.tar.gz
# cd mpc-0.8.1
#./configure --prefix=/usr/local/mpc-0.8.1/ --with-gmp=/usr/local/gmp-4.3.2/ --with-mpfr=/usr/local/mpfr-2.4.2
# make
# make install

4. Update your LD_LIBRARY_PATH reflect /usr/local/mpc-0.8.1/lib In your .bash_profile include the following

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mpc-0.8.1

5. Install the glibc-devel.i686. For more information, do look at Error when compiling GCC 4.8.1 (linuxtoolkit.blogspot.com)
6. Finally install GNU CC 4.8.1

# tar -zxvf  gcc-4.8.1.tar.gz
# cd gcc-4.8.1
# mkdir build-gcc
# cd build-gcc
# ../configure --prefix=/usr/local/gcc-4.8.1 --with-mpfr=/usr/local/mpfr-2.4.2 --with-mpc=/usr/local/mpc-0.8.1 --with-gmp=/usr/local/gmp-4.3.2
# make
# make install