https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120509

            Bug ID: 120509
           Summary: lto-plugin configure fails on cross compiler build
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chandleg at wizardsworks dot org
  Target Milestone: ---

lto-plugin configure fails on cross compiler build, due it trying to run a
non-platform xgcc to test.  The configure script KNOWS it's a cross compile and
still attempts to run the executable:


Main configure for gcc:
  CFLAGS="-O2" \
  CXXFLAGS="-O2" \
  ../configure --prefix=/usr \
     --libdir=/usr/lib \
     --mandir=/usr/man \
     --infodir=/usr/info \
     --enable-shared \
     --enable-bootstrap \
     --enable-languages=c,c++ \
     --enable-threads=posix \
     --enable-checking=release \
     --with-system-zlib \
     --enable-libstdcxx-dual-abi \
     --with-default-libstdcxx-abi=new \
     --disable-libstdcxx-pch \
     --disable-libunwind-exceptions \
     --enable-__cxa_atexit \
     --disable-libssp \
     --enable-gnu-indirect-function \
     --enable-gnu-unique-object \
     --enable-plugin \
     --enable-lto \
     --disable-install-libiberty \
     --disable-werror \
     --with-gnu-ld \
     --with-isl \
     --verbose \
     --with-arch-directory=alpha \
     --disable-gtktest \
     --enable-clocale=gnu \
     --disable-multilib \
     --target=alpha-linux-gnu \
     --disable-nls \
     --disable-libatomic \
     --disable-libgomp \
     --disable-libquadmath \
     --disable-libsanitizer \
     --disable-libssp \
     --disable-libvtv \
     --build=x86_64-slackware-linux \
     --host=alpha-linux-gnu \
     --with-build-sysroot=/opt


Output from the offending lto-plugin stuff:
make[2]: Entering directory '/tmp/gcc-14.2.0/gcc.build.lnx'
Configuring stage 2 in ./lto-plugin
configure: creating cache ./config.cache
checking build system type... x86_64-slackware-linux-gnu
checking host system type... alpha-unknown-linux-gnu
checking target system type... alpha-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/ginstall -c
checking whether build environment is sane... yes
checking for alpha-linux-gnu-strip... alpha-linux-gnu-strip
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for style of include used by make... GNU
checking for alpha-linux-gnu-gcc... 
/tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/xgcc
-B/tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/ -B/usr/alpha-linux-gnu/bin/ 
--sysroot=/opt  -fno-checking
checking whether the C compiler works... no
configure: error: in `/tmp/gcc-14.2.0/gcc.build.lnx/lto-plugin':
configure: error: C compiler cannot create executables
See `config.log' for more details
make[2]: *** [Makefile:14358: configure-stage2-lto-plugin] Error 77
make[2]: Leaving directory '/tmp/gcc-14.2.0/gcc.build.lnx'
make[1]: *** [Makefile:21605: stage2-bubble] Error 2
make[1]: Leaving directory '/tmp/gcc-14.2.0/gcc.build.lnx'



and line was

  $ /tmp/gcc-14.2.0/lto-plugin/configure --srcdir=../../lto-plugin
--cache-file=./config.cache --with-system-zlib --prefix=/usr --libdir=/usr/lib
--mandir=/usr/man --infodir=/usr/info --enable-shared --enable-bootstrap
--enable-threads=posix --enable-checking=release --with-system-zlib
--enable-libstdcxx-dual-abi --with-default-libstdcxx-abi=new
--disable-libstdcxx-pch --disable-libunwind-exceptions --enable-__cxa_atexit
--enable-gnu-indirect-function --enable-gnu-unique-object --enable-plugin
--enable-lto --disable-install-libiberty --disable-werror --with-gnu-ld
--with-isl --verbose --with-arch-directory=alpha --disable-gtktest
--enable-clocale=gnu --disable-multilib --disable-nls --disable-libatomic
--disable-libgomp --disable-libquadmath --disable-libsanitizer --disable-libssp
--disable-libvtv --with-build-sysroot=/opt --enable-languages=c,c++,lto
--program-transform-name=s,y,y, --disable-option-checking
--build=x86_64-slackware-linux --host=alpha-linux-gnu --target=alpha-linux-gnu
--with-build-libsubdir=. --enable-shared

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

hostname = constellation.wizardsworks.org
uname -m = x86_64
uname -r = 6.12.12
uname -s = Linux
uname -v = #1 SMP PREEMPT_DYNAMIC Sun Feb  2 14:22:25 CST 2025

/usr/bin/uname -p = AMD Ryzen 7 7700X 8-Core Processor
/bin/uname -X     = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /opt//tools/bin
PATH: /opt//tools/bin
PATH: /usr/local/sbin
PATH: /usr/sbin
PATH: /sbin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/games
PATH: /usr/lib64/libexec/kf5
PATH: /usr/lib64/qt5/bin
PATH: /usr/lib64/qt6/bin


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

configure:2302: creating cache ./config.cache
configure:2411: checking build system type
configure:2425: result: x86_64-slackware-linux-gnu
configure:2445: checking host system type
configure:2458: result: alpha-unknown-linux-gnu
configure:2478: checking target system type
configure:2491: result: alpha-unknown-linux-gnu
configure:2579: checking for a BSD-compatible install
configure:2647: result: /usr/bin/ginstall -c
configure:2658: checking whether build environment is sane
configure:2713: result: yes
configure:2772: checking for alpha-linux-gnu-strip
configure:2788: found /opt//tools/bin/alpha-linux-gnu-strip
configure:2799: result: alpha-linux-gnu-strip
configure:2864: checking for a thread-safe mkdir -p
configure:2903: result: /usr/bin/mkdir -p
configure:2910: checking for gawk
configure:2937: result: gawk
configure:2948: checking whether make sets $(MAKE)
configure:2970: result: yes
configure:2999: checking whether make supports nested variables
configure:3016: result: yes
configure:3143: checking whether to enable maintainer-specific portions of
Makefiles
configure:3152: result: no
configure:3186: checking for style of include used by make
configure:3214: result: GNU
configure:3245: checking for alpha-linux-gnu-gcc
configure:3272: result:  /tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/xgcc
-B/tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/ -B/usr/alpha-linux-gnu/bin/ 
--sysroot=/opt  -fno-checking
configure:3541: checking for C compiler version
configure:3550:  /tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/xgcc
-B/tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/ -B/usr/alpha-linux-gnu/bin/ 
--sysroot=/opt  -fno-checking --version >&5
/tmp/gcc-14.2.0/lto-plugin/configure: line 3552:
/tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/xgcc: cannot execute binary file: Exec
format error
configure:3561: $? = 126
configure:3550:  /tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/xgcc
-B/tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/ -B/usr/alpha-linux-gnu/bin/ 
--sysroot=/opt  -fno-checking -v >&5
/tmp/gcc-14.2.0/lto-plugin/configure: line 3552:
/tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/xgcc: cannot execute binary file: Exec
format error
configure:3561: $? = 126
configure:3550:  /tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/xgcc
-B/tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/ -B/usr/alpha-linux-gnu/bin/ 
--sysroot=/opt  -fno-checking -V >&5
/tmp/gcc-14.2.0/lto-plugin/configure: line 3552:
/tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/xgcc: cannot execute binary file: Exec
format error
configure:3561: $? = 126
configure:3550:  /tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/xgcc
-B/tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/ -B/usr/alpha-linux-gnu/bin/ 
--sysroot=/opt  -fno-checking -qversion >&5
/tmp/gcc-14.2.0/lto-plugin/configure: line 3552:
/tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/xgcc: cannot execute binary file: Exec
format error
configure:3561: $? = 126
configure:3581: checking whether the C compiler works
configure:3603:  /tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/xgcc
-B/tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/ -B/usr/alpha-linux-gnu/bin/ 
--sysroot=/opt  -fno-checking -g -O2 -fno-checking  -static-libstdc++
-static-libgcc -Wl,--no-relax conftest.c  >&5
/tmp/gcc-14.2.0/lto-plugin/configure: line 3605:
/tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/xgcc: cannot execute binary file: Exec
format error
configure:3607: $? = 126
configure:3645: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "LTO plugin for ld"
| #define PACKAGE_TARNAME "lto-plugin"
| #define PACKAGE_VERSION "0.1"
| #define PACKAGE_STRING "LTO plugin for ld 0.1"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define PACKAGE "lto-plugin"
| #define VERSION "0.1"
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3650: error: in `/tmp/gcc-14.2.0/gcc.build.lnx/lto-plugin':
configure:3652: error: C compiler cannot create executables
See `config.log' for more details

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

ac_cv_build=x86_64-slackware-linux-gnu
ac_cv_env_CC_set=set
ac_cv_env_CC_value=' /tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/xgcc
-B/tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/ -B/usr/alpha-linux-gnu/bin/ 
--sysroot=/opt  -fno-checking'
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-g -O2 -fno-checking'
ac_cv_env_CPPFLAGS_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='-static-libstdc++ -static-libgcc -Wl,--no-relax'
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-slackware-linux
ac_cv_env_host_alias_set=set
ac_cv_env_host_alias_value=alpha-linux-gnu
ac_cv_env_target_alias_set=set
ac_cv_env_target_alias_value=alpha-linux-gnu
ac_cv_host=alpha-unknown-linux-gnu
ac_cv_path_mkdir=/usr/bin/mkdir
ac_cv_prog_AWK=gawk
ac_cv_prog_CC=' /tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/xgcc
-B/tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/ -B/usr/alpha-linux-gnu/bin/ 
--sysroot=/opt  -fno-checking'
ac_cv_prog_STRIP=alpha-linux-gnu-strip
ac_cv_prog_make_make_set=yes
ac_cv_target=alpha-unknown-linux-gnu
am_cv_make_support_nested_variables=yes
## ----------------- ##
## Output variables. ##
## ----------------- ##

ACLOCAL='${SHELL} /tmp/gcc-14.2.0/missing aclocal-1.15'
AMDEPBACKSLASH='\'
AMDEP_FALSE='#'
AMDEP_TRUE=''
AMTAR='$${TAR-tar}'
AM_BACKSLASH='\'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
AM_DEFAULT_VERBOSITY='1'
AM_V='$(V)'
AR='alpha-linux-gnu-ar --plugin
/opt/tools/bin/../libexec/gcc/alpha-linux-gnu/14.2.0/liblto_plugin.so'
AUTOCONF='${SHELL} /tmp/gcc-14.2.0/missing autoconf'
AUTOHEADER='${SHELL} /tmp/gcc-14.2.0/missing autoheader'
AUTOMAKE='${SHELL} /tmp/gcc-14.2.0/missing automake-1.15'
AWK='gawk'
CC=' /tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/xgcc
-B/tmp/gcc-14.2.0/gcc.build.lnx/./prev-gcc/ -B/usr/alpha-linux-gnu/bin/ 
--sysroot=/opt  -fno-checking'
CCDEPMODE=''
CET_HOST_FLAGS=''
CFLAGS='-g -O2 -fno-checking'
CPP=''
CPPFLAGS=''
CYGPATH_W='echo'
DEFS=''
DEPDIR='.deps'
DSYMUTIL='alpha-linux-gnu-dsymutil'
DUMPBIN=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
ENABLE_DARWIN_AT_RPATH_FALSE=''
ENABLE_DARWIN_AT_RPATH_TRUE=''
EXEEXT=''
FGREP=''
GREP=''
INSTALL_DATA='/usr/bin/ginstall -c -m 644'
INSTALL_PROGRAM='/usr/bin/ginstall -c'
INSTALL_SCRIPT='/usr/bin/ginstall -c'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LD='/opt/tools/bin/../lib/gcc/alpha-linux-gnu/14.2.0/../../../../alpha-linux-gnu/bin/ld'
LDFLAGS='-static-libstdc++ -static-libgcc -Wl,--no-relax'
LIBOBJS=''
LIBS=''
LIBTOOL=''
LIPO=''
LN_S=''
LTLIBOBJS=''
LTO_PLUGIN_USE_SYMVER_FALSE=''
LTO_PLUGIN_USE_SYMVER_GNU_FALSE=''
LTO_PLUGIN_USE_SYMVER_GNU_TRUE=''
LTO_PLUGIN_USE_SYMVER_SUN_FALSE=''
LTO_PLUGIN_USE_SYMVER_SUN_TRUE=''
LTO_PLUGIN_USE_SYMVER_TRUE=''
MAINT='#'
MAINTAINER_MODE_FALSE=''
MAINTAINER_MODE_TRUE='#'
MAKEINFO='makeinfo --split-size=5000000 --split-size=5000000'
MKDIR_P='/usr/bin/mkdir -p'
NM='alpha-linux-gnu-nm'
NMEDIT=''
OBJDUMP='alpha-linux-gnu-objdump'
OBJEXT=''
OTOOL64=''
OTOOL='alpha-linux-gnu-otool'
PACKAGE='lto-plugin'
PACKAGE_BUGREPORT=''
PACKAGE_NAME='LTO plugin for ld'
PACKAGE_STRING='LTO plugin for ld 0.1'
PACKAGE_TARNAME='lto-plugin'
PACKAGE_URL=''
PACKAGE_VERSION='0.1'
PATH_SEPARATOR=':'
RANLIB='alpha-linux-gnu-ranlib --plugin
/opt/tools/bin/../libexec/gcc/alpha-linux-gnu/14.2.0/liblto_plugin.so'
SED='/usr/bin/sed'
SET_MAKE=''
SHELL='/bin/sh'
STRIP='alpha-linux-gnu-strip'
VERSION='0.1'
ac_ct_CC=''
ac_ct_DUMPBIN=''
ac_lto_plugin_extra_ldflags=''
ac_lto_plugin_ldflags=''
ac_lto_plugin_warn_cflags=''
accel_dir_suffix=''
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE=''
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__include='include'
am__isrc=' -I$(srcdir)'
am__leading_dot='.'
am__nodep='_no'
am__quote=''
am__tar='$${TAR-tar} chof - "$$tardir"'
am__untar='$${TAR-tar} xf -'
bindir='${exec_prefix}/bin'
build='x86_64-slackware-linux-gnu'
build_alias='x86_64-slackware-linux'
build_cpu='x86_64'
build_libsubdir='.'
build_os='linux-gnu'
build_subdir='build-x86_64-slackware-linux'
build_vendor='slackware'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
enable_host_bind_now=''
exec_prefix='NONE'
gcc_build_dir=''
get_gcc_base_ver=''
host='alpha-unknown-linux-gnu'
host_alias='alpha-linux-gnu'
host_cpu='alpha'
host_os='linux-gnu'
host_subdir='.'
host_vendor='unknown'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='/usr/info'
install_sh='${SHELL} /tmp/gcc-14.2.0/install-sh'
libdir='/usr/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
lt_host_flags=''
mandir='/usr/man'
mkdir_p='$(MKDIR_P)'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/usr'
program_transform_name='s,y,y,'
psdir='${docdir}'
real_target_noncanonical=''
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target='alpha-unknown-linux-gnu'
target_alias='alpha-linux-gnu'
target_cpu='alpha'
target_noncanonical='alpha-linux-gnu'
target_os='linux-gnu'
target_subdir='alpha-linux-gnu'
target_vendor='unknown'
with_libiberty='../libiberty'

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

/* confdefs.h */
#define PACKAGE_NAME "LTO plugin for ld"
#define PACKAGE_TARNAME "lto-plugin"
#define PACKAGE_VERSION "0.1"
#define PACKAGE_STRING "LTO plugin for ld 0.1"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define PACKAGE "lto-plugin"
#define VERSION "0.1"

configure: exit 77




It's clearly not going to work:


# file prev-gcc/xgcc 
prev-gcc/xgcc: ELF 64-bit LSB executable, Alpha (unofficial), version 1
(GNU/Linux), dynamically linked, interpreter /lib/ld-linux.so.2, with
debug_info, not stripped

# uname -m
x86_64

Reply via email to