Installing a new gcc version, but get ‘configure: error: C compiler cannot create executables’

  anaconda3, c++, centos7, gcc, installation

I am installing a new gcc version 9.1 to system 4.8.5 using these commands:

tar xzf gcc-9.1.0.tar.gz
cd gcc-9.1.0
./contrib/download_prerequisites
cd ..
mkdir gcc-9.1.0-build cd
gcc-9.1.0-build ../gcc-9.1.0/configure –enable-languages=c,c++ –disable-multilib

I got :configure: error: in `/home/gcc-9.1.0-build’:
configure: error: C compiler cannot create executables
See config.log for more details’

I have deleted this anaconda environment detectron2 but still get this in the config.log
The config.log is :

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ../gcc-9.1.0/configure --prefix=/home/gcc-9.1.0 --enable-languages=c,c++ --disable-multilib

## --------- ##
## Platform. ##
## --------- ##

hostname = lms37-27.local
uname -m = x86_64
uname -r = 3.10.0-1127.19.1.el7.x86_64
uname -s = Linux
uname -v = #1 SMP Tue Aug 25 17:23:54 UTC 2020

/usr/bin/uname -p = x86_64
/bin/uname -X     = unknown

/bin/arch              = x86_64
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /usr/local/bin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /usr/bin
PATH: /home/anaconda3/condabin
PATH: /opt/openmpi/bin
PATH: /usr/lib64/qt-3.3/bin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /usr/local/sbin
PATH: /usr/sbin
PATH: /opt/ganglia/bin
PATH: /opt/ganglia/sbin
PATH: /opt/rocks/bin
PATH: /opt/rocks/sbin

PATH: /opt/gridengine/bin/lx-amd64


## ----------- ##
## Core tests. ##
## ----------- ##

configure:2352: checking build system type
configure:2366: result: x86_64-pc-linux-gnu
configure:2413: checking host system type
configure:2426: result: x86_64-pc-linux-gnu
configure:2446: checking target system type
configure:2459: result: x86_64-pc-linux-gnu
configure:2513: checking for a BSD-compatible install
configure:2581: result: /usr/bin/install -c
configure:2592: checking whether ln works
configure:2614: result: yes
configure:2618: checking whether ln -s works
configure:2622: result: yes
configure:2629: checking for a sed that does not truncate output
configure:2693: result: /usr/bin/sed
configure:2702: checking for gawk
configure:2718: found /usr/bin/gawk
configure:2729: result: gawk
configure:3223: checking for libatomic support
configure:3233: result: yes
configure:3261: checking for libitm support
configure:3271: result: yes
configure:3280: checking for libsanitizer support
configure:3290: result: yes
configure:3299: checking for libvtv support
configure:3309: result: yes
configure:3319: checking for libhsail-rt support
configure:3331: result: yes
configure:3410: checking for libphobos support
configure:3420: result: yes
configure:4080: checking for gcc
configure:4107: result: /usr/bin/gcc
configure:4336: checking for C compiler version
configure:4345: /usr/bin/gcc --version >&5
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS 
configure:4356: $? = 0
configure:4356: $? = 0
configure:4345: /usr/bin/gcc -v >&5
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-$
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
configure:4356: $? = 0
configure:4345: /usr/bin/gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:4356: $? = 4
onfigure:4345: /usr/bin/gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:4356: $? = 4
configure:4376: checking whether the C compiler works
configure:4398: /usr/bin/gcc -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem$
gcc: error: unrecognized command line option '-fno-plt'
configure:4402: $? = 1
configure:4440: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
 #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:4445: error: in `/home/gcc-9.1.0-build':
configure:4447: error: C compiler cannot create executables
See `config.log' for more details

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=x86_64-pc-linux-gnu
ac_cv_env_AR_FOR_TARGET_set=
ac_cv_env_AR_FOR_TARGET_value=
ac_cv_env_AR_set=set
ac_cv_env_AR_value=/home/anaconda3/envs/detectron2/bin/x86_64-conda_cos6-linux-gnu-ar
ac_cv_env_AS_FOR_TARGET_set=
ac_cv_env_AS_FOR_TARGET_value=
ac_cv_env_AS_set=set
ac_cv_env_AS_value=/home/anaconda3/envs/detectron2/bin/x86_64-conda_cos6-linux-gnu-as
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_FOR_TARGET_set=
ac_cv_env_CC_FOR_TARGET_value=
ac_cv_env_CC_set=set
ac_cv_env_CC_value=/usr/bin/gcc
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /hom$
ac_cv_env_CPPFLAGS_set=set
ac_cv_env_CPPFLAGS_value='-DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/anaconda3/envs/detectron2/include'
ac_cv_env_CXXFLAGS_set=
ac_cv_env_CXXFLAGS_value=
ac_cv_env_CXX_FOR_TARGET_set=
ac_cv_env_CXX_FOR_TARGET_value=
ac_cv_env_CXX_set=set
ac_cv_env_CXX_value=/usr/bin/g++
ac_cv_env_DLLTOOL_FOR_TARGET_set=
ac_cv_env_DLLTOOL_FOR_TARGET_value=
ac_cv_env_DLLTOOL_set=
ac_cv_env_DLLTOOL_value=
ac_cv_env_GCC_FOR_TARGET_set=
ac_cv_env_GCC_FOR_TARGET_value=
ac_cv_env_GDC_FOR_TARGET_set=
ac_cv_env_GDC_FOR_TARGET_value=
ac_cv_env_GFORTRAN_FOR_TARGET_set=
ac_cv_env_GFORTRAN_FOR_TARGET_value=
ac_cv_env_GOC_FOR_TARGET_set=
ac_cv_env_GOC_FOR_TARGET_value=
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value='-Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/home/beg$
ac_cv_env_LD_FOR_TARGET_set=
ac_cv_env_LD_set=set
ac_cv_env_LD_value=/home/anaconda3/envs/detectron2/bin/x86_64-conda_cos6-linux-gnu-ld
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_LIPO_FOR_TARGET_set=
ac_cv_env_LIPO_FOR_TARGET_value=
ac_cv_env_LIPO_set=
ac_cv_env_LIPO_value=
ac_cv_env_NM_FOR_TARGET_set=
ac_cv_env_NM_FOR_TARGET_value=
ac_cv_env_NM_set=set
ac_cv_env_NM_value=/home/anaconda3/envs/detectron2/bin/x86_64-conda_cos6-linux-gnu-nm
ac_cv_env_OBJCOPY_FOR_TARGET_set=
ac_cv_env_OBJCOPY_FOR_TARGET_value=
ac_cv_env_OBJCOPY_set=set
ac_cv_env_OBJCOPY_value=/home/anaconda3/envs/detectron2/bin/x86_64-conda_cos6-linux-gnu-objcopy
ac_cv_env_OBJDUMP_FOR_TARGET_set=
ac_cv_env_OBJDUMP_FOR_TARGET_value=
ac_cv_env_OBJDUMP_set=set
ac_cv_env_OBJDUMP_value=/home/anaconda3/envs/detectron2/bin/x86_64-conda_cos6-linux-gnu-objdump
ac_cv_env_OTOOL_FOR_TARGET_set=
ac_cv_env_OTOOL_FOR_TARGET_value=
ac_cv_env_OTOOL_set=
ac_cv_env_OTOOL_value=
ac_cv_env_RANLIB_FOR_TARGET_set=
ac_cv_env_RANLIB_FOR_TARGET_value=
ac_cv_env_RANLIB_set=set
ac_cv_env_RANLIB_value=/home/anaconda3/envs/detectron2/bin/x86_64-conda_cos6-linux-gnu-ranlib
ac_cv_env_READELF_FOR_TARGET_set=ac_cv_env_READELF_FOR_TARGET_value=
ac_cv_env_READELF_set=set
ac_cv_env_READELF_value=/home/anaconda3/envs/detectron2/bin/x86_64-conda_cos6-linux-gnu-readelf
ac_cv_env_STRIP_FOR_TARGET_set=
ac_cv_env_STRIP_FOR_TARGET_value=
ac_cv_env_STRIP_set=set
ac_cv_env_STRIP_value=/home/anaconda3/envs/detectron2/bin/x86_64-conda_cos6-linux-gnu-strip
ac_cv_env_WINDMC_FOR_TARGET_set=
ac_cv_env_WINDMC_FOR_TARGET_value=
ac_cv_env_WINDMC_set=
ac_cv_env_WINDMC_value=
ac_cv_env_WINDRES_FOR_TARGET_set=
ac_cv_env_WINDRES_FOR_TARGET_value=
ac_cv_env_WINDRES_set=
ac_cv_env_WINDRES_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_build_configargs_set=
ac_cv_env_build_configargs_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_host_configargs_set=
ac_cv_env_host_configargs_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_env_target_configargs_set=
ac_cv_env_target_configargs_value=
ac_cv_host=x86_64-pc-linux-gnu
ac_cv_path_SED=/usr/bin/sed
ac_cv_path_install='/usr/bin/install -c'
ac_cv_prog_AWK=gawk
ac_cv_prog_ac_ct_CC=/usr/bin/gcc
ac_cv_target=x86_64-pc-linux-gnu
acx_cv_prog_LN=ln

## ----------------- ##
## Output variables. ##
## ----------------- ##

AR='/home/anaconda3/envs/detectron2/bin/x86_64-conda_cos6-linux-gnu-ar'
AR_FOR_BUILD='$(AR)'
AR_FOR_TARGET=''
AS='/home/anaconda3/envs/detectron2/bin/x86_64-conda_cos6-linux-gnu-as'
AS_FOR_BUILD='$(AS)'
AS_FOR_TARGET=''
AWK='gawk'
BISON=''
BUILD_CONFIG=''
CC='/usr/bin/gcc'
CC_FOR_BUILD='$(CC)'
CC_FOR_TARGET=''
CFLAGS='-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/begaj/anaconda$
CFLAGS_FOR_BUILD=''
CFLAGS_FOR_TARGET=''
COMPILER_AS_FOR_TARGET=''
COMPILER_LD_FOR_TARGET=''
COMPILER_NM_FOR_TARGET=''
CONFIGURE_GDB_TK=''
CPPFLAGS='-DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/anaconda3/envs/detectron2/include'
CXX='/usr/bin/g++’
CXXFLAGS=''
CXXFLAGS_FOR_BUILD=''
CXXFLAGS_FOR_TARGET=''
CXX_FOR_BUILD='$(CXX)'
CXX_FOR_TARGET=''
DEBUG_PREFIX_CFLAGS_FOR_TARGET=''
DEFS=''
DLLTOOL=''
DLLTOOL_FOR_BUILD='$(DLLTOOL)'
DLLTOOL_FOR_TARGET=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EXEEXT=''
EXPECT=‘'

FLAGS_FOR_TARGET=''
FLEX=''
GCC_FOR_TARGET=''
GCC_SHLIB_SUBDIR=''
GDB_TK=''
GDC_FOR_BUILD='$(GDC)'
GDC_FOR_TARGET=''
GFORTRAN_FOR_BUILD='$(GFORTRAN)'
GFORTRAN_FOR_TARGET=''
GNATBIND=''
GNATMAKE=''
GOC_FOR_BUILD='$(GOC)'
GOC_FOR_TARGET=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_GDB_TK=''

INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
LD='/home/anaconda3/envs/detectron2/bin/x86_64-conda_cos6-linux-gnu-ld'
LDFLAGS='-Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/home/begaj/anaconda3/env$
LDFLAGS_FOR_BUILD=''
LDFLAGS_FOR_TARGET=''
LD_FOR_BUILD='$(LD)'
LD_FOR_TARGET=''
LEX=''
LIBOBJS=''
LIBS=''
LIPO=''
LIPO_FOR_TARGET=''
LN='ln'
LN_S='ln -s'
M4=''
MAINT=''
MAINTAINER_MODE_FALSE=''
MAINTAINER_MODE_TRUE=''
MAKEINFO=''
NM='/home/anaconda3/envs/detectron2/bin/x86_64-conda_cos6-linux-gnu-nm'
NM_FOR_BUILD='$(NM)'
NM_FOR_TARGET=''
OBJCOPY='/home/anaconda3/envs/detectron2/bin/x86_64-conda_cos6-linux-gnu-objcopy'
OBJCOPY_FOR_TARGET=''
OBJDUMP='/home/anaconda3/envs/detectron2/bin/x86_64-conda_cos6-linux-gnu-objdump'
OBJDUMP_FOR_TARGET=''
OBJEXT=''
OTOOL=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_URL=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
RANLIB=‘/home/anaconda3/envs/detectron2/bin/x86_64-conda_cos6-linux-gnu-ranlib'
RANLIB_FOR_BUILD='$(RANLIB)'
RANLIB_FOR_TARGET=''
RAW_CXX_FOR_TARGET=''
READELF='/home/anaconda3/envs/detectron2/bin/x86_64-conda_cos6-linux-gnu-readelf'
READELF_FOR_TARGET=''
RPATH_ENVVAR=''
RUNTEST=''
SED='/usr/bin/sed'
SHELL='/bin/sh'
STRIP='/home/anaconda3/envs/detectron2/bin/x86_64-conda_cos6-linux-gnu-strip'
STRIP_FOR_TARGET=''
SYSROOT_CFLAGS_FOR_TARGET=''
TOPLEVEL_CONFIGURE_ARGUMENTS='../gcc-9.1.0/configure --prefix=/home/gcc-9.1.0 --enable-languages=c,c++ --disable-multilib'
WINDMC=''
WINDMC_FOR_BUILD='$(WINDMC)'
WINDMC_FOR_TARGET=''
WINDRES=''
WINDRES_FOR_BUILD='$(WINDRES)'
WINDRES_FOR_TARGET=''
YACC=''
ac_ct_CC='/usr/bin/gcc'
ac_ct_CXX=''
bindir='${exec_prefix}/bin'
build='x86_64-pc-linux-gnu'
build_alias=''
build_configargs=''
build_configdirs='build-libiberty build-libcpp build-texinfo build-flex build-bison build-m4 build-fixincludes'
build_cpu='x86_64'
build_libsubdir='build-x86_64-pc-linux-gnu'
build_noncanonical='x86_64-pc-linux-gnu'
build_os='linux-gnu'
build_subdir='build-x86_64-pc-linux-gnu'
build_tooldir=''
build_vendor='pc'
compare_exclusions=''
configdirs='intl libiberty opcodes bfd rea
datadir='${datarootdir}'
datarootdir='${prefix}/share'
do_compare=''
docdir='${datarootdir}/doc/${PACKAGE}'
dvidir='${docdir}'
exec_prefix='NONE'
extra_host_libiberty_configure_flags=''
extra_host_zlib_configure_flags=''
extra_isl_gmp_configure_flags=''
extra_liboffloadmic_configure_flags=''
extra_linker_plugin_configure_flags=''
extra_linker_plugin_flags=''
extra_mpc_gmp_configure_flags=''
extra_mpc_mpfr_configure_flags=''
extra_mpfr_configure_flags=''
get_gcc_base_ver=''
gmpinc=''
gmplibs=''
host='x86_64-pc-linux-gnu'
host_alias=''
host_configargs=''
host_cpu='x86_64'
host_noncanonical='x86_64-pc-linux-gnu'
host_os='linux-gnu'
host_shared=''
host_subdir='.'
host_vendor='pc'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
islinc=''
isllibs=''
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
poststage1_ldflags=''
poststage1_libs=''
prefix=‘/home/gcc-9.1.0'
program_transform_name='s,y,y,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
stage1_cflags=''
stage1_checking=''
stage1_languages=''
stage1_ldflags=''
stage1_libs=''
stage2_werror_flag=''
sysconfdir='${prefix}/etc'
target='x86_64-pc-linux-gnu'
target_alias=''
target_configargs=''
target_configdirs='target-libgcc target-libbacktrace target-libgloss target-newlib target-libgomp target-liboffloadmic target-libhsail-rt target-libatomi$
target_cpu='x86_64'
target_noncanonical='x86_64-pc-linux-gnu'
target_os='linux-gnu’

target_subdir='x86_64-pc-linux-gnu'
target_vendor='pc'
tooldir=''

## ------------------- ##
## File substitutions. ##
## ------------------- ##

alphaieee_frag=''
host_makefile_frag='/dev/null'
ospace_frag=''
serialization_dependencies=''
target_makefile_frag=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""

configure: exit 77
    
    
            

In .bashrc there is not path set and when i do echo $PATH it doesn’t echo anything about this environment.

Source: Windows Questions C++

LEAVE A COMMENT