从源代码构建gcc 5.2.0:configure:error:C编译器无法创建可执行文件

时间:2015-07-29 17:04:47

标签: c++ c linux gcc gnu

我正在尝试从我的本地$ HOME目录中的源代码构建gcc 5.2.0,我收到以下错误:

gcc-gcc_5_2_0_release> ./configure --prefix=$HOME/usr/local

checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for gawk... gawk
checking for libatomic support... yes
checking for libcilkrts support... yes
checking for libitm support... yes
checking for libsanitizer support... yes
checking for libvtv support... yes
checking for gcc... gcc
checking for C compiler default output file name...
configure: error: in `/home/s31941/tmp/gcc-gcc_5_2_0_release':
configure: error: C compiler cannot create executables
See `config.log' for more details.

这是config.log

的副本
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.64.  Invocation command line was

  $ ./configure --prefix=/home/username/usr/local

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

hostname = fmsserv
uname -m = x86_64
uname -r = 3.0.101-0.46-default
uname -s = Linux
uname -v = #1 SMP Wed Dec 17 11:04:10 UTC 2014 (8356111)

/usr/bin/uname -p = unknown
/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: /home/username/usr/local/bin
PATH: /home/username/tools/git/bin
PATH: /home/username/tools/java/jre1.8.0_40/bin
PATH: /home/username/tools/eclipse
PATH: .
PATH: /usr/NX/bin
PATH: /usr/lib64/mpi/gcc/openmpi/bin
PATH: /home/username/bin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/bin/X11
PATH: /usr/X11R6/bin
PATH: /usr/games
PATH: /opt/kde3/bin
PATH: /usr/lib/mit/bin
PATH: /usr/lib/mit/sbin
PATH: /opt/gnome/bin
PATH: /usr/lib/qt3/bin
PATH: /home/fms/bin
PATH: /usr/gnat/bin
PATH: .


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

configure:2292: checking build system type
configure:2306: result: x86_64-unknown-linux-gnu
configure:2353: checking host system type
configure:2366: result: x86_64-unknown-linux-gnu
configure:2386: checking target system type
configure:2399: result: x86_64-unknown-linux-gnu
configure:2453: checking for a BSD-compatible install
configure:2521: result: /usr/bin/install -c
configure:2532: checking whether ln works
configure:2554: result: yes
configure:2558: checking whether ln -s works
configure:2562: result: yes
configure:2569: checking for a sed that does not truncate output
configure:2633: result: /usr/bin/sed
configure:2642: checking for gawk
configure:2658: found /usr/bin/gawk
configure:2669: result: gawk
configure:3183: checking for libatomic support
configure:3193: result: yes
configure:3202: checking for libcilkrts support
configure:3212: result: yes
configure:3240: checking for libitm support
configure:3250: result: yes
configure:3259: checking for libsanitizer support
configure:3269: result: yes
configure:3278: checking for libvtv support
configure:3288: result: yes
configure:4074: checking for gcc
configure:4090: found /usr/bin/gcc
configure:4101: result: gcc
configure:4330: checking for C compiler version
configure:4339: gcc --version >&5
gcc (SUSE Linux) 4.3.4 [gcc-4_3-branch revision 152973]
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:4350: $? = 0
configure:4339: gcc -v >&5
Using built-in specs.
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.3 --enable-ssp --disable-libssp --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap --with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --program-suffix=-4.3 --enable-linux-futex --without-system-libunwind --with-cpu=generic --build=x86_64-suse-linux
Thread model: posix
gcc version 4.3.4 [gcc-4_3-branch revision 152973] (SUSE Linux) 
configure:4350: $? = 0
configure:4339: gcc -V >&5
gcc: '-V' option must have argument
configure:4350: $? = 1
configure:4339: gcc -qversion >&5
gcc: unrecognized option '-qversion'
gcc: no input files
configure:4350: $? = 1
configure:4370: checking for C compiler default output file name
configure:4392: gcc    conftest.c  >&5
gcc: error trying to exec 'cc1': execvp: No such file or directory
configure:4396: $? = 1
configure:4433: result: 
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:4439: error: in `/home/username/tmp/gcc-gcc_5_2_0_release':
configure:4443: error: C compiler cannot create executables
See `config.log' for more details.

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

ac_cv_build=x86_64-unknown-linux-gnu
ac_cv_env_AR_FOR_TARGET_set=
ac_cv_env_AR_FOR_TARGET_value=
ac_cv_env_AR_set=
ac_cv_env_AR_value=
ac_cv_env_AS_FOR_TARGET_set=
ac_cv_env_AS_FOR_TARGET_value=
ac_cv_env_AS_set=
ac_cv_env_AS_value=
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=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
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=
ac_cv_env_CXX_value=
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_GCJ_FOR_TARGET_set=
ac_cv_env_GCJ_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=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LD_FOR_TARGET_set=
ac_cv_env_LD_FOR_TARGET_value=
ac_cv_env_LD_set=
ac_cv_env_LD_value=
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=
ac_cv_env_NM_value=
ac_cv_env_OBJCOPY_FOR_TARGET_set=
ac_cv_env_OBJCOPY_FOR_TARGET_value=
ac_cv_env_OBJCOPY_set=
ac_cv_env_OBJCOPY_value=
ac_cv_env_OBJDUMP_FOR_TARGET_set=
ac_cv_env_OBJDUMP_FOR_TARGET_value=
ac_cv_env_OBJDUMP_set=
ac_cv_env_OBJDUMP_value=
ac_cv_env_RANLIB_FOR_TARGET_set=
ac_cv_env_RANLIB_FOR_TARGET_value=
ac_cv_env_RANLIB_set=
ac_cv_env_RANLIB_value=
ac_cv_env_READELF_FOR_TARGET_set=
ac_cv_env_READELF_FOR_TARGET_value=
ac_cv_env_READELF_set=
ac_cv_env_READELF_value=
ac_cv_env_STRIP_FOR_TARGET_set=
ac_cv_env_STRIP_FOR_TARGET_value=
ac_cv_env_STRIP_set=
ac_cv_env_STRIP_value=
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-unknown-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=gcc
ac_cv_target=x86_64-unknown-linux-gnu
acx_cv_prog_LN=ln

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

AR=''
AR_FOR_BUILD='$(AR)'
AR_FOR_TARGET=''
AS=''
AS_FOR_BUILD='$(AS)'
AS_FOR_TARGET=''
AWK='gawk'
BISON=''
BUILD_CONFIG=''
CC='gcc'
CC_FOR_BUILD='$(CC)'
CC_FOR_TARGET=''
CFLAGS=''
CFLAGS_FOR_BUILD=''
CFLAGS_FOR_TARGET=''
COMPILER_AS_FOR_TARGET=''
COMPILER_LD_FOR_TARGET=''
COMPILER_NM_FOR_TARGET=''
CONFIGURE_GDB_TK=''
CPPFLAGS=''
CXX=''
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=''
EXTRA_CONFIGARGS_LIBJAVA='--disable-static'
FLAGS_FOR_TARGET=''
FLEX=''
GCC_FOR_TARGET=''
GCC_SHLIB_SUBDIR=''
GCJ_FOR_BUILD='$(GCJ)'
GCJ_FOR_TARGET=''
GDB_TK=''
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=''
LDFLAGS=''
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'
LTLIBOBJS=''
M4=''
MAINT=''
MAINTAINER_MODE_FALSE=''
MAINTAINER_MODE_TRUE=''
MAKEINFO=''
NM=''
NM_FOR_BUILD='$(NM)'
NM_FOR_TARGET=''
OBJCOPY=''
OBJCOPY_FOR_TARGET=''
OBJDUMP=''
OBJDUMP_FOR_TARGET=''
OBJEXT=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_URL=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
RANLIB=''
RANLIB_FOR_BUILD='$(RANLIB)'
RANLIB_FOR_TARGET=''
RAW_CXX_FOR_TARGET=''
READELF=''
READELF_FOR_TARGET=''
RPATH_ENVVAR=''
RUNTEST=''
SED='/usr/bin/sed'
SHELL='/bin/sh'
STRIP=''
STRIP_FOR_TARGET=''
SYSROOT_CFLAGS_FOR_TARGET=''
TOPLEVEL_CONFIGURE_ARGUMENTS='./configure --prefix=/home/username/usr/local'
WINDMC=''
WINDMC_FOR_BUILD='$(WINDMC)'
WINDMC_FOR_TARGET=''
WINDRES=''
WINDRES_FOR_BUILD='$(WINDRES)'
WINDRES_FOR_TARGET=''
YACC=''
ac_ct_CC='gcc'
ac_ct_CXX=''
bindir='${exec_prefix}/bin'
build='x86_64-unknown-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-unknown-linux-gnu'
build_noncanonical='x86_64-unknown-linux-gnu'
build_os='linux-gnu'
build_subdir='build-x86_64-unknown-linux-gnu'
build_tooldir=''
build_vendor='unknown'
compare_exclusions=''
configdirs='intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktrace libcpp libdecnumber gmp mpfr mpc isl libelf libiconv texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
do_compare=''
docdir='${datarootdir}/doc/${PACKAGE}'
dvidir='${docdir}'
exec_prefix='NONE'
extra_host_libiberty_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=''
gmpinc=''
gmplibs=''
host='x86_64-unknown-linux-gnu'
host_alias=''
host_configargs=''
host_cpu='x86_64'
host_noncanonical='x86_64-unknown-linux-gnu'
host_os='linux-gnu'
host_shared=''
host_subdir='host-x86_64-unknown-linux-gnu'
host_vendor='unknown'
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/username/usr/local'
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-unknown-linux-gnu'
target_alias=''
target_configargs=''
target_configdirs='target-libgcc target-libbacktrace target-libgloss target-newlib target-libgomp target-libcilkrts target-liboffloadmic target-libatomic target-libitm target-libstdc++-v3 target-libsanitizer target-libvtv target-libmpx target-libssp target-libquadmath target-libgfortran target-boehm-gc target-libffi target-zlib target-libjava target-libobjc target-libada target-libgo target-rda'
target_cpu='x86_64'
target_noncanonical='x86_64-unknown-linux-gnu'
target_os='linux-gnu'
target_subdir='x86_64-unknown-linux-gnu'
target_vendor='unknown'
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

任何帮助确定什么是错误的将不胜感激。

gcc-gcc_5_2_0_release> which ld
/usr/bin/ld

gcc-gcc_5_2_0_release> which gcc
/usr/bin/gcc

gcc-gcc_5_2_0_release> ld --version
GNU ld (GNU Binutils; SUSE Linux Enterprise 11) 2.23.1
Copyright 2012 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

gcc-gcc_5_2_0_release> gcc --version
gcc (SUSE Linux) 4.3.4 [gcc-4_3-branch revision 152973]
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

2 个答案:

答案 0 :(得分:2)

首先,documented不应在其源代码树中构建GCC:

  

首先,我们强烈建议将GCC构建到与源树不在的源中的单独目录中。

然后您需要确保前缀树存在。我相信你的选择$HOME/usr/local/是一个很糟糕的选择(令人困惑)。我建议改用$HOME/soft/

如果您有Debian或类似的发行版,请务必在配置之前aptitude install build-dep gcc g++(您的deb-src文件中可能需要一些/etc/apt/sources.list行。这将下载 build GCC所需的所有软件。在所有情况下都不要忘记aptitude install gcc g++ build-essential(要有一个有效的gcc& g++系统编译器。在SUSE上,尝试查找等效的包和命令:gcc-c++ package,build service

所以我建议重新开始。使用

mkdir -p -$HOME/tmp/softbuilds
mkdir -p $HOME/soft/
cd $HOME/tmp/
## the following URL is not the best one, choose carefully the server
wget http://open-source-box.org/gcc/gcc-5.2.0/gcc-5.2.0.tar.bz2
cd softbuilds
tar xvf ../gcc-5.2.0.tar.bz2
mkdir _GCC-5.2_Build
cd _GCC-5.2_Build
../gcc-5.2.0/configure --help
## you could add some other configure options here:
../gcc-5.2.0/configure --prefix=$HOME/soft --program-suffix=-mine \
      --enable-plugins --enable-languages=c,c++,jit,lto,go  \
      --enable-check=release --enable-host-shared

如果配置步骤成功,则使用

编译该事物
make -j 3

然后(也许几个小时后)安装它:

make #to be sure all went ok
make install

然后将$HOME/soft/bin/添加到PATH(例如,通过编辑.bashrc ...)并使用gcc-mine作为您的编译器(例如make CC=gcc-mine

如果您希望始终使用 GCC,并且$HOME/bin/中的$PATH 早期,则可以从{{进行符号链接1}}到$HOME/soft/bin/gcc-mine(同样适用于$HOME/bin/gcc ...)。

顺便说一下,您可以稍后为您的GCC安装MELT元插件。我有released MELT 1.2.0 for GCC 4.9& 5.x几天前(2015年7月底)。

答案 1 :(得分:2)

configure:4370: checking for C compiler default output file name
configure:4392: gcc    conftest.c  >&5
gcc: error trying to exec 'cc1': execvp: No such file or directory

这表明您的主机编译器无法正常工作。在尝试配置其他软件之前,请确保它可以正常工作。

是否由于系统上缺少软件包,某些环境变量引起了GCC工作方式的混乱,或者甚至是某些本地文件系统损坏,你会看到同样的问题只是编译一个简单的“Hello,world !”来自命令行的程序。

先修复,然后开始尝试构建更大的软件包。