Page MenuHomeFreeBSD

tools/build: Work around broken Clang FreeBSD resource dir logic pre-13
ClosedPublic

Authored by jrtc27 on Jul 31 2023, 1:18 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Mar 9, 9:10 PM
Unknown Object (File)
Mon, Mar 2, 12:06 PM
Unknown Object (File)
Sun, Mar 1, 10:17 PM
Unknown Object (File)
Sun, Mar 1, 10:03 PM
Unknown Object (File)
Sun, Mar 1, 10:03 PM
Unknown Object (File)
Feb 9 2026, 8:28 AM
Unknown Object (File)
Jan 31 2026, 11:52 AM
Unknown Object (File)
Jan 17 2026, 10:27 AM
Subscribers

Details

Summary

Prior to Clang 13 (e.g. in the Clang 11 present in 13.0-RELEASE), the
resource directory logic for FreeBSD was broken and would not resolve
symlinks, meaning symlinks would only work if in a directory next to the
containing lib directory. Therefore we cannot even use a symlink for
worldtmp, we have to make a wrapper script that execs the real binary
via an absolute path.

Reported by: markj
Fixes: 65f28f63a73d ("tools/build: Create toolchain symlinks for non-absolute compiler/linker")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 52895
Build 49786: arc lint + arc unit

Event Timeline

Thanks, this fixes the build error for me.

The diff seems reasonable, though pushing each compiler invocation through this wrapper might have a measurable cost. Though, that only affects the first portion of the world build I think? Would it make sense to limit the workaround to clang before version 13?

This revision is now accepted and ready to land.Jul 31 2023, 1:47 AM
This revision now requires review to proceed.Jul 31 2023, 1:56 AM

Thanks, this fixes the build error for me.

The diff seems reasonable, though pushing each compiler invocation through this wrapper might have a measurable cost. Though, that only affects the first portion of the world build I think? Would it make sense to limit the workaround to clang before version 13?

Depends if you force world to be built with the system compiler or not, as I believe it'll end up using the wrappers in that case. Regardless, it's easy enough to limit it, which seems like a good thing to do for this kind of hack.

This version works for me too.

This revision is now accepted and ready to land.Jul 31 2023, 12:53 PM