Q: when compiling code with the latest release of this project, I get ld: warning: reexported library with install name '@rpath/libunwind.1.0.dylib' found at '/Users/ilg/Library/xPacks/@xpack-dev-tools/clang/21.1.8-1.1/.content/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly
Copilot:
Root cause
Apple's new ld-prime linker (shipped with Xcode 15+) enforces stricter validation of the re-export chain for libraries whose install name begins with @rpath. The xPack's libunwind.1.0.dylib uses @rpath/libunwind.1.0.dylib as its install name, and libc++abi.1.0.dylib declares a dependency on it via a plain LC_LOAD_DYLIB load command rather than LC_REEXPORT_DYLIB. When ld-prime resolves libunwind.1.0.dylib through the rpath, it cannot establish the expected parent–child relationship with libc++abi, and therefore emits:
ld: warning: reexported library with install name '@rpath/libunwind.1.0.dylib' … couldn't be matched with any parent library and will be linked directly
Fix applied (llvm.sh)
Added -DLIBCXXABI_REEXPORT_LIBUNWIND=ON to the Darwin-specific CMake options. This instructs the LLVM build to link libc++abi.dylib with -Wl,-reexport-lunwind, producing an LC_REEXPORT_DYLIB load command instead of LC_LOAD_DYLIB. With that in place, ld-prime can correctly identify libc++abi as the parent of libunwind and the warning disappears.
Workaround for the current release (21.1.8-1.1)
Until a new release is built with this fix, you can suppress the warning by passing -Wl,-no_warn_unused_dylibs or by avoiding the implicit -lunwind with -unwindlib=none when linking, though neither is a clean long-term solution. The proper resolution requires a rebuild with the CMake flag above.
Q: when compiling code with the latest release of this project, I get ld: warning: reexported library with install name '@rpath/libunwind.1.0.dylib' found at '/Users/ilg/Library/xPacks/@xpack-dev-tools/clang/21.1.8-1.1/.content/lib/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly
Copilot:
Root cause
Apple's new ld-prime linker (shipped with Xcode 15+) enforces stricter validation of the re-export chain for libraries whose install name begins with @rpath. The xPack's libunwind.1.0.dylib uses @rpath/libunwind.1.0.dylib as its install name, and libc++abi.1.0.dylib declares a dependency on it via a plain LC_LOAD_DYLIB load command rather than LC_REEXPORT_DYLIB. When ld-prime resolves libunwind.1.0.dylib through the rpath, it cannot establish the expected parent–child relationship with libc++abi, and therefore emits:
ld: warning: reexported library with install name '@rpath/libunwind.1.0.dylib' … couldn't be matched with any parent library and will be linked directly
Fix applied (llvm.sh)
Added -DLIBCXXABI_REEXPORT_LIBUNWIND=ON to the Darwin-specific CMake options. This instructs the LLVM build to link libc++abi.dylib with -Wl,-reexport-lunwind, producing an LC_REEXPORT_DYLIB load command instead of LC_LOAD_DYLIB. With that in place, ld-prime can correctly identify libc++abi as the parent of libunwind and the warning disappears.
Workaround for the current release (21.1.8-1.1)
Until a new release is built with this fix, you can suppress the warning by passing -Wl,-no_warn_unused_dylibs or by avoiding the implicit -lunwind with -unwindlib=none when linking, though neither is a clean long-term solution. The proper resolution requires a rebuild with the CMake flag above.