commit:     bdb069df283ccbe1e3f5fd39bb2270ec640a67b7
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 30 11:41:50 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Mar 30 11:43:08 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bdb069df

sys-libs/glibc: fix glibc-headers bootstrap on non-multilib host

The error is found by wm_ attempting to build a cross-compiler
    CHOST=powerpc-unknown-linux-gnu CTARGET=mips64-unknown-linux-gnu
Boostrap failed on glibc-headers (./configure phase) as:

  configure:2623: powerpc-unknown-linux-gnu-gcc -mabi=n32 -c \
      -O1 -pipe -U_FORTIFY_SOURCE conftest.c >&5
  powerpc-unknown-linux-gnu-gcc: error: \
      unrecognized command line option '-mabi=n32'; did you mean '-mabi=d32'?

Note how target's ABI is mexed into host's compiler flags.

The error above happens on every host=non-multilib target=multilib combination.
I've reproduced it on:
    CHOST=i686-pc-linux-gnu CTARGET=mips64-unknown-linux-gnu

The fix is not to inject target's CFLAGS ABI into CC for
USE=headers-only bootstrap step as we don't have cross-compiler yet.

Tested by successfully bootstrapping cross-compiler on
    CHOST=i686-pc-linux-gnu CTARGET=mips64-unknown-linux-gnu

Package-Manager: Portage-2.3.26, Repoman-2.3.7

 sys-libs/glibc/glibc-2.27-r1.ebuild | 7 +++++++
 sys-libs/glibc/glibc-9999.ebuild    | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.27-r1.ebuild 
b/sys-libs/glibc/glibc-2.27-r1.ebuild
index a175b225e18..b281c00fac3 100644
--- a/sys-libs/glibc/glibc-2.27-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r1.ebuild
@@ -457,6 +457,13 @@ setup_env() {
 
        export ABI=${ABI:-${DEFAULT_ABI:-default}}
 
+       if use headers-only ; then
+               # Avoid mixing host's CC and target's CFLAGS_${ABI}:
+               # At this bootstrap stage we have only binutils for
+               # target but not compiler yet.
+               einfo "Skip CC ABI injection. We can't use (cross-)compiler 
yet."
+               return 0
+       fi
        local VAR=CFLAGS_${ABI}
        # We need to export CFLAGS with abi information in them because glibc's
        # configure script checks CFLAGS for some targets (like mips).  Keep

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 52fe095e5fd..17f8cdafed5 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -457,6 +457,13 @@ setup_env() {
 
        export ABI=${ABI:-${DEFAULT_ABI:-default}}
 
+       if use headers-only ; then
+               # Avoid mixing host's CC and target's CFLAGS_${ABI}:
+               # At this bootstrap stage we have only binutils for
+               # target but not compiler yet.
+               einfo "Skip CC ABI injection. We can't use (cross-)compiler 
yet."
+               return 0
+       fi
        local VAR=CFLAGS_${ABI}
        # We need to export CFLAGS with abi information in them because glibc's
        # configure script checks CFLAGS for some targets (like mips).  Keep

Reply via email to