Bug 252065 - native-xtools-install doesn't install libclang_rt.profile-aarch64.a
Summary: native-xtools-install doesn't install libclang_rt.profile-aarch64.a
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-toolchain (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-23 05:47 UTC by Steve Wills
Modified: 2021-01-24 02:51 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Wills freebsd_committer 2020-12-23 05:47:52 UTC
While looking at a qemu issue, I noticed that my poudriere jail for aarch64 has a nxb-bin/usr/lib/clang/11.0.0/lib/freebsd directory, but it's empty, leading to a build failure like:

[00:00:40] /usr/local/bin/ld: cannot find /nxb-bin/usr/lib/clang/11.0.0/lib/freebsd/libclang_rt.profile-aarch64.a: No such file or directory

Simply copying the usr/lib/clang/11.0.0/lib/freebsd/libclang_rt.profile-aarch64.a to it seems to solve the issue.

I don't understand the native-xtools-install target well enough to know why it isn't copied right now, maybe someone can take a look?
Comment 1 Dimitry Andric freebsd_committer 2021-01-01 14:46:43 UTC
lib/Makefile has:

# The libraries under libclang_rt can only be built by clang, and only make
# sense to build when clang is enabled at all.  Furthermore, they can only be
# built for certain architectures.
.if ${MK_CLANG} != "no" && ${COMPILER_TYPE} == "clang" && \
    (${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
    ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "i386" || \
    ${MACHINE_CPUARCH} == "powerpc")
_libclang_rt=   libclang_rt
.endif

while the top-level Makefile.inc1 has:

native-xtools: .PHONY
        ${_+_}cd ${.CURDIR}; ${NXBTMAKE} _cleanobj
        # Build the bootstrap/host/cross tools that produce native binaries
        ${_+_}cd ${.CURDIR}; ${NXBTMAKE} kernel-toolchain
        # Populate includes/libraries sysroot that produce native binaries.
        # This is split out from 'toolchain' above mostly so that target LLVM
        # libraries have a proper LLVM_DEFAULT_TARGET_TRIPLE without
        # polluting the cross-compiler build.  The LLVM/GCC libs are skipped
        # here to avoid the problem but are kept in 'toolchain' so that
        # needed build tools are built.
        ${_+_}cd ${.CURDIR}; ${NXBTMAKE} _includes MK_CLANG=no
        ${_+_}cd ${.CURDIR}; ${NXBTMAKE} _libraries MK_CLANG=no
        [...]

It looks like the MK_CLANG=no was added on purpose, precisely to avoid populating the lib/clang/x.y.z directory. I do not fully understand the reasoning mentioned in the comment about "avoiding the problem".

Bryan added this part in base r325001, so maybe he can shed some light.