I've been trying to build the first pass of GCC for LFS 7.10 (GCC 6.2.0). I was able to successfully build binutils but no matter what I try with gcc, it always quits when building libatomic and complains that the C compiler cannot create executables.
By examining the config.log, I noticed that it was referring to not my system's c compiler but the test compiler it's building called xgcc. Thus, I tried to compile my own dummy hello world file with this compiler. This errored out with the following error:
Code:
xgcc: error trying to exec 'cc1': execvp: No such file or directory
I know this normally happens when the compiler can't find cc1 because of a missing link or something but in this case, cc1 is present in the same directory as xgcc so I don't quite understand what to do from here.
Here is the make command error:
Code:
...
make[2]: Entering directory '/mnt/lfs/sources/gcc-6.2.0/build_test/libcc1'
make all-am
make[3]: Entering directory '/mnt/lfs/sources/gcc-6.2.0/build_test/libcc1'
make[3]: Leaving directory '/mnt/lfs/sources/gcc-6.2.0/build_test/libcc1'
make[2]: Leaving directory '/mnt/lfs/sources/gcc-6.2.0/build_test/libcc1'
Checking multilib configuration for libgcc...
make[2]: Entering directory '/mnt/lfs/sources/gcc-6.2.0/build_test/x86_64-lfs-linux-gnu/libgcc'
# If this is the top-level multilib, build all the other
# multilibs.
# Early copyback; see "all" above for the rationale. The
# early copy is necessary so that the gcc -B options find
# the right startup files when linking shared libgcc.
/bin/sh ../../../libgcc/../mkinstalldirs ../.././gcc
parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"; \
for file in $parts; do \
rm -f ../.././gcc/$file; \
/bin/install -c -m 644 $file ../.././gcc/; \
case $file in \
*.a) \
/tools/x86_64-lfs-linux-gnu/bin/ranlib ../.././gcc/$file ;; \
esac; \
done
dest=../.././gcc/include/tmp$$-unwind.h; \
cp unwind.h $dest; \
chmod a+r $dest; \
sh ../../../libgcc/../move-if-change $dest ../.././gcc/include/unwind.h
# Now that we have built all the objects, we need to copy
# them back to the GCC directory. Too many things (other
# in-tree libraries, and DejaGNU) know about the layout
# of the build tree, for now.
make install-leaf DESTDIR=../.././gcc \
slibdir= libsubdir= MULTIOSDIR=.
make[3]: Entering directory '/mnt/lfs/sources/gcc-6.2.0/build_test/x86_64-lfs-linux-gnu/libgcc'
/bin/sh ../../../libgcc/../mkinstalldirs ../.././gcc
/bin/install -c -m 644 libgcc.a ../.././gcc/
chmod 644 ../.././gcc/libgcc.a
/tools/x86_64-lfs-linux-gnu/bin/ranlib ../.././gcc/libgcc.a
/bin/install -c -m 644 libgcov.a ../.././gcc/
chmod 644 ../.././gcc/libgcov.a
/tools/x86_64-lfs-linux-gnu/bin/ranlib ../.././gcc/libgcov.a
parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"; \
for file in $parts; do \
rm -f ../.././gcc/$file; \
/bin/install -c -m 644 $file ../.././gcc/; \
case $file in \
*.a) \
/tools/x86_64-lfs-linux-gnu/bin/ranlib ../.././gcc/$file ;; \
esac; \
done
make[3]: Leaving directory '/mnt/lfs/sources/gcc-6.2.0/build_test/x86_64-lfs-linux-gnu/libgcc'
make[2]: Leaving directory '/mnt/lfs/sources/gcc-6.2.0/build_test/x86_64-lfs-linux-gnu/libgcc'
Checking multilib configuration for libatomic...
Configuring in x86_64-lfs-linux-gnu/libatomic
configure: loading cache ./config.cache
checking for --enable-version-specific-runtime-libs... no
checking for --enable-generated-files-in-srcdir... no
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-lfs-linux-gnu
checking target system type... x86_64-lfs-linux-gnu
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
checking for x86_64-lfs-linux-gnu-strip... /tools/x86_64-lfs-linux-gnu/bin/strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for x86_64-lfs-linux-gnu-gcc... /mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/xgcc -B/mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/ -B/tools/x86_64-lfs-linux-gnu/bin/ -B/tools/x86_64-lfs-linux-gnu/lib/ -isystem /tools/x86_64-lfs-linux-gnu/include -isystem /tools/x86_64-lfs-linux-gnu/sys-include
checking for C compiler default output file name...
configure: error: in `/mnt/lfs/sources/gcc-6.2.0/build_test/x86_64-lfs-linux-gnu/libatomic':
configure: error: C compiler cannot create executables
See `config.log' for more details.
make[1]: *** [Makefile:13828: configure-target-libatomic] Error 1
make[1]: Leaving directory '/mnt/lfs/sources/gcc-6.2.0/build_test'
make: *** [Makefile:867: all] Error 2
config.log for libatomic:
Code:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by GNU Atomic Library configure 1.0, which was
generated by GNU Autoconf 2.64. Invocation command line was
$ /mnt/lfs/sources/gcc-6.2.0/libatomic/configure --srcdir=../../../libatomic --cache-file=./config.cache --with-cross-host=x86_64-pc-linux-gnu --prefix=/tools --with-glibc-version=2.11 --with-sysroot=/mnt/lfs --with-newlib --without-headers --with-local-prefix=/tools --with-native-system-header-dir=/tools/include --disable-nls --disable-shared --disable-multilib --disable-decimal-float --disable-threads --disable-libatmoic --disable-libgomp --disable-libmpx --disable-libquadmath --disable-libssp --disable-libvtv --disable-libstdcxx --enable-languages=c,c++,lto --program-transform-name=s&^&x86_64-lfs-linux-gnu-& --disable-option-checking --with-target-subdir=x86_64-lfs-linux-gnu --build=x86_64-pc-linux-gnu --host=x86_64-lfs-linux-gnu --target=x86_64-lfs-linux-gnu
## --------- ##
## Platform. ##
## --------- ##
hostname = ArchLinux
uname -m = x86_64
uname -r = 4.8.13-1-ARCH
uname -s = Linux
uname -v = #1 SMP PREEMPT Fri Dec 9 07:24:34 CET 2016
/usr/bin/uname -p = unknown
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /tools/bin
PATH: /bin
PATH: /usr/bin
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2362: loading cache ./config.cache
configure:2453: checking for --enable-version-specific-runtime-libs
configure:2468: result: no
configure:2476: checking for --enable-generated-files-in-srcdir
configure:2491: result: no
configure:2547: checking build system type
configure:2561: result: x86_64-pc-linux-gnu
configure:2581: checking host system type
configure:2594: result: x86_64-lfs-linux-gnu
configure:2614: checking target system type
configure:2627: result: x86_64-lfs-linux-gnu
configure:2684: checking for a BSD-compatible install
configure:2752: result: /bin/install -c
configure:2763: checking whether build environment is sane
configure:2813: result: yes
configure:2862: checking for x86_64-lfs-linux-gnu-strip
configure:2889: result: /tools/x86_64-lfs-linux-gnu/bin/strip
configure:2954: checking for a thread-safe mkdir -p
configure:2993: result: /bin/mkdir -p
configure:3006: checking for gawk
configure:3033: result: gawk
configure:3044: checking whether make sets $(MAKE)
configure:3066: result: yes
configure:3230: checking for x86_64-lfs-linux-gnu-gcc
configure:3257: result: /mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/xgcc -B/mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/ -B/tools/x86_64-lfs-linux-gnu/bin/ -B/tools/x86_64-lfs-linux-gnu/lib/ -isystem /tools/x86_64-lfs-linux-gnu/include -isystem /tools/x86_64-lfs-linux-gnu/sys-include
configure:3526: checking for C compiler version
configure:3535: /mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/xgcc -B/mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/ -B/tools/x86_64-lfs-linux-gnu/bin/ -B/tools/x86_64-lfs-linux-gnu/lib/ -isystem /tools/x86_64-lfs-linux-gnu/include -isystem /tools/x86_64-lfs-linux-gnu/sys-include --version >&5
xgcc (GCC) 6.2.0
Copyright (C) 2016 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:3546: $? = 0
configure:3535: /mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/xgcc -B/mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/ -B/tools/x86_64-lfs-linux-gnu/bin/ -B/tools/x86_64-lfs-linux-gnu/lib/ -isystem /tools/x86_64-lfs-linux-gnu/include -isystem /tools/x86_64-lfs-linux-gnu/sys-include -v >&5
Reading specs from /mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/specs
COLLECT_GCC=/mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/xgcc
COLLECT_LTO_WRAPPER=/mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/lto-wrapper
Target: x86_64-lfs-linux-gnu
Configured with: ../configure --target=x86_64-lfs-linux-gnu --prefix=/tools --with-glibc-version=2.11 --with-sysroot=/mnt/lfs --with-newlib --without-headers --with-local-prefix=/tools --with-native-system-header-dir=/tools/include --disable-nls --disable-shared --disable-multilib --disable-decimal-float --disable-threads --disable-libatmoic --disable-libgomp --disable-libmpx --disable-libquadmath --disable-libssp --disable-libvtv --disable-libstdcxx --enable-languages=c,c++
Thread model: single
gcc version 6.2.0 (GCC)
configure:3546: $? = 0
configure:3535: /mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/xgcc -B/mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/ -B/tools/x86_64-lfs-linux-gnu/bin/ -B/tools/x86_64-lfs-linux-gnu/lib/ -isystem /tools/x86_64-lfs-linux-gnu/include -isystem /tools/x86_64-lfs-linux-gnu/sys-include -V >&5
xgcc: error: unrecognized command line option '-V'
xgcc: fatal error: no input files
compilation terminated.
configure:3546: $? = 1
configure:3535: /mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/xgcc -B/mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/ -B/tools/x86_64-lfs-linux-gnu/bin/ -B/tools/x86_64-lfs-linux-gnu/lib/ -isystem /tools/x86_64-lfs-linux-gnu/include -isystem /tools/x86_64-lfs-linux-gnu/sys-include -qversion >&5
xgcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
xgcc: fatal error: no input files
compilation terminated.
configure:3546: $? = 1
configure:3566: checking for C compiler default output file name
configure:3588: /mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/xgcc -B/mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/ -B/tools/x86_64-lfs-linux-gnu/bin/ -B/tools/x86_64-lfs-linux-gnu/lib/ -isystem /tools/x86_64-lfs-linux-gnu/include -isystem /tools/x86_64-lfs-linux-gnu/sys-include -g -O2 conftest.c >&5
/tools/x86_64-lfs-linux-gnu/bin/ld: cannot find crt1.o: No such file or directory
/tools/x86_64-lfs-linux-gnu/bin/ld: cannot find crti.o: No such file or directory
/tools/x86_64-lfs-linux-gnu/bin/ld: cannot find -lc
/tools/x86_64-lfs-linux-gnu/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
configure:3592: $? = 1
configure:3629: result:
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU Atomic Library"
| #define PACKAGE_TARNAME "libatomic"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU Atomic Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libatomic/"
| #define PACKAGE "libatomic"
| #define VERSION "1.0"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:3635: error: in `/mnt/lfs/sources/gcc-6.2.0/build_test/x86_64-lfs-linux-gnu/libatomic':
configure:3639: 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_CPPFLAGS_set=set
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_build_alias_set=set
ac_cv_env_build_alias_value=x86_64-pc-linux-gnu
ac_cv_env_host_alias_set=set
ac_cv_env_host_alias_value=x86_64-lfs-linux-gnu
ac_cv_env_target_alias_set=set
ac_cv_env_target_alias_value=x86_64-lfs-linux-gnu
ac_cv_host=x86_64-lfs-linux-gnu
ac_cv_path_mkdir=/bin/mkdir
ac_cv_prog_AWK=gawk
ac_cv_prog_CC='/mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/xgcc -B/mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/ -B/tools/x86_64-lfs-linux-gnu/bin/ -B/tools/x86_64-lfs-linux-gnu/lib/ -isystem /tools/x86_64-lfs-linux-gnu/include -isystem /tools/x86_64-lfs-linux-gnu/sys-include '
ac_cv_prog_STRIP=/tools/x86_64-lfs-linux-gnu/bin/strip
ac_cv_prog_make_make_set=yes
ac_cv_target=x86_64-lfs-linux-gnu
## ----------------- ##
## Output variables. ##
## ----------------- ##
ACLOCAL='${SHELL} /mnt/lfs/sources/gcc-6.2.0/missing --run aclocal-1.11'
AMDEPBACKSLASH=''
AMDEP_FALSE=''
AMDEP_TRUE=''
AMTAR='$${TAR-tar}'
AR='/tools/x86_64-lfs-linux-gnu/bin/ar'
ARCH_ARM_LINUX_FALSE=''
ARCH_ARM_LINUX_TRUE=''
ARCH_I386_FALSE=''
ARCH_I386_TRUE=''
ARCH_X86_64_FALSE=''
ARCH_X86_64_TRUE=''
AUTOCONF='${SHELL} /mnt/lfs/sources/gcc-6.2.0/missing --run autoconf'
AUTOHEADER='${SHELL} /mnt/lfs/sources/gcc-6.2.0/missing --run autoheader'
AUTOMAKE='${SHELL} /mnt/lfs/sources/gcc-6.2.0/missing --run automake-1.11'
AWK='gawk'
CC='/mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/xgcc -B/mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/ -B/tools/x86_64-lfs-linux-gnu/bin/ -B/tools/x86_64-lfs-linux-gnu/lib/ -isystem /tools/x86_64-lfs-linux-gnu/include -isystem /tools/x86_64-lfs-linux-gnu/sys-include '
CCAS=''
CCASDEPMODE=''
CCASFLAGS=''
CCDEPMODE=''
CFLAGS='-g -O2'
CPP=''
CPPFLAGS=''
CYGPATH_W='echo'
DEFS=''
DEPDIR=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
FGREP=''
GENINSRC_FALSE=''
GENINSRC_TRUE='#'
GREP=''
HAVE_IFUNC_FALSE=''
HAVE_IFUNC_TRUE=''
INSTALL_DATA='/bin/install -c -m 644'
INSTALL_PROGRAM='/bin/install -c'
INSTALL_SCRIPT='/bin/install -c'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LD='/mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/collect-ld'
LDFLAGS=''
LIBAT_BUILD_VERSIONED_SHLIB_FALSE=''
LIBAT_BUILD_VERSIONED_SHLIB_GNU_FALSE=''
LIBAT_BUILD_VERSIONED_SHLIB_GNU_TRUE=''
LIBAT_BUILD_VERSIONED_SHLIB_SUN_FALSE=''
LIBAT_BUILD_VERSIONED_SHLIB_SUN_TRUE=''
LIBAT_BUILD_VERSIONED_SHLIB_TRUE=''
LIBOBJS=''
LIBS=''
LIBTOOL=''
LIPO='x86_64-lfs-linux-gnu-lipo'
LN_S=''
LTLIBOBJS=''
MAINT=''
MAINTAINER_MODE_FALSE=''
MAINTAINER_MODE_TRUE=''
MAKEINFO='makeinfo --split-size=5000000'
MKDIR_P='/bin/mkdir -p'
NM='/mnt/lfs/sources/gcc-6.2.0/build_test/./gcc/nm'
NMEDIT=''
OBJDUMP='/tools/x86_64-lfs-linux-gnu/bin/objdump'
OBJEXT=''
OPT_LDFLAGS=''
OTOOL64=''
OTOOL=''
PACKAGE='libatomic'
PACKAGE_BUGREPORT=''
PACKAGE_NAME='GNU Atomic Library'
PACKAGE_STRING='GNU Atomic Library 1.0'
PACKAGE_TARNAME='libatomic'
PACKAGE_URL='http://www.gnu.org/software/libatomic/'
PACKAGE_VERSION='1.0'
PATH_SEPARATOR=':'
PERL=''
RANLIB='/tools/x86_64-lfs-linux-gnu/bin/ranlib'
SECTION_LDFLAGS=''
SED='/bin/sed'
SET_MAKE=''
SHELL='/bin/sh'
SIZES=''
STRIP='/tools/x86_64-lfs-linux-gnu/bin/strip'
VERSION='1.0'
XCFLAGS=''
XLDFLAGS=''
ac_ct_CC=''
ac_ct_DUMPBIN=''
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE=''
am__fastdepCCAS_FALSE=''
am__fastdepCCAS_TRUE=''
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__include=''
am__isrc=' -I$(srcdir)'
am__leading_dot='.'
am__nodep=''
am__quote=''
am__tar='$${TAR-tar} chof - "$$tardir"'
am__untar='$${TAR-tar} xf -'
bindir='${exec_prefix}/bin'
build='x86_64-pc-linux-gnu'
build_alias='x86_64-pc-linux-gnu'
build_cpu='x86_64'
build_os='linux-gnu'
build_vendor='pc'
config_path=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
enable_shared='no'
enable_static=''
exec_prefix='NONE'
host='x86_64-lfs-linux-gnu'
host_alias='x86_64-lfs-linux-gnu'
host_cpu='x86_64'
host_os='linux-gnu'
host_vendor='lfs'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='${SHELL} /mnt/lfs/sources/gcc-6.2.0/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
libtool_VERSION=''
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
lt_host_flags=''
mandir='${datarootdir}/man'
mkdir_p='/bin/mkdir -p'
multi_basedir='../../../libatomic/..'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/tools'
program_transform_name='s&^&x86_64-lfs-linux-gnu-&'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target='x86_64-lfs-linux-gnu'
target_alias='x86_64-lfs-linux-gnu'
target_cpu='x86_64'
target_os='linux-gnu'
target_vendor='lfs'
toolexecdir='$(exec_prefix)/$(target_alias)'
toolexeclibdir='$(toolexecdir)/lib/../lib64'
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define PACKAGE_NAME "GNU Atomic Library"
#define PACKAGE_TARNAME "libatomic"
#define PACKAGE_VERSION "1.0"
#define PACKAGE_STRING "GNU Atomic Library 1.0"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL "http://www.gnu.org/software/libatomic/"
#define PACKAGE "libatomic"
#define VERSION "1.0"
configure: exit 77
This is my test run of xgcc:
Code:
Using built-in specs.
COLLECT_GCC=./xgcc
Target: x86_64-lfs-linux-gnu
Configured with: ../configure --target=x86_64-lfs-linux-gnu --prefix=/tools --with-glibc-version=2.11 --with-sysroot=/mnt/lfs --with-newlib --without-headers --with-local-prefix=/tools --with-native-system-header-dir=/tools/include --disable-nls --disable-shared --disable-multilib --disable-decimal-float --disable-threads --disable-libatmoic --disable-libgomp --disable-libmpx --disable-libquadmath --disable-libssp --disable-libvtv --disable-libstdcxx --enable-languages=c,c++
Thread model: single
gcc version 6.2.0 (GCC)
COLLECT_GCC_OPTIONS='-v' '-o' '/home/lfs/test_file' '-mtune=generic' '-march=x86-64'
cc1 -quiet -v -iprefix /mnt/lfs/sources/gcc-6.2.0/build_test/gcc/../lib/gcc/x86_64-lfs-linux-gnu/6.2.0/ /home/lfs/test_file.c -quiet -dumpbase test_file.c -mtune=generic -march=x86-64 -auxbase test_file -version -o /tmp/cc2pyWsi.s
xgcc: error trying to exec 'cc1': execvp: No such file or directory
face
And these are my environment variables and such, correctly set I think.
Code:
LC_ALL=POSIX
OLDPWD=/mnt/lfs/sources/gcc-6.2.0/build_test
LFS=/mnt/lfs
PWD=/mnt/lfs/sources/gcc-6.2.0/build_test/x86_64-lfs-linux-gnu/libatomic
HOME=/home/lfs
LFS_TGT=x86_64-lfs-linux-gnu
CXX=/usr/bin/g++
TERM=linux
SHLVL=1
PATH=/tools/bin:/bin:/usr/bin
_=/bin/env
I configured gcc as LFS 7.10 prescribes. Thanks for any help!