From nobody Wed Apr 16 21:14:24 2025 X-Original-To: current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ZdDLC6Nr9z5tFC2 for ; Wed, 16 Apr 2025 21:14:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZdDLC5kzPz44Jn for ; Wed, 16 Apr 2025 21:14:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1744838067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=AklVVolBGn6oWNsEA8BAIGLahlhagmxHxAAB84axlq8=; b=rb9Kx6aEq57psysw99hxWWlV5zZGLQK3LUwD7AWMhe9B24MYr3ouAEwft7JeMkxQABOymG 58UOzp1s5deR3e/vt79eDHbTTjLwzXi/Kud94JKsBzOeRCWbLxWqak2glwbc9CTcLjw2Mu SrdQsnijsTUK6vzDx9PwM3Zf4yQRTtL3/H1oqape1CrVtN17bo0nolVq88Obgc2BfHusqo 16Ius/rN+ci1Q8hvo4y1x9ZA67z+X6OP5zaIi2TYVNuAZJ8lnxBywNsL0/vBVnXItYY1DK eu0rDu6cRykoROaxocvU6ONG38Vi8F9+ZfUjwVowEJG/D1rLsMvxDmoUiZpDyw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1744838067; a=rsa-sha256; cv=none; b=yljaNco4QJ0m1L+hlw1JrPzbXgtb0NFJmYyVTHQtNzV5EiBoqCi5QlhyKMcb7/LNgvSjMe cj+kgGahj2S4bMNATVTu2L1cFxUlgwURuKf9orzsZ83+/qMo9SiAZdO6Q2vyh0n2fPqHwe 7aaDklbfRD4Ty1sasnViMjBg24gOSimbkXHZMPjrcxah/GAX0UGmaMUPczO7NOHNqBmeEv 3Przx+4JYM4TCCw8XZkolsvvHKC1DGMsJdaVdxRIMwWdffZ6F3vBjOybhIcBp/1Fud4fwl ar2CtFlIrqhQFt6H1lg/SiUXWlNLKY2kdyfCbq7/ZdxbWKkrt+qVAlkHl+Vn1g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1744838067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=AklVVolBGn6oWNsEA8BAIGLahlhagmxHxAAB84axlq8=; b=hpR9zIUMCBLd6jKKFzQdFrzYzbglNKkIPT8NdMoo7HDP8Ss/gr9/PvDdIduW2RVSHBxN4+ vejQS2GcWFw3YavL5alFQ5zbof4KK1Oi/a/EFrcYshLsCr+TyLPFwx9aiFHzZpiB+7ZNOh HS9pRJMIeqLgGHvGkI0DtGIdHg9PsO16M+3EYYGSgZ/pShqzmbSyqB5VdLDlPYJFjqVoVs syi5zKGKLepuQ367u0qGr70yEaMbWje1cv5nHp0/2cOAvCiKQzZTwf/ce2UQx2JEa2XUEY 0ln7RsT/on563HgP2DYUe4ZBzAchbvBGO43Bmtouf7jvr50pZdzi8uF0+ebX9A== Received: from [192.168.0.88] (unknown [93.188.39.137]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: avg/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4ZdDLC36b5z15Zp for ; Wed, 16 Apr 2025 21:14:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Message-ID: <16457a38-c381-4234-b4fe-4e0d5afe73ea@FreeBSD.org> Date: Thu, 17 Apr 2025 00:14:24 +0300 List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: WITHOUT_CLANG + WITH_CLANG_BOOTSTRAP seems to be broken From: Andriy Gapon To: FreeBSD Current References: <058958c0-9024-4444-846c-7255cd367ea2@FreeBSD.org> Content-Language: en-US Autocrypt: addr=avg@FreeBSD.org; keydata= xsDNBGcKrHEBDADRvwQOK0b/yo4ys5cs6bOQMhEh4xtfbaZ/CU00cpPgUip3sOZCdrtMWlRC g25z97prxE9pKueZi+HXDhIPpa9xl14ghqF4oYScuJ1i18HyiOH2y5Q3Vv/TtFiSzicd3EAu QgS3jVidpgDSPDdj2Yz3UxYpZ+PuFl6nOnvCvqOFcjUlzKCyPaiN2b86l1Nscmhnc+zQ/faB erUOEFEDQbWMA5YfXi8HrbeR16hfRfGt7E0aMDlIj9FIPIq71UWMN9CimPgs4+rbNr1MAlLa z4GxSDhVYZEY5rqtCzr+PLXboRQWnaUwXl0/biw9enf17NHdYv1SNAFTX2eC4dZ3qBVI74dS PgNprm+PMfz+6Hhs/dAv+Nan5nVhg3EFIjYTiy0MnjMSq8uI0v0ykpAGAcJJ5xl6d23aLxgN 6f0z6pJRCO0hGPgU7UzvFD0MxJxmbzqdT1R51KDan1oD41b+tjl2LMBuCDCoB0U44Pu0zLdp xMfFTxCXtwIYKIUxwd28jwMAEQEAAc0eQW5kcml5IEdhcG9uIDxhdmdARnJlZUJTRC5vcmc+ wsENBBMBCAA3FiE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Rm eldDS9msXDW4KXODyPZ+9unvmHAcoH0xaBYaSH44CDZDQDg4LNcmbOvuu1TEXBJhjQARAQAB wsD8BBgBCAAmFiEEmXvSmjiQFHPVOpLnzDOt5NLj67sFAmcKrHMFCQeEzgACGwwACgkQzDOt 5NLj67sUCAv5AXqgWnYN9EblapMbZjkiqL8pZQ0GNqh+Pg9FwbyULxjtRTO6rD4D0IxizByb ef+neeUNyYlagt5nfKMysEr0SU/gHKCi8vyTF/63ukMrGUNGmJJxrndl5ZYKC6j6eX7twrZF L1Uvlmn6FnQ22red5kHO93fDjG4zaDIZvHfwj7kzjZ4tpC7Byinf88s14mdZeScc0PnU2hj4 UGYju/wg2FF4YxaZYhcmdTiRYY0Wx85XSMZv19pnn78sadEuRvfRd4JTmw++j1xGXeqQGWzz /CTG5/Ex9GAkQ02hZbmi236byDXoet4G8TEyOph9QFVkV9bNd0jQZaFZPGEj4PSPUYGAF7s5 xJaNGgctC3aZ7WjEv1FBoo44XCU4xcjJ1wZQUrHxRhx6TW0Jtcl0U9qfKFW30TSPo6RyiXuj X4ltWKAtjoXB8nUmEJckaz7IRu2b4pXDeazZuz5JBygUs10yJjDxh2vFQZo0KaBAPx9MZlPn gpPTjT15L8xGftEjQXF6 In-Reply-To: <058958c0-9024-4444-846c-7255cd367ea2@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit I am going to open a PR for this, but I wonder if no one else is seeing this or if no one else cares. I'd imagine that a build configuration like mine is not so exotic. E.g., likes of nanobsd could be using something like it. For me, reproducing the issue is very trivial. E.g., I do this on a recently upgraded host built from main, in a source tree for releng/14.2 branch: $ env MAKEOBJDIRPREFIX=/usr/obj/test make -s -j12 toolchain __MAKE_CONF=/dev/null SRCCONF=/dev/null WITHOUT_CLANG=t make[1]: "/usr/home/avg/devel/freebsd-src-new/upstream/releng/14.2/Makefile.inc1" line 339: SYSTEM_COMPILER: libclang will be built for bootstrapping a cross-compiler. make[1]: "/usr/home/avg/devel/freebsd-src-new/upstream/releng/14.2/Makefile.inc1" line 344: SYSTEM_LINKER: libclang will be built for bootstrapping a cross-linker. -------------------------------------------------------------- >>> Cleaning up the temporary build tree -------------------------------------------------------------- -------------------------------------------------------------- >>> Rebuilding the temporary build tree -------------------------------------------------------------- Linking host tools into /usr/obj/test/usr/home/avg/devel/freebsd-src-new/upstream/releng/14.2/amd64.amd64/tmp/legacy/bin -------------------------------------------------------------- >>> stage 1.1: legacy release compatibility shims -------------------------------------------------------------- ===> tools/build (obj,includes,all,install) 0.12 real 0.05 user 0.09 sys -------------------------------------------------------------- >>> stage 1.2: bootstrap tools -------------------------------------------------------------- ... -------------------------------------------------------------- >>> stage 2.1: cleaning up the object tree -------------------------------------------------------------- ... -------------------------------------------------------------- >>> stage 2.3: build tools -------------------------------------------------------------- ... -------------------------------------------------------------- >>> stage 3: cross tools -------------------------------------------------------------- ===> lib/clang (obj,all,install) ===> lib/clang/libllvm (all) ===> lib/clang/libllvm (install) ===> usr.bin/clang (obj,all,install) ===> usr.bin/clang/lld (obj,all,install) ===> lib/libelftc (obj,all,install) ===> lib/libpe (obj,all,install) ===> usr.bin/elfctl (obj,all,install) ===> usr.bin/elfdump (obj,all,install) ===> usr.bin/objcopy (obj,all,install) ===> usr.bin/nm (obj,all,install) ===> usr.bin/size (obj,all,install) ===> usr.bin/strings (obj,all,install) ===> usr.bin/addr2line (obj,all,install) ===> cddl/lib/libctf (obj,all,install) ===> cddl/lib/libspl (obj,all,install) ===> cddl/usr.bin/ctfconvert (obj,all,install) ===> cddl/usr.bin/ctfmerge (obj,all,install) ===> stand/usb/tools (obj,all,install) 634.09 real 6925.37 user 229.17 sys 0.04 real 0.00 user 0.04 sys As you can see, usr.bin/clang/clan is missing from the output. Also: $ ls -l /usr/obj/test/.../releng/14.2/amd64.amd64/tmp/bin total 0 $ ls -l /usr/obj/test/.../releng/14.2/amd64.amd64/tmp/usr/bin total 40247 -rwxr-xr-x 1 avg wheel 2116760 16 Apr 23:48 addr2line -rwxr-xr-x 1 avg wheel 2595200 16 Apr 23:48 ctfconvert -rwxr-xr-x 1 avg wheel 1997104 16 Apr 23:48 ctfmerge -rwxr-xr-x 1 avg wheel 1411856 16 Apr 23:48 elfctl -rwxr-xr-x 1 avg wheel 1238064 16 Apr 23:48 elfdump lrwxr-xr-x 1 avg wheel 6 16 Apr 23:48 ld -> ld.lld -rwxr-xr-x 1 avg wheel 51724952 16 Apr 23:48 ld.lld -rwxr-xr-x 1 avg wheel 2132480 16 Apr 23:48 nm -rwxr-xr-x 1 avg wheel 2337048 16 Apr 23:48 objcopy -rwxr-xr-x 1 avg wheel 1479664 16 Apr 23:48 size -rwxr-xr-x 1 avg wheel 1425008 16 Apr 23:48 strings lrwxr-xr-x 1 avg wheel 101 16 Apr 23:48 strip -> /usr/obj/test/.../releng/14.2/amd64.amd64/tmp/usr/bin/objcopy -rwxr-xr-x 1 avg wheel 1220848 16 Apr 23:48 sysinit As you can see, clang binaries are not in the expected place. Furthermore, the build just fails down the line. On 11/04/2025 12:29, Andriy Gapon wrote: > > I think that WITHOUT_CLANG + WITH_CLANG_BOOTSTRAP (the latter is the default and > doesn't need to be explicit) is supposed to work. > > I think that the combination should result in building clang as a cross-tool for > the rest of the build, but not building clang for the target. > > However, it seems that the combination is broken at the moment in that the > cross-tool clang is not getting built and the host clang gets used for the build. > > I have recently discovered this issue while trying to build releng/14.2 on a > main (aka 15-CURRENT) host with WITHOUT_CLANG in src.conf.  Host and target > architectures are the same, amd64. > 14.2 has clang 18 as a compiler, while main has clang 19. > The same problem exists for WITHOUT_TOOLCHAIN as well. > > I think that this used to work. Or maybe I was just lucky and the compilers were > either the same or sufficiently compatible that the host compiler could compile > the branch code. > > I think that >     .if ${MK_CLANG} != "no" >     SUBDIR+=        clang >     .endif > in usr.bin/clang/Makefile is the reason why the cross-tool clang is not built > when WITHOUT_CLANG is set. > > A bit more of info is in the forwarded message and the thread to which it belongs. > > What's curious is that those lines are there since commit 8e1c989abbd1db4 "Don't > build and install {llvm,clang,lldb}-tblgen for the target", but I only noticed > the problem a few days ago.  And apparenlty nobody else has seen it. > I'd imagine that the reported configuration is not too exotic. > So, not sure what and when get broken. > It could also be something with my build environment... > > -------- Forwarded Message -------- > Subject: Re: c++ error when trying to build releng/14.2 on 'main' host > Date: Thu, 10 Apr 2025 09:05:47 +0300 > From: Andriy Gapon > To: Dimitry Andric > CC: toolchain@freebsd.org > > On 09/04/2025 8:28 pm, Andriy Gapon wrote: >> What's interesting is that I saw this during the build (make with -s option): >> -------------------------------------------------------------- >>  >>> stage 3: cross tools >> -------------------------------------------------------------- >> ===> lib/clang (obj,all,install) >> ===> lib/clang/libllvm (all) >> ===> lib/clang/libllvm (install) >> ===> usr.bin/clang (obj,all,install) >> ===> usr.bin/clang/lld (obj,all,install) > > When I compared this to other builds, I noticed a missing bit: > ===> usr.bin/clang/clang (all) > ===> usr.bin/clang/clang (install) > > usr.bin/clang/Makefile has this near the top: > .if ${MK_CLANG} != "no" > SUBDIR+=        clang > .endif > > If I read this right, it means that the actual clang is not built/installed if > WITHOUT_CLANG is configured. > Even in the cross-tools stage! > > I am not sure how it worked before as I do not see any recent changes in that > direct area.  Not sure when and what went wrong.  Maybe it's something in one > of .mk include files, maybe something in my environment. > > As hack I tried this change and it seems to have helped: > --- a/Makefile.inc1 > +++ b/Makefile.inc1 > @@ -787,6 +787,7 @@ >  # TOOLS_PREFIX set in BMAKE >  XMAKE=         ${BMAKE} \ >                 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ > +               MK_CLANG=${MK_CLANG_BOOTSTRAP} \ >                 MK_LLDB=no \ >                 MK_LLVM_BINUTILS=no \ >                 MK_TESTS=no > > I hope that more knowledgeable people can see what the problem could be, > wherever it is. > >> ===> lib/libelftc (obj,all,install) >> ===> lib/libpe (obj,all,install) >> ===> usr.bin/elfctl (obj,all,install) >> ===> usr.bin/elfdump (obj,all,install) >> ===> usr.bin/objcopy (obj,all,install) >> ===> usr.bin/nm (obj,all,install) >> ===> usr.bin/size (obj,all,install) >> ===> usr.bin/strings (obj,all,install) >> ===> usr.bin/addr2line (obj,all,install) >> ===> cddl/lib/libctf (obj,all,install) >> ===> cddl/lib/libspl (obj,all,install) >> ===> cddl/usr.bin/ctfconvert (obj,all,install) >> ===> cddl/usr.bin/ctfmerge (obj,all,install) >> ===> stand/usb/tools (obj,all,install) > > -- Andriy Gapon