Bug 282563 - stable/14 build with clang19
Summary: stable/14 build with clang19
Status: Closed Not A Bug
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 14.2-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-05 10:28 UTC by Jordan Ostreff
Modified: 2024-11-07 18:44 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jordan Ostreff 2024-11-05 10:28:14 UTC
Current stable/14 source can't be build if you have following environment:
CC=clang19
CXX=clang++19
CPP=clang-cpp19

Here is short output:

--------------------------------------------------------------
>>> stage 4.3.1: building lib32 shim libraries
--------------------------------------------------------------
mtree -deUW -f /usr/src/etc/mtree/BSD.lib32.dist  -p /usr/obj/usr/src/amd64.amd64/tmp/usr >/dev/null
mtree -deUW -f /usr/src/etc/mtree/BSD.lib32.dist  -p /usr/obj/usr/src/amd64.amd64/tmp/usr/lib/debug/usr >/dev/null
cd /usr/src;  WORLDTMP=/usr/obj/usr/src/amd64.amd64/tmp  MAKEFLAGS="-m /usr/src/tools/build/mk  -m /usr/src/share/mk"  make -f Makefile.inc1  DESTDIR=  OBJTOP=/usr/obj/usr/src/amd64.amd64/obj-lib32  OBJROOT='${OBJTOP}/'  UNIVERSE_TOOLCHAIN_PATH=  MAKEOBJDIRPREFIX=  -DNO_LINT  -DNO_CPU_CFLAGS  MK_ASAN=no  MK_CTF=no  MK_RETPOLINE=no  MK_SSP=no  MK_UBSAN=no  MK_WERROR=no  _lc_build-tools
cd /usr/src/lib/ncurses/tinfo; make DIRPRFX=lib/ncurses/tinfo/ build-tools
cd /usr/src/lib/libmagic; make DIRPRFX=lib/libmagic/ build-tools
clang19 -O2 -pipe -fno-common -DMAGIC='"/usr/share/misc/magic"' -DHAVE_CONFIG_H -I/usr/src/lib/libmagic -I/usr/obj/usr/src/amd64.amd64/obj-lib32/lib/libmagic -I/usr/src/contrib/file/src  -DNDEBUG -g -gz=zlib -MD  -MF.depend.mkmagic -MTmkmagic -std=gnu99 -Wno-format-zero-length -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wdate-time -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member  -Qunused-arguments    -I/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include -DCOMPILE_ONLY  -Wl,-zrelro   -L/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/lib -o mkmagic  /usr/src/contrib/file/src/apprentice.c /usr/src/contrib/file/src/cdf_time.c /usr/src/contrib/file/src/encoding.c /usr/src/contrib/file/src/funcs.c /usr/src/contrib/file/src/magic.c /usr/src/contrib/file/src/print.c  -legacy
/bin/sh: clang19: not found
*** Error code 127

Stop.
make[3]: stopped in /usr/src/lib/libmagic
*** Error code 1

Stop.
make[2]: stopped in /usr/src
*** Error code 1

Stop.
make[1]: stopped in /usr/src
*** Error code 1

Stop.
make: stopped in /usr/src



root@classic:/usr/src # clang19 -v
clang version 19.1.3 (https://git.freebsd.org/ports.git a34c378a051d3df7767855bb37fc359924f4dcc1)
Target: x86_64-portbld-freebsd14.2
Thread model: posix
InstalledDir: /usr/local/llvm19/bin
Comment 1 Brooks Davis freebsd_committer freebsd_triage 2024-11-05 17:17:35 UTC
Setting CC/CXX/CPP to clang19 is not expected to work for buildworld.  It might work if you set the full path, but the supported way is to set CROSS_TOOLCHAIN=llvm19 which sources /usr/local/share/toolchains/llvm19.mk in the right places.

I'm not entirely sure why PATH is restricted this late in the build process, but clearly it is.

All that being said, I'm not sure all the build fixes have been MFCd so the build may still fail.
Comment 2 Jordan Ostreff 2024-11-06 12:00:16 UTC
(In reply to Brooks Davis from comment #1)
Thanks for your answer. Actually this means that I must not set this variables in my environment, when I want to build world/kernel.
Comment 3 Mark Johnston freebsd_committer freebsd_triage 2024-11-07 18:44:32 UTC
(In reply to Jordan Ostreff from comment #2)
That is correct.