Seems to get almost all the way to the end but fails at link time. Running file against the offending file shows it to be a 'ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped' so something is definitely going wrong here. I've passed --lenv 'CFLAGS="-O2 -pipe"\nCXXFLAGS="-O2 -pipe"' to crossdev in order to filter out my -march=znver1 from host's make.conf > /usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /tmp/portage/cross-aarch64-unknown-linux-gnu/glibc-2.29-r2/work/build-arm64 -aarch64-unknown-linux-gnu-nptl/support/links-dso-program.o: Relocations in generic ELF (EM: 62) > /usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /tmp/portage/cross-aarch64-unknown-linux-gnu/glibc-2.29-r2/work/build-arm64 -aarch64-unknown-linux-gnu-nptl/support/links-dso-program.o: Relocations in generic ELF (EM: 62) > /usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /tmp/portage/cross-aarch64-unknown-linux-gnu/glibc-2.29-r2/work/build-arm64 -aarch64-unknown-linux-gnu-nptl/support/links-dso-program.o: Relocations in generic ELF (EM: 62) > /usr/libexec/gcc/aarch64-unknown-linux-gnu/ld: /tmp/portage/cross-aarch64-unknown-linux-gnu/glibc-2.29-r2/work/build-arm64 -aarch64-unknown-linux-gnu-nptl/support/links-dso-program.o: error adding symbols: file in wrong format
Created attachment 572436 [details] build.log.gz
Investigating the build.log shows that links-dso-program.o is being built with x86_64-pc-linux-gnu-g++
> * Manual CC: aarch64-unknown-linux-gnu-gcc -pipe -O2 -fno-strict-aliasing -Wl,-O1 -Wl,--as-needed > * Manual CXX: x86_64-pc-linux-gnu-g++ -pipe -O2 -fno-strict-aliasing CC/CXX discrepancy does not look correct. Why CXX points to host compiler? Please post your 'emerge --info' and 'cat /etc/portage/env/cross-aarch64-unknown-linux-gnu/glibc.conf'
Created attachment 573232 [details] emerge --info output As asked on IRC, this is some data when hitting the same issue on crossdev --target arm-linux-gnueabi with a fresh Docker image based on amd64 stage3.
Here is my suspiction (unchecked): glibc used not to require c++ during bootstrap and now it does require it. Gentoo does not enable c++ for gcc for stage1 gcc as it does not work if you don't have libc yet. Perhaps newer glibc actually started using c++ detection and uses it as: x86_64-pc-linux-gnu-g++ -pipe -O2 -fno-strict-aliasing links-dso-program.cc -c ... We should get rid of c++ depend somehow. I'll try to find the change that started the trigger.
Probably added in glibc-2.29 in: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=561b0bec4448f0302cb4915bf67c919bde4a1c57 +ifeq (,$(CXX)) +LINKS_DSO_PROGRAM = links-dso-program-c +else +LINKS_DSO_PROGRAM = links-dso-program +endif In theory unsetting CXX explicitly during initial bootstrap should be enough.
Building the toolchain using `crossdev -S --target arm-linux-gnueabi --libc '=2.28-r6'` succeeded.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=15fbfc075d699e498d73701b6f2a3f62d7dcabba commit 15fbfc075d699e498d73701b6f2a3f62d7dcabba Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2019-04-19 07:32:12 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2019-04-19 07:35:38 +0000 sys-libs/glibc: disable c++ detection for cross-case, bug #683074 https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=561b0bec4448f0302cb4915bf67c919bde4a1c57 in unstream glibc repo added optional dependency on CXX compiler. Unfortunately ./configure tries hard to pass some g++ as CXX: either ${CTARGET}-g++ (ok) or ${CBUILD}+g++ (bad). During toolchain bootstrap ${CTARGET}-g++ does not yet exist as we only have stage1-gcc without c++ (or libc) support. To restore toolchain bootstrap we force-disable c++ detection by setting cache variable: libc_cv_cxx_link_ok=no c++ is force disables only for cross-compilation case (CHOST != CTARGET). Cross-building case (CHOST = CTRAGET) is unchanged as we should already have c++ capable toolchain by then. Reported-by: hanetzer@startmail.com Reported-by: rhn Closes: https://bugs.gentoo.org/683074 Package-Manager: Portage-2.3.63, Repoman-2.3.12 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> sys-libs/glibc/glibc-2.29-r2.ebuild | 11 +++++++++++ sys-libs/glibc/glibc-9999.ebuild | 11 +++++++++++ 2 files changed, 22 insertions(+)