This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Unable to build libgcc for target x86_64-w64-mingw32, C preprocessor /lib/cpp fails sanity check


Hello,

I'm trying to build a cross compiler for UEFI, and having difficulties
building libgcc after having built the compilers themselves. I've already
built a cross compiler and libgcc (with and without red-zone) for
freestanding x86_64-elf in the same machine, so not sure what the issue is.

The machine is an Arch vm, with the following packages installed through
pacman:
gcc-8.2.1+20180831-1
bison-3.0.5-1
flex-2.6.4-1
gmp-6.1.2-1
libmpc-1.1.0-1
mpfr-4.0.1-1
texinfo-6.5-1
>From the AUR, I got:
osl-0.9.2-2
isl-0.20-4
cloog-0.20.0-1

I'm using binutils 2.31 (compiled separately, binutils for
target x86_64-w64-mingw32 were built and installed fine to the same prefix
I'm trying to install my cross compiler to). For gcc, I'm using the branch
gcc-8-branch at revision 264489. I tried to use the 8.2.0 release, but I
ran into an issue with isl 0.20 having moved some headers around, causing
the build to fail. That was fixed in the branch with gcc 8.2.1.

The source for gcc was downloaded to ~/src/gcc. After that, I did:
export PREFIX="$HOME/opt/cross"
export TARGET=x86_64-w64-mingw32
export PATH="$PREFIX/bin:$PATH"
mkdir ~/src/gcc-build-$TARGET
cd ~/src/gcc-build-$TARGET
../gcc/configure --target=$TARGET --prefix="$PREFIX" --disable-nls
--enable-languages=c,c++ --without-headers
make all-gcc

This far, everything worked ok. Then I did:
make all-target-libgcc

And that's where I hit a wall. Make fails with the last few lines of output
being:
checking how to run the C preprocessor... /lib/cpp
configure: error: in
`/home/os/src/gcc-build-x86_64-w64-mingw32/x86_64-w64-mingw32/libgcc':
configure: error: C preprocessor "/lib/cpp"fails sanity check
See `config.log' for more details.
make: *** [Makefile:12659: configure-target-libgcc] Error 1

I won't copy the whole contents of the config log (unless someone feels
they'd be useful) but where it starts having issues it shows (log is at
x86_64-w64-mingw32/libgcc/config.log):

///---***---///  <- Search for this if you want to skip the log

configure:3933: checking how to run the C preprocessor
configure:3964:  /home/os/src/gcc-build-x86_64-w64-mingw32/./gcc/xgcc
-B/home/os/src/gcc-build-x86_64-w64-mingw32/./gcc/
-L/home/os/opt/cross/x86_64-w64-mingw32/lib -L/home/os/opt/cross/mingw/lib
-isystem /home/os/opt/cross/x86_64-w64-mingw32/include -isystem
/home/os/opt/cross/mingw/include
-B/home/os/opt/cross/x86_64-w64-mingw32/bin/
-B/home/os/opt/cross/x86_64-w64-mingw32/lib/ -isystem
/home/os/opt/cross/x86_64-w64-mingw32/include -isystem
/home/os/opt/cross/x86_64-w64-mingw32/sys-include    -E  conftest.c
In file included from
/home/os/src/gcc-build-x86_64-w64-mingw32/gcc/include-fixed/syslimits.h:7,
                 from
/home/os/src/gcc-build-x86_64-w64-mingw32/gcc/include-fixed/limits.h:34,
                 from conftest.c:10:
/home/os/src/gcc-build-x86_64-w64-mingw32/gcc/include-fixed/limits.h:194:61:
error: no include path in which to search for limits.h
 #include_next <limits.h>  /* recurse down to the real one */
                                                             ^
configure:3964: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libgcc/";
| /* end confdefs.h.  */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
|      Syntax error
configure:3964:  /home/os/src/gcc-build-x86_64-w64-mingw32/./gcc/xgcc
-B/home/os/src/gcc-build-x86_64-w64-mingw32/./gcc/
-L/home/os/opt/cross/x86_64-w64-mingw32/lib -L/home/os/opt/cross/mingw/lib
-isystem /home/os/opt/cross/x86_64-w64-mingw32/include -isystem
/home/os/opt/cross/mingw/include
-B/home/os/opt/cross/x86_64-w64-mingw32/bin/
-B/home/os/opt/cross/x86_64-w64-mingw32/lib/ -isystem
/home/os/opt/cross/x86_64-w64-mingw32/include -isystem
/home/os/opt/cross/x86_64-w64-mingw32/sys-include    -E  conftest.c
In file included from
/home/os/src/gcc-build-x86_64-w64-mingw32/gcc/include-fixed/syslimits.h:7,
                 from
/home/os/src/gcc-build-x86_64-w64-mingw32/gcc/include-fixed/limits.h:34,
                 from conftest.c:10:
/home/os/src/gcc-build-x86_64-w64-mingw32/gcc/include-fixed/limits.h:194:61:
error: no include path in which to search for limits.h
 #include_next <limits.h>  /* recurse down to the real one */
                                                             ^
configure:3964: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libgcc/";
| /* end confdefs.h.  */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
|      Syntax error
configure:3964:  /home/os/src/gcc-build-x86_64-w64-mingw32/./gcc/xgcc
-B/home/os/src/gcc-build-x86_64-w64-mingw32/./gcc/
-L/home/os/opt/cross/x86_64-w64-mingw32/lib -L/home/os/opt/cross/mingw/lib
-isystem /home/os/opt/cross/x86_64-w64-mingw32/include -isystem
/home/os/opt/cross/mingw/include
-B/home/os/opt/cross/x86_64-w64-mingw32/bin/
-B/home/os/opt/cross/x86_64-w64-mingw32/lib/ -isystem
/home/os/opt/cross/x86_64-w64-mingw32/include -isystem
/home/os/opt/cross/x86_64-w64-mingw32/sys-include    -E -traditional-cpp
conftest.c
conftest.c:13:2: fatal error: assert.h: No such file or directory
 #endif
  ^~~~~
compilation terminated.
configure:3964: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libgcc/";
| /* end confdefs.h.  */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
|      Syntax error
configure:3964:  /home/os/src/gcc-build-x86_64-w64-mingw32/./gcc/xgcc
-B/home/os/src/gcc-build-x86_64-w64-mingw32/./gcc/
-L/home/os/opt/cross/x86_64-w64-mingw32/lib -L/home/os/opt/cross/mingw/lib
-isystem /home/os/opt/cross/x86_64-w64-mingw32/include -isystem
/home/os/opt/cross/mingw/include
-B/home/os/opt/cross/x86_64-w64-mingw32/bin/
-B/home/os/opt/cross/x86_64-w64-mingw32/lib/ -isystem
/home/os/opt/cross/x86_64-w64-mingw32/include -isystem
/home/os/opt/cross/x86_64-w64-mingw32/sys-include    -E -traditional-cpp
conftest.c
conftest.c:13:2: fatal error: assert.h: No such file or directory
 #endif
  ^~~~~
compilation terminated.
configure:3964: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libgcc/";
| /* end confdefs.h.  */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
|      Syntax error
configure:3964: /lib/cpp  conftest.c
/home/os/src/gcc/libgcc/configure: line 1486: /lib/cpp: No such file or
directory
configure:3964: $? = 127
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libgcc/";
| /* end confdefs.h.  */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
|      Syntax error
configure:3964: /lib/cpp  conftest.c
/home/os/src/gcc/libgcc/configure: line 1486: /lib/cpp: No such file or
directory
configure:3964: $? = 127
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libgcc/";
| /* end confdefs.h.  */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
|      Syntax error
configure:4003: result: /lib/cpp
configure:4023: /lib/cpp  conftest.c
/home/os/src/gcc/libgcc/configure: line 1486: /lib/cpp: No such file or
directory
configure:4023: $? = 127
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libgcc/";
| /* end confdefs.h.  */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
|      Syntax error
configure:4023: /lib/cpp  conftest.c
/home/os/src/gcc/libgcc/configure: line 1486: /lib/cpp: No such file or
directory
configure:4023: $? = 127
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libgcc/";
| /* end confdefs.h.  */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
|      Syntax error
configure:4053: error: in
`/home/os/src/gcc-build-x86_64-w64-mingw32/x86_64-w64-mingw32/libgcc':
configure:4056: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.

///---***---///

After these there are a few more sections in the log. Cache variables and
output variables. Included for completeness:

///---***---///

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

ac_cv_build=x86_64-pc-linux-gnu
ac_cv_c_compiler_gnu=yes
ac_cv_env_CC_set=set
ac_cv_env_CC_value=' /home/os/src/gcc-build-x86_64-w64-mingw32/./gcc/xgcc
-B/home/os/src/gcc-build-x86_64-w64-mingw32/./gcc/
-L/home/os/opt/cross/x86_64-w64-mingw32/lib -L/home/os/opt/cross/mingw/lib
-isystem /home/os/opt/cross/x86_64-w64-mingw32/include -isystem
/home/os/opt/cross/mingw/include
-B/home/os/opt/cross/x86_64-w64-mingw32/bin/
-B/home/os/opt/cross/x86_64-w64-mingw32/lib/ -isystem
/home/os/opt/cross/x86_64-w64-mingw32/include -isystem
/home/os/opt/cross/x86_64-w64-mingw32/sys-include   '
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-g -O2'
ac_cv_env_CPPFLAGS_set=set
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_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-w64-mingw32
ac_cv_env_target_alias_set=set
ac_cv_env_target_alias_value=x86_64-w64-mingw32
ac_cv_host=x86_64-w64-mingw32
ac_cv_objext=o
ac_cv_path_install='/usr/bin/install -c'
ac_cv_prog_AR=/home/os/opt/cross/x86_64-w64-mingw32/bin/ar
ac_cv_prog_AWK=gawk
ac_cv_prog_CC=' /home/os/src/gcc-build-x86_64-w64-mingw32/./gcc/xgcc
-B/home/os/src/gcc-build-x86_64-w64-mingw32/./gcc/
-L/home/os/opt/cross/x86_64-w64-mingw32/lib -L/home/os/opt/cross/mingw/lib
-isystem /home/os/opt/cross/x86_64-w64-mingw32/include -isystem
/home/os/opt/cross/mingw/include
-B/home/os/opt/cross/x86_64-w64-mingw32/bin/
-B/home/os/opt/cross/x86_64-w64-mingw32/lib/ -isystem
/home/os/opt/cross/x86_64-w64-mingw32/include -isystem
/home/os/opt/cross/x86_64-w64-mingw32/sys-include   '
ac_cv_prog_CPP=/lib/cpp
ac_cv_prog_LIPO=x86_64-w64-mingw32-lipo
ac_cv_prog_NM=/home/os/src/gcc-build-x86_64-w64-mingw32/./gcc/nm
ac_cv_prog_RANLIB=/home/os/opt/cross/x86_64-w64-mingw32/bin/ranlib
ac_cv_prog_STRIP=/home/os/opt/cross/x86_64-w64-mingw32/bin/strip
ac_cv_prog_cc_c89=no
ac_cv_prog_cc_g=yes

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

AR='/home/os/opt/cross/x86_64-w64-mingw32/bin/ar'
AWK='gawk'
CC=' /home/os/src/gcc-build-x86_64-w64-mingw32/./gcc/xgcc
-B/home/os/src/gcc-build-x86_64-w64-mingw32/./gcc/
-L/home/os/opt/cross/x86_64-w64-mingw32/lib -L/home/os/opt/cross/mingw/lib
-isystem /home/os/opt/cross/x86_64-w64-mingw32/include -isystem
/home/os/opt/cross/mingw/include
-B/home/os/opt/cross/x86_64-w64-mingw32/bin/
-B/home/os/opt/cross/x86_64-w64-mingw32/lib/ -isystem
/home/os/opt/cross/x86_64-w64-mingw32/include -isystem
/home/os/opt/cross/x86_64-w64-mingw32/sys-include   '
CET_FLAGS=''
CFLAGS='-g -O2'
CPP='/lib/cpp'
CPPFLAGS=''
DEFS=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
GREP=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
LDFLAGS=''
LIBOBJS=''
LIBS=''
LIPO='x86_64-w64-mingw32-lipo'
LN_S='ln -s'
LTLIBOBJS=''
MAINT='#'
NM='/home/os/src/gcc-build-x86_64-w64-mingw32/./gcc/nm'
OBJEXT='o'
PACKAGE_BUGREPORT=''
PACKAGE_NAME='GNU C Runtime Library'
PACKAGE_STRING='GNU C Runtime Library 1.0'
PACKAGE_TARNAME='libgcc'
PACKAGE_URL='http://www.gnu.org/software/libgcc/'
PACKAGE_VERSION='1.0'
PATH_SEPARATOR=':'
PICFLAG=''
RANLIB='/home/os/opt/cross/x86_64-w64-mingw32/bin/ranlib'
SHELL='/bin/sh'
STRIP='/home/os/opt/cross/x86_64-w64-mingw32/bin/strip'
ac_ct_CC=''
accel_dir_suffix=''
asm_hidden_op=''
bindir='${exec_prefix}/bin'
build='x86_64-pc-linux-gnu'
build_alias='x86_64-pc-linux-gnu'
build_cpu='x86_64'
build_libsubdir='build-x86_64-pc-linux-gnu'
build_os='linux-gnu'
build_subdir='build-x86_64-pc-linux-gnu'
build_vendor='pc'
cpu_type=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
decimal_float=''
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
double_type_size=''
dvidir='${docdir}'
enable_decimal_float=''
enable_execute_stack=''
enable_shared='yes'
enable_vtable_verify='no'
exec_prefix='NONE'
extra_parts=''
fixed_point=''
force_explicit_eh_registry=''
get_gcc_base_ver=''
host='x86_64-w64-mingw32'
host_alias='x86_64-w64-mingw32'
host_cpu='x86_64'
host_noncanonical='x86_64-w64-mingw32'
host_os='mingw32'
host_subdir='.'
host_vendor='w64'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
libgcc_topdir='../../../gcc/libgcc/..'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
long_double_type_size=''
mandir='${datarootdir}/man'
md_unwind_header=''
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/home/os/opt/cross'
program_transform_name='s&^&x86_64-w64-mingw32-&'
psdir='${docdir}'
real_host_noncanonical=''
sbindir='${exec_prefix}/sbin'
set_have_cc_tls=''
set_use_emutls=''
sfp_machine_header=''
sharedstatedir='${prefix}/com'
slibdir='$(exec_prefix)/$(host_noncanonical)/lib'
sysconfdir='${prefix}/etc'
target_alias='x86_64-w64-mingw32'
target_noncanonical='x86_64-w64-mingw32'
target_subdir='x86_64-w64-mingw32'
thread_header=''
tm_defines=''
tm_file=''
tmake_file=''
toolexecdir='$(exec_prefix)/$(target_noncanonical)'
toolexeclibdir='$(toolexecdir)/lib/../lib'
unwind_header=''
vis_hide=''
with_aix_soname='aix'

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

/* confdefs.h */
#define PACKAGE_NAME "GNU C Runtime Library"
#define PACKAGE_TARNAME "libgcc"
#define PACKAGE_VERSION "1.0"
#define PACKAGE_STRING "GNU C Runtime Library 1.0"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL "http://www.gnu.org/software/libgcc/";

configure: exit 1

///---***---///

Anyway, been trying to toy with options and such, but no change in results.
Not sure what to make of this. I would appreciate any help anyone could
provide.

Regards,
Juan Pablo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]