Skip to content

Workaround Cxx static interop modules not being in the correct directory for --static-swift-stdlib #198

Open
@xtremekforever

Description

@xtremekforever

This issue filed in swiftlang/swift finds that the libswiftCxx.a and libswiftCxxStdlib.a libraries are installed in usr/lib/swift/linux instead of the correct directory of usr/lib/swift_static/linux. This causes the use of the --static-swift-stdlib flag to not work for projects that are enabled for C++ interop:

$ swift build --swift-sdk 6.0.3-RELEASE_ubuntu_jammy_aarch64 -Xswiftc -cxx-interoperability-mode=default --static-swift-stdlib
Building for debugging...
error: link command failed with exit code 1 (use -v to see invocation)
ld.lld: error: unable to find library -lswiftCxx
ld.lld: error: unable to find library -lswiftCxxStdlib
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
error: fatalError
[5/6] Linking swift-hello

This has apparently been present in various versions of Swift and has not been fixed yet, so my proposal is to work around this issue temporarily in generated Swift SDKs by manually moving the libswiftCxx.a and libswiftCxxStdlib.a into the swift_static/linux directory to avoid this issue, since we know it is a problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions