https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125583
Bug ID: 125583
Summary: [16/17 Regression] GCC no longer builds when running
configure inside the source tree
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: build
Severity: normal
Priority: P3
Component: bootstrap
Assignee: unassigned at gcc dot gnu.org
Reporter: tnfchris at gcc dot gnu.org
Target Milestone: ---
Since the libatomic_asneeded libtool workarounds GCC no longer builds if
./configure is ran inside the source tree.
it fails at building libgomp with
checking whether the C compiler works... no
configure: error: in `/root/gcc-16.1.0/aarch64-unknown-linux-gnu/libgomp':
configure: error: C compiler cannot create executables
See `config.log' for more details
make[2]: *** [Makefile:23007: configure-stage1-target-libgomp] Error 77
This happens because in configure.ac there is
# --srcdir=. covers the toplevel, while "test -d" covers the subdirectories
if ( test $srcdir = . && test -d gcc ) \
|| test -d $srcdir/../host-${host_noncanonical}; then
host_subdir="host-${host_noncanonical}"
else
host_subdir=.
fi
# No prefix.
target_subdir=${target_noncanonical}
which shifts `host_subdir` to `host-${host_noncanonical}`
however the chunks in libatomic to copy the files do
cd `pwd`/../../gcc/ || exit 1; \
if test -f libatomic.so; then (echo "/* GNU ld script"; \
echo " Add DT_NEEDED entry for -latomic only if needed. */"; \
echo "INPUT ( AS_NEEDED ( -latomic ) )" \
) > libatomic_asneeded.so; fi; \
if test -f libatomic.a; then rm -f libatomic_asneeded.a; \
ln -s libatomic.a libatomic_asneeded.a; fi
rm `pwd`/../../gcc//libatomic.la
touch stmp-libatomic
make[5]: Leaving directory
'/tmp/foo/build-gnu-gcc-16.1.0-rhe8-aarch64/aarch64-unknown-linux-gnu/libatomic'
but then the usage of them use
/tmp/foo/build-gnu-gcc-16.1.0-rhe8-aarch64/host-aarch64-unknown-linux-gnu/gcc/xgcc
-B/tmp/foo/build-gnu-gcc-16.1.0-rhe8-aarch64/host-aarch64-unknown-linux-gnu/gcc/
so the files are copied into /tmp/foo/build-gnu-gcc-16.1.0-rhe8-aarch64/gcc/
but we pass as base dir
/tmp/foo/build-gnu-gcc-16.1.0-rhe8-aarch64/host-aarch64-unknown-linux-gnu/gcc/
leading to the builds not working.
It seems that the libatomic code assumes `.` for `host_subdir`.
According to https://gcc.gnu.org/install/build.html this is a supported build
style