[Bug 269369] native-xtools builds for wrong target in releng/13.1

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 06 Feb 2023 11:13:13 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=269369

            Bug ID: 269369
           Summary: native-xtools builds for wrong target in releng/13.1
           Product: Base System
           Version: 13.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: chris@chrullrich.net

In releng/13.1 "make native-xtools" builds a toolchain that targets the host by
default, instead of TARGET/TARGET_ARCH. releng/13.0 works correctly.

Bisecting shows that the first commit that ends up with the wrong default
target is:

commit a5186406aced401de7984f8b338675da650d0e25
Author: Alex Richardson <arichardson@FreeBSD.org>
Date:   Mon Sep 6 09:49:49 2021 +0100

    Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain

Reverting this commit as best I can did not fix the bug. Unfortunately the base
build system is far beyond my comprehension.


From releng/13.1:

$ MAKEOBJDIRPREFIX=/usr/obj/aarch64 make -j 4 TARGET=arm64 TARGET_ARCH=aarch64
native-xtools
[...]
$
/usr/obj/aarch64/usr/src/amd64.amd64/nxb/arm64.aarch64/usr.bin/clang/clang/clang
-v
FreeBSD clang version 13.0.0 (git@github.com:llvm/llvm-project.git
llvmorg-13.0.0-0-gd7b669b3a303)
Target: x86_64-unknown-freebsd13.1
Thread model: posix
InstalledDir:
/usr/obj/aarch64/usr/src/amd64.amd64/nxb/arm64.aarch64/usr.bin/clang/clang


From releng/13.0:

$ MAKEOBJDIRPREFIX=/usr/obj/aarch64 make -j 4 TARGET=arm64 TARGET_ARCH=aarch64
native-xtools
[...]
$
/usr/obj/aarch64/usr/src/amd64.amd64/nxb/arm64.aarch64/usr.bin/clang/clang/clang
-v
FreeBSD clang version 11.0.1 (git@github.com:llvm/llvm-project.git
llvmorg-11.0.1-0-g43ff75f2c3fe)
Target: aarch64-unknown-freebsd13.0
Thread model: posix
InstalledDir:
/usr/obj/aarch64/usr/src/amd64.amd64/nxb/arm64.aarch64/usr.bin/clang/clang


I have -j4 build logs from both. If they are needed, please let me know where
to put them (~43 MiB total), and whether I should recreate them without -j, or
with any additional options. The most obvious difference is that the working
(13.0) build has ~3600 more lines in "stage 3: cross tools" and about as many
fewer in "stage 4.2: building libraries" than the broken one.


$ egrep -v "^($|#)" /etc/make.conf /etc/src.conf /etc/src-env.conf
/etc/make.conf:CFLAGS=         -O -pipe
/etc/make.conf:WRKDIRPREFIX=   /tmp/portbuild
/etc/make.conf:DEPENDS_TARGET= package
/etc/make.conf:KERNCONF=       LOCAL
/etc/make.conf:DEVELOPER=      1
/etc/make.conf:KRB5_HOME=      /usr/local
/etc/make.conf:.if ("${TARGET}" == "amd64")
/etc/make.conf:.endif
/etc/make.conf:WITH_CCACHE_BUILD=yes
/etc/make.conf:WITH_BDB6_PERMITTED=yes
/etc/src.conf:WITH_CCACHE_BUILD=true
/etc/src.conf:CCACHE_DIR=/var/cache/ccache
/etc/src.conf:CCACHE_UMASK=002
/etc/src.conf:WITHOUT_TESTS=yes
/etc/src.conf:WITHOUT_KERBEROS=yes
/etc/src.conf:WITHOUT_LIB32=yes
egrep: /etc/src-env.conf: No such file or directory

-- 
You are receiving this mail because:
You are the assignee for the bug.