Bug 291409 - native-xtools fails to build on 15.0-RELEASE for arm64 (libprivatellvm.so missing)
Summary: native-xtools fails to build on 15.0-RELEASE for arm64 (libprivatellvm.so mis...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 15.0-RELEASE
Hardware: amd64 Any
: --- Affects Some People
Assignee: Mitchell Horne
URL: https://reviews.freebsd.org/D54815
Keywords:
: 293126 (view as bug list)
Depends on:
Blocks:
 
Reported: 2025-12-05 02:17 UTC by David Zuckerman
Modified: 2026-05-11 17:21 UTC (History)
8 users (show)

See Also:


Attachments
make native-xtools build log (686.01 KB, application/x-compressed)
2025-12-05 02:17 UTC, David Zuckerman
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Zuckerman 2025-12-05 02:17:57 UTC
Created attachment 265864 [details]
make native-xtools build log

Attempting to build native-xtools on amd64 15.0-RELEASE for arm64 fails with an error that libprivatellvm.so is missing.  The full build log is attached.  Here's the section where the error occurs:

--- llvm-ar ---
c++ -target x86_64-unknown-freebsd15.0 --sysroot=/usr/obj/aarch64/usr/src/amd64.amd64/nxb/arm64.aarch64/tmp -B/usr/obj/aarch64/usr/src/amd64.amd64/nxb/arm64.aarch64/tmp/usr/bin -O2 -pipe -fno-common -I/usr/obj/aarch64/usr/src/amd64.amd64/nxb/arm64.aarch64/lib/clang/libllvm -I/usr/src/lib/clang/include -I/usr/src/contrib/llvm-project/llvm/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DHAVE_VCS_VERSION_INC -DNDEBUG -DLLVM_DEFAULT_TARGET_TRIPLE=\"aarch64-unknown-freebsd15.0\" -DLLVM_HOST_TRIPLE=\"x86_64-unknown-freebsd15.0\" -DDEFAULT_SYSROOT=\"\" -DLLVM_TARGET_ENABLE_AARCH64 -DLLVM_TARGET_ENABLE_ARM -DLLVM_TARGET_ENABLE_POWERPC -DLLVM_TARGET_ENABLE_RISCV -DLLVM_TARGET_ENABLE_X86 -DLLVM_NATIVE_ASMPARSER=LLVMInitializeX86AsmParser -DLLVM_NATIVE_ASMPRINTER=LLVMInitializeX86AsmPrinter -DLLVM_NATIVE_DISASSEMBLER=LLVMInitializeX86Disassembler -DLLVM_NATIVE_TARGET=LLVMInitializeX86Target -DLLVM_NATIVE_TARGETINFO=LLVMInitializeX86TargetInfo -DLLVM_NATIVE_TARGETMC=LLVMInitializeX86TargetMC -ffunction-sections -fdata-sections -ffile-prefix-map=/usr/src=/usr/src -ffile-prefix-map=/usr/obj/aarch64/usr/src/amd64.amd64/nxb=/usr/obj -Wno-format-zero-length -Wdate-time -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-parameter -Wno-error=cast-function-type-mismatch -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses -Qunused-arguments -fno-exceptions -fno-rtti -ffile-prefix-map=/usr/src=/usr/src -ffile-prefix-map=/usr/obj/aarch64/usr/src/amd64.amd64/nxb=/usr/obj -std=c++17 -stdlib=libc++  -Wl,--gc-sections -Wl,-zrelro -static    -o llvm-ar  llvm-ar-driver.o llvm-ar.o /usr/obj/aarch64/usr/src/amd64.amd64/nxb/arm64.aarch64/lib/clang/libllvm/libprivatellvm.so  -lz  -lprivatezstd    -lcompiler_rt   -lcompiler_rt   -lcompiler_rt  -lexecinfo  -lelf  -ltinfow    -lcompiler_rt   -lcompiler_rt   -lcompiler_rt -lpthread -lc -lsys
c++: error: no such file or directory: '/usr/obj/aarch64/usr/src/amd64.amd64/nxb/arm64.aarch64/lib/clang/libllvm/libprivatellvm.so'
*** [llvm-ar] Error code 1

make[5]: stopped making "all" in /usr/src/usr.bin/clang/llvm-ar
make[5]: 1 error

make[5]: stopped making "all" in /usr/src/usr.bin/clang/llvm-ar

make[4]: stopped making "all" in /usr/src/usr.bin/clang
--- all_subdir_usr.bin/clang/llvm-nm ---

make[4]: stopped making "all" in /usr/src/usr.bin/clang
--- all_subdir_usr.bin/clang/clang ---

make[4]: stopped making "all" in /usr/src/usr.bin/clang
--- all_subdir_usr.bin/clang/clang-scan-deps ---

make[4]: stopped making "all" in /usr/src/usr.bin/clang

This is on amd64 15.0-RELEASE building for arm64 with make.conf, src.conf, and src-env.conf all empty.  I can reproduce the problem consistently with the following command:

/usr/src # env -i MAKEOBJDIRPREFIX=/usr/obj/aarch64 make -j 4 TARGET=arm64 TARGET_ARCH=aarch64 native-xtools
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2025-12-05 19:28:17 UTC
Adding bdrewery on cc since he seems to have been involved with the native-xtools target. I don't know much about this target, nor have I ever used it except just today. :)

I assume this breakage was introduced when libllvm and libclang turned into shared libraries. At the end of the build log you can see that it attempts to link against libprivatellvm.so, which has not yet been built.

So either the native-xtools target should build those shared libraries, or it should link against the static libllvm.a and libclang.a, which have been built during the cross-tools stage.
Comment 2 David Zuckerman 2025-12-05 21:38:54 UTC
After doing some more searching, I found two other PRs that reported the same issue in the context of poudriere jail creation, albeit targeting riscv instead of arm64 (bug #286710 and bug #290193). Bug #286710 isolated the problem to the shared library commit mentioned by Dimitry, so his analysis appears to be correct. I also discovered this bug by creating a poudriere jail for building arm64 on amd64, and then I tried to just make native-xtools by itself to confirm the problem wasn't with poudriere.
Comment 3 Warner Losh freebsd_committer freebsd_triage 2025-12-05 22:00:15 UTC
(In reply to Dimitry Andric from comment #1)
I think it should likely just link against the static versions. How hard is that to arrange?

But you have used these targets before. You helped me and others fix the targets when we cut over from gcc to clang :).
Comment 4 Mitchell Horne freebsd_committer freebsd_triage 2026-01-21 18:30:09 UTC
(In reply to Warner Losh from comment #3)

Quite simple to revert to linking against the static versions, see the linked review.

I think the only annoyance here will be applying this to the releng/15.0 branch.
Comment 5 Craig Leres freebsd_committer freebsd_triage 2026-01-21 19:54:18 UTC
I just tested building a poudriere jail without and with D54815; both fail pretty much the same way. My build tree is 44f3e9f7f6c9, I'm trying to create a jail to build packages for pfsense 25.11 as per:

    https://docs.netgate.com/pfsense/en/latest/releases/versions.html#x

(that page says 16.0-CURRENT but markj told me "There's no 16 branch since that release doesn't exist yet.")

The command I used was:

    poudriere jail -x -c -j pfsense2511 -a arm64.aarch64 -m src=/usr/src/16-CURRENT -b

The build with D54815 ends with:

make[4]: stopped in /usr/local/poudriere/jails/pfsense2511/usr/src/usr.bin/clang
--- all_subdir_usr.bin/clang/clang ---
c++: error: no such file or directory: '/usr/obj/usr/local/poudriere/jails/pfsense2511/usr/src/amd64.amd64/nxb/arm64.aarch64/lib/clang/libllvm/libprivatellvm.so'
*** [clang] Error code 1

make[5]: stopped in /usr/local/poudriere/jails/pfsense2511/usr/src/usr.bin/clang/clang
1 error

make[5]: stopped in /usr/local/poudriere/jails/pfsense2511/usr/src/usr.bin/clang/clang

make[4]: stopped in /usr/local/poudriere/jails/pfsense2511/usr/src/usr.bin/clang
--- all_subdir_usr.bin/clang/lld ---

make[4]: stopped in /usr/local/poudriere/jails/pfsense2511/usr/src/usr.bin/clang

make[3]: stopped in /usr/local/poudriere/jails/pfsense2511/usr/src
        0.63 real         3.38 user         1.12 sys

make[2]: stopped in /usr/local/poudriere/jails/pfsense2511/usr/src
*** [native-xtools] Error code 2

make[1]: stopped in /usr/local/poudriere/jails/pfsense2511/usr/src
1 error

make[1]: stopped in /usr/local/poudriere/jails/pfsense2511/usr/src

make: stopped in /usr/local/poudriere/jails/pfsense2511/usr/src
[00:02:24] Error: Failed to 'make native-xtools' in /usr/local/poudriere/jails/pfsense2511/usr/src
[00:02:24] Error while creating jail, cleaning up.
[00:02:24] Removing pfsense2511 jail... done
Comment 6 Mitchell Horne freebsd_committer freebsd_triage 2026-01-23 16:34:46 UTC
(In reply to Craig Leres from comment #5)

To be clear, where did you apply the patch? It should be applied to the target source tree, that is /usr/src/16-CURRENT in your example. Also you'll want to ensure any leftovers from previous attempts in /usr/obj are cleaned up.

Does this simpler test case succeed?:

# cd /usr/src/16-CURRENT (with D54815 applied)
# make TARGET=arm64 -j $whatever native-xtools
Comment 7 David Zuckerman 2026-01-23 17:17:54 UTC
Still fails for me with the patched Makefile.inc1 using the same command to build native-xtools.  I made sure that /usr/obj/aarch64 was empty and disabled ccache and WITH_META_MODE.  This is on releng/15.0.

/usr/src # env -i MAKEOBJDIRPREFIX=/usr/obj/aarch64 make -j 4 TARGET=arm64 TARGET_ARCH=aarch64 native-xtools

[...]

--- llvm-ar ---
c++ -target x86_64-unknown-freebsd15.0 --sysroot=/usr/obj/aarch64/usr/src/amd64.amd64/nxb/arm64.aarch64/tmp -B/usr/obj/aarch64/usr/src/amd64.amd64/nxb/arm64.aarch64/tmp/usr/bin -O2 -pipe -fno-common -I/usr/obj/aarch64/usr/src/amd64.amd64/nxb/arm64.aarch64/lib/clang/libllvm -I/usr/src/lib/clang/include -I/usr/src/contrib/llvm-project/llvm/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DHAVE_VCS_VERSION_INC -DNDEBUG -DLLVM_DEFAULT_TARGET_TRIPLE=\"aarch64-unknown-freebsd15.0\" -DLLVM_HOST_TRIPLE=\"x86_64-unknown-freebsd15.0\" -DDEFAULT_SYSROOT=\"\" -DLLVM_TARGET_ENABLE_AARCH64 -DLLVM_TARGET_ENABLE_ARM -DLLVM_TARGET_ENABLE_POWERPC -DLLVM_TARGET_ENABLE_RISCV -DLLVM_TARGET_ENABLE_X86 -DLLVM_NATIVE_ASMPARSER=LLVMInitializeX86AsmParser -DLLVM_NATIVE_ASMPRINTER=LLVMInitializeX86AsmPrinter -DLLVM_NATIVE_DISASSEMBLER=LLVMInitializeX86Disassembler -DLLVM_NATIVE_TARGET=LLVMInitializeX86Target -DLLVM_NATIVE_TARGETINFO=LLVMInitializeX86TargetInfo -DLLVM_NATIVE_TARGETMC=LLVMInitializeX86TargetMC -ffunction-sections -fdata-sections -ffile-prefix-map=/usr/src=/usr/src -ffile-prefix-map=/usr/obj/aarch64/usr/src/amd64.amd64/nxb=/usr/obj -Wno-format-zero-length -Wdate-time -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-parameter -Wno-error=cast-function-type-mismatch -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses -Qunused-arguments -fno-exceptions -fno-rtti -ffile-prefix-map=/usr/src=/usr/src -ffile-prefix-map=/usr/obj/aarch64/usr/src/amd64.amd64/nxb=/usr/obj -std=c++17 -stdlib=libc++  -Wl,--gc-sections -Wl,-zrelro -static    -o llvm-ar  llvm-ar-driver.o llvm-ar.o /usr/obj/aarch64/usr/src/amd64.amd64/nxb/arm64.aarch64/lib/clang/libllvm/libprivatellvm.so  -lz  -lprivatezstd    -lcompiler_rt   -lcompiler_rt   -lcompiler_rt  -lexecinfo  -lelf  -ltinfow    -lcompiler_rt   -lcompiler_rt   -lcompiler_rt -lpthread -lc -lsys
c++: error: no such file or directory: '/usr/obj/aarch64/usr/src/amd64.amd64/nxb/arm64.aarch64/lib/clang/libllvm/libprivatellvm.so'
*** [llvm-ar] Error code 1

make[5]: stopped making "all" in /usr/src/usr.bin/clang/llvm-ar
make[5]: 1 error

make[5]: stopped making "all" in /usr/src/usr.bin/clang/llvm-ar

make[4]: stopped making "all" in /usr/src/usr.bin/clang
--- all_subdir_usr.bin/clang/clang ---

make[4]: stopped making "all" in /usr/src/usr.bin/clang
--- all_subdir_usr.bin/clang/llvm-nm ---

make[4]: stopped making "all" in /usr/src/usr.bin/clang
--- all_subdir_usr.bin/clang/clang-scan-deps ---

make[4]: stopped making "all" in /usr/src/usr.bin/clang

make[3]: stopped making "all" in /usr/src
      166.61 real       537.55 user        34.64 sys

make[2]: stopped making "everything" in /usr/src
*** [native-xtools] Error code 2

make[1]: stopped making "native-xtools" in /usr/src
make[1]: 1 error

make[1]: stopped making "native-xtools" in /usr/src

make: stopped making "native-xtools" in /usr/src
Comment 8 Craig Leres freebsd_committer freebsd_triage 2026-01-23 20:36:18 UTC
(In reply to Mitchell Horne from comment #6)
I applied the patch to the /usr/src/16-CURRENT tree; my assumption was that "-m src=..." would cause poudriere to forget all about /usr/src.

I just tried this again. After nuking /usr/obj and /var/cache/ccache (duh) I ran:

    poudriere jail -x -c -j pfsense2511 -a arm64.aarch64 -m src=/usr/src/16-CURRENT -b

It still fails for me in the same way.

make[3]: stopped in /usr/local/poudriere/jails/pfsense2511/usr/src
       52.57 real       811.81 user       105.41 sys

make[2]: stopped in /usr/local/poudriere/jails/pfsense2511/usr/src
*** [native-xtools] Error code 2

make[1]: stopped in /usr/local/poudriere/jails/pfsense2511/usr/src
1 error

make[1]: stopped in /usr/local/poudriere/jails/pfsense2511/usr/src

make: stopped in /usr/local/poudriere/jails/pfsense2511/usr/src
[00:54:22] Error: Failed to 'make native-xtools' in /usr/local/poudriere/jails/pfsense2511/usr/src
[00:54:22] Error while creating jail, cleaning up.
[00:54:22] Removing pfsense2511 jail... done
user=116792.161 sec, system=9962.982 sec, elapsed=54:23.12, cpu use=3884.4%,
0 swaps, 760912629 minor faults, 233477 major faults, 111202 reads, 2044611 writes,
average size: 73920 shared 1923 unshared 75844 total, max: 1806088 * 2
Comment 9 commit-hook freebsd_committer freebsd_triage 2026-01-26 15:14:46 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=38e5564ecef53064c984d086a040c01100023f40

commit 38e5564ecef53064c984d086a040c01100023f40
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2026-01-26 14:58:55 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2026-01-26 15:12:30 +0000

    native-xtools: use static LLVM libraries

    Set the MK_LLVM_LINK_STATIC_LIBRARIES knob to "yes" when building the
    native-xtools target. This reverts to the behaviour prior to
    2e47f35be5dc.

    This avoids a build failure that occurs otherwise, where compilation
    fails looking for a libllvmprivate.so that was not built.

    It is unclear if this addresses the issue in all instances---some
    replies in the PRs indicate otherwise. Still, some report success, and
    in my own testing this fixed creation of a cross-compiled poudriere
    jail. Commit this while we continue to investigate...

    PR:             286710, 291409
    Tested by:      marck, rdunkle@smallcatbrain.com
    Reviewed by:    emaste
    MFC after:      3 days
    Fixes:  2e47f35be5dc ("Convert libllvm, libclang and liblldb into private shared libraries").
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D54815

 Makefile.inc1 | 1 +
 1 file changed, 1 insertion(+)
Comment 10 Mitchell Horne freebsd_committer freebsd_triage 2026-01-26 15:22:11 UTC
(In reply to David Zuckerman from comment #7)
(In reply to Craig Leres from comment #8)

Thanks David and Craig for your testing and reports so far. I am not yet sure why it is working for some but not in your cases...

I will continue testing and see if I can reproduce on a 15.0-RELEASE host. So far my build host has been on 16-CURRENT.

Craig, which FreeBSD version is your build host running?
Comment 11 Craig Leres freebsd_committer freebsd_triage 2026-01-26 18:04:09 UTC
(In reply to Mitchell Horne from comment #10)
My build server is running 14.3-RELEASE-p7. The root filesystem is zfs on six nvme drives (stripe across three 2-disk mirrors).

First, there is no 16.0 yet, the reference to it comes from here:

    https://docs.netgate.com/pfsense/en/latest/releases/versions.html
    25.11 - 16.0-CURRENT@44f3e9f7f6c9

(I just submitted feedback so hopefully they'll correct this.)

Next, could you folks who can successfully build poudriere 15.X jails from source  please provide details (such as a git hash)?

Finally, please see if you can build 44f3e9f7f6c9 (with the patch from D54815) with something similar to:

    poudriere jail -x -c -j pfsense2511 -a arm64.aarch64 -m src=/usr/src/16-CURRENT -b
Comment 12 Craig Leres freebsd_committer freebsd_triage 2026-01-26 18:08:16 UTC
(In reply to Craig Leres from comment #11)
netgate says that 25.11 is based on FreeBSD-CURRENT which self identifies as 16-CURRENT.
Comment 13 Mitchell Horne freebsd_committer freebsd_triage 2026-01-26 20:42:25 UTC
(In reply to Craig Leres from comment #11)

Ahh okay, this helps. 44f3e9f7f6c9 is before commit 4e4af7a56609, which is needed for D54815 to have any effect.

From a base of commit 44f3e9f7f6c9, with 4e4af7a56609 and D54815 applied, I got a successful build of native-xtools target (I skipped compiling the entire jail).

So please try with 4e4af7a56609 as well. Note that there was a small merge conflict when cherry-picking, but only to a man-page, which is inconsequential here.
Comment 14 Craig Leres freebsd_committer freebsd_triage 2026-01-27 00:44:03 UTC
(In reply to Mitchell Horne from comment #13)
I suck at git.

I cannot find 4e4af7a56609:

    zinc 65 # pwd
    /usr/src/16-CURRENT
    zinc 66 # git branch
    * main
    zinc 67 # git pull
    Already up to date.
    zinc 68 # git log 4e4af7a56609
    fatal: ambiguous argument '4e4af7a56609': unknown revision or path not in the working tree.
    Use '--' to separate paths from revisions, like this:
    'git <command> [<revision>...] -- [<file>...]'

I also looked in stable/14 and stable/15

I know how to download the raw patch for D54815, how would I do it for 4e4af7a56609? (BTW, it looks like 38e5564ecef5 is the commit from D54815.)

I just tried building a jail with 6253212608b4 (from today) which I see has the fix from D54815. It built!
Comment 15 Mitchell Horne freebsd_committer freebsd_triage 2026-01-28 14:37:52 UTC
(In reply to Craig Leres from comment #14)

Forgive me, I grabbed the wrong hash by mistake.

This is the commit that is needed:
https://cgit.freebsd.org/src/commit/?id=8d5a11cd0137d3ad70f6b06e063ea91a776d510a

There is a link there to the raw patch if needed.

Sorry for the added confusion.
Comment 16 Craig Leres freebsd_committer freebsd_triage 2026-01-28 20:41:49 UTC
(In reply to Mitchell Horne from comment #15)
Here's what I did:

    cd /usr/src/16-CURRENT
    git checkout main
    git pull
    git checkout 44f3e9f7f6c9
    fetch -o /tmp/p1 'https://cgit.freebsd.org/src/patch/?id=8d5a11cd0137d3ad70f6b06e063ea91a776d510a'
    patch < /tmp/p1
    # ignore share/man/man5/src.conf.5.rej
    # ignore lib/clang/libllvm/Makefile.rej 
    (failure to remove a line no longer there)
    fetch -o /tmp/p2 'https://reviews.freebsd.org/file/data/mhc2tz6zgqeaiweht3kj/PHID-FILE-cwe2vp3asl7e2vhadxy5/D54815.diff'
    patch < /tmp/p2
    rm -rf /usr/obj/usr/local/poudriere/jails/pfsense2511
    poudriere jail -x -c -j pfsense2511 -a arm64.aarch64 -m src=/usr/src/16-CURRENT -b

The first attempt failed:

    cc: error: no such file or directory: '/usr/local/poudriere/jails/pfsense2511/usr/src/lib/libc/aarch64/string/memset.S'
    cc: error: no input files
    --- glue.pico ---
    --- gdtoa_strtorQ.pico ---
    --- memset.pico ---
    *** [memset.pico] Error code 1
 
    make[4]: stopped in /usr/local/poudriere/jails/pfsense2511/usr/src/lib/libc
 
So I tried again. That one worked!

    [01:02:10] Jail pfsense2511 16.0-CURRENT 1600001 arm64.aarch64 is ready to be used

So to build from 44f3e9f7f6c9 you need 8d5a11cd0137 and 38e5564ecef5
Comment 17 Craig Leres freebsd_committer freebsd_triage 2026-01-28 21:20:49 UTC
(In reply to Craig Leres from comment #16)
Hum... I just tried to use the new jail and I get:

    [00:00:02] Error: Unable to execute id(1) in jail. Emulation or ABI wrong.

I understand what I'm doing is unsupported (the build host is 14.3):

    [00:00:00] Cross-building ports for arm64.aarch64 on amd64 requires QEMU
    [00:00:00] Creating the reference jail... done
    [00:00:00] Warning: !!! Jail is newer than host. (Jail: 1600001, Host: 1403000) !!!
    [00:00:00] Warning: This is not supported.
    [00:00:00] Warning: Host kernel must be same or newer than jail.
    [00:00:00] Warning: Expect build failures.

but this *used* to work!

Anybody see what I'm doing wrong?
Comment 18 David Zuckerman 2026-01-29 02:36:43 UTC
I'll try applying the two commits on a fresh install of 15.0-RELEASE this weekend.  Any chance there will be an errata update issued for 15.0?
Comment 19 commit-hook freebsd_committer freebsd_triage 2026-01-30 16:59:29 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=78274fd36e3f0521a9c84e335d7d4f2f86cb97cc

commit 78274fd36e3f0521a9c84e335d7d4f2f86cb97cc
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2026-01-26 14:58:55 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2026-01-30 16:59:00 +0000

    native-xtools: use static LLVM libraries

    Set the MK_LLVM_LINK_STATIC_LIBRARIES knob to "yes" when building the
    native-xtools target. This reverts to the behaviour prior to
    2e47f35be5dc.

    This avoids a build failure that occurs otherwise, where compilation
    fails looking for a libllvmprivate.so that was not built.

    It is unclear if this addresses the issue in all instances---some
    replies in the PRs indicate otherwise. Still, some report success, and
    in my own testing this fixed creation of a cross-compiled poudriere
    jail. Commit this while we continue to investigate...

    PR:             286710, 291409
    Tested by:      marck, rdunkle@smallcatbrain.com
    Reviewed by:    emaste
    MFC after:      3 days
    Fixes:  2e47f35be5dc ("Convert libllvm, libclang and liblldb into private shared libraries").
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D54815

    (cherry picked from commit 38e5564ecef53064c984d086a040c01100023f40)

 Makefile.inc1 | 1 +
 1 file changed, 1 insertion(+)
Comment 20 Dmitry Morozovsky freebsd_committer freebsd_triage 2026-01-31 17:14:46 UTC
(In reply to commit-hook from comment #19)

Mitchell,

could you please MFC this change to 14 and 13 too? 14 especially as it's in preparing to RELEASE

Thanks you!
Comment 21 commit-hook freebsd_committer freebsd_triage 2026-02-02 15:45:29 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=ea2d344362867b22a1a13b2af984570d93a49687

commit ea2d344362867b22a1a13b2af984570d93a49687
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2026-01-26 14:58:55 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2026-02-02 15:43:13 +0000

    native-xtools: use static LLVM libraries

    Set the MK_LLVM_LINK_STATIC_LIBRARIES knob to "yes" when building the
    native-xtools target. This reverts to the behaviour prior to
    2e47f35be5dc.

    This avoids a build failure that occurs otherwise, where compilation
    fails looking for a libllvmprivate.so that was not built.

    It is unclear if this addresses the issue in all instances---some
    replies in the PRs indicate otherwise. Still, some report success, and
    in my own testing this fixed creation of a cross-compiled poudriere
    jail. Commit this while we continue to investigate...

    PR:             286710, 291409
    Tested by:      marck, rdunkle@smallcatbrain.com
    Reviewed by:    emaste
    MFC after:      3 days
    Fixes:  2e47f35be5dc ("Convert libllvm, libclang and liblldb into private shared libraries").
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D54815

    (cherry picked from commit 38e5564ecef53064c984d086a040c01100023f40)

 Makefile.inc1 | 1 +
 1 file changed, 1 insertion(+)
Comment 22 commit-hook freebsd_committer freebsd_triage 2026-02-02 15:45:36 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=cc9d0192edfde5b7b66e9a7c81dca7c5d230eac7

commit cc9d0192edfde5b7b66e9a7c81dca7c5d230eac7
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2026-01-26 14:58:55 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2026-02-02 15:44:19 +0000

    native-xtools: use static LLVM libraries

    Set the MK_LLVM_LINK_STATIC_LIBRARIES knob to "yes" when building the
    native-xtools target. This reverts to the behaviour prior to
    2e47f35be5dc.

    This avoids a build failure that occurs otherwise, where compilation
    fails looking for a libllvmprivate.so that was not built.

    It is unclear if this addresses the issue in all instances---some
    replies in the PRs indicate otherwise. Still, some report success, and
    in my own testing this fixed creation of a cross-compiled poudriere
    jail. Commit this while we continue to investigate...

    PR:             286710, 291409
    Tested by:      marck, rdunkle@smallcatbrain.com
    Reviewed by:    emaste
    MFC after:      3 days
    Fixes:  2e47f35be5dc ("Convert libllvm, libclang and liblldb into private shared libraries").
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D54815

    (cherry picked from commit 38e5564ecef53064c984d086a040c01100023f40)

 Makefile.inc1 | 1 +
 1 file changed, 1 insertion(+)
Comment 23 Mitchell Horne freebsd_committer freebsd_triage 2026-02-02 15:52:53 UTC
(In reply to Dmitry Morozovsky from comment #20)

Thanks-- they are now merged to all stable branches. In particular it will be present in releng/14.4 when created.

(In reply to David Zuckerman from comment #18)

I need to inquire. Since this is part of the build logic, it doesn't fit the typical scheme for an errata. But I will attempt to get it merged to the releng/15.0 branch.

(In reply to Craig Leres from comment #17)

I am not sure. Perhaps this time there is too great of a disparity between the host and the target jail.
Comment 24 David Zuckerman 2026-02-02 17:07:18 UTC
(In reply to Mitchell Horne from comment #23)
I successfully built native-xtools on a 15.0-RELEASE-p2 VM after applying the two patches.  It would be great if both patches could be merged to releng/15.0, but I should be able to push them to my poudriere build server if issuing an errata isn't possible.  Thanks!
Comment 25 wcarson.bugzilla 2026-03-09 15:57:48 UTC
Is there a patch I can apply to my 15.0-RELEASE-p4 amd64 system so that I can create a 15.0-RELEASE arm64.aarch64 poudriere jail?
Comment 26 Xin LI freebsd_committer freebsd_triage 2026-04-11 00:40:56 UTC
*** Bug 293126 has been marked as a duplicate of this bug. ***
Comment 27 Mitchell Horne freebsd_committer freebsd_triage 2026-05-11 17:21:28 UTC
(In reply to wcarson.bugzilla from comment #25)

This should work, if you did not solve it yet:
https://cgit.freebsd.org/src/patch/Makefile.inc1?id=78274fd36e3f0521a9c84e335d7d4f2f86cb97cc

I did not get the commit merged into releng/15.0 branch. But it is in stable/15 and the upcoming releng/15.1.

Closing now!