My server has GCC4 and I need newer version, so I built GCC7.3.0 and added the path to the $PATH variable. After this, gcc -v
and g++ -v
points to the correct version:
Using built-in specs.COLLECT_GCC=gccCOLLECT_LTO_WRAPPER=/users/home/m/GCC-7.3.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/7.3.0/lto-wrapperTarget: x86_64-pc-linux-gnuConfigured with: /home/m/gccbuild/../srcdir/configure --prefix=/home/m/GCC-7.3.0 --enable-languages=c,c++,fortran,go --disable-multilibThread model: posixgcc version 7.3.0 (GCC)
However, I tried compiling a simple hello.cc
program and ldd a.out
gives:
linux-vdso.so.1 => (0x00007ffe609bb000)libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fa0bff67000)libm.so.6 => /lib64/libm.so.6 (0x00007fa0bfc65000)libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fa0bfa4f000)libc.so.6 => /lib64/libc.so.6 (0x00007fa0bf681000)/lib64/ld-linux-x86-64.so.2 (0x00007fa0c026e000)
From here, was expecting something like:
libstdc++.so.6 => /users/home/m/GCC-7.3.0/lib64/libstdc++.so.6 (0x0000123456789000)libgcc_s.so.1 => /users/home/m/GCC-7.3.0/lib64/libgcc_s.so.1 (0x0000123456ABC000)
Also, cat /proc/version
gives:
Linux version 3.10.0-1127.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ) #1 SMP Tue Mar 31 23:36:51 UTC 2020
EDIT:
Output to grep configure config.status
within gcc build directory:
# Generated by configure.# Compiler output produced by configure, useful for debugging# configure, is in config.log if it exists.configured by /home/s18002/gccbuild/../srcdir/configure, generated by GNU Autoconf 2.64,ac_configure_extra_args= ac_configure_extra_args="$ac_configure_extra_args --silent" set X '/bin/sh''/home/s18002/gccbuild/../srcdir/configure''--prefix=/home/m/GCC-7.3.0''--disable-multilib''--enable-languages=c,c++,fortran,go,lto' $ac_configure_extra_args --no-create --no-recursion"L) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes; else echo -funconfigured-libstdc++-v3 ; fi` -L$$r/$(TARGET_SUBDIR)/li"\S["extra_host_zlib_configure_flags"]=""S["extra_host_libiberty_configure_flags"]="--enable-shared"S["extra_linker_plugin_configure_flags"]=""S["extra_isl_gmp_configure_flags"]="--with-gmp- builddir=$$r/$(HOST_SUBDIR)/gmp"S["extra_mpc_mpfr_configure_flags"]="--with-mpfr-include=$$s/mpfr/src --with-mpfr-lib=$$r/$(HOST_SUBDIR)/mpfr/src/.libs"S["extra_mpc_gmp_configure_flags"]="--with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-gmp-lib=$$r/$(HOST_SUBDIR)/gmp/.libs"S["extra_mpfr_configure_flags"]="--with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-gmp-lib=$$r/$(HOST_SUBDIR)/gmp/.libs"S["extra_liboffloadmic_configure_flags"]=""S["TOPLEVEL_CONFIGURE_ARGUMENTS"]="/home/s18002/gccbuild/../srcdir/configure --prefix=/home/s18002/GCC-7.3.0 --enable-languages=c,c++,fortran,go --disable-multilib"# Let's still pretend it is `configure' which instantiates (i.e., don'tconfigure_input='Generated from '``' by configure.' configure_input="$ac_file. $configure_input"case $configure_input in #( ac_sed_conf_input=`$as_echo "$configure_input" |*) ac_sed_conf_input=$configure_input;;s|@configure_input@|$ac_sed_conf_input|;t t
The package I was trying to install got installed, which means it is using gcc7. How can I make sure GCC7 is used locally for all my purposes?