Skip to content

libXCTest.so on Linux has no RUNPATH #432

Open
@gwynne

Description

When building on Linux, the libXCTest.so which is installed in /usr/lib/swift/linux/ ends up with no RUNPATHs whatsoever, neither $ORIGIN nor the toolchain's lib install directory. This has the effect of enforcing an entirely artificial link-ordering dependency when building Linux xctest executables due to its dependency on libswift_RegexParser. Control over link ordering is not generally available via SwiftPM, and is in fact actively discouraged by the default usage of swift-autolink-extract. Add to this that there is no attempt even by XCTest itself to guarantee its own build ordering, having relied for some time now on accident and luck to hide the problem, and its seem fairly obvious that the ordering dependency is both unintentional and undesirable.

I'm not clear enough on how the Linux toolchain is set up to understand whether the fix is to add a $ORIGIN rpath, to remove the -no-toolchain-stdlib-rpath flag from the XCTest CMake build (both of which successfully solved the linkage problem when I tried them), or some other approach.

This issue was revealed by swiftlang/swift#64312; specific details are given by swiftlang/swift#64312 (comment) and swiftlang/swift#64312 (comment).

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions