Skip to content

[Linux] Provide a statically linked swift-backtrace binary. #68905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 3, 2023

Conversation

al45tair
Copy link
Contributor

@al45tair al45tair commented Oct 2, 2023

This adds a new binary, swift-backtrace-static, to the build. The runtime will not by default use this binary as the backtracer, but if you want to statically link your own binaries against the standard library you can copy swift-backtrace-static rather than swift-backtrace alongside your binary, naming it swift-backtrace, and the runtime should find and use it, which will mean you don't need to have libswiftCore.so et al installed.

rdar://115278959

This adds a new binary, `swift-backtrace-static`, to the build.  The runtime
will not by default use this binary as the backtracer, but if you want to
statically link your own binaries against the standard library you can copy
`swift-backtrace-static` rather than `swift-backtrace` alongside your binary,
naming it `swift-backtrace`, and the runtime should find and use it, which
will mean you don't need to have `libswiftCore.so` et al installed.

rdar://115278959
This was causing `swift-backtrace` to crash when linked with the static
version of the runtime, because the runtime then couldn't locate any of
the necessary metadata.

rdar://115278959
@al45tair al45tair requested a review from a team as a code owner October 2, 2023 10:22
@al45tair
Copy link
Contributor Author

al45tair commented Oct 2, 2023

@swift-ci Please test

@al45tair al45tair added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.9 labels Oct 2, 2023
@al45tair
Copy link
Contributor Author

al45tair commented Oct 2, 2023

Explanation: Adds a new binary to the build that can be used by people who want to ship code without also shipping the Swift dynamic libraries.
Original PR: #68826
Reviewed by: @mikeash
Resolves: rdar://115278959
Tests: Adds a new test to check that this new binary works as expected.

When building Swift sources, don't make a separate target for the object
file directory, because it may end up with the same name as would be
generated by another invocation of `handle_swift_sources`.

Instead, add the command to make the directory to the custom target that
actually does the build, which should have a unique name.

rdar://115278959
@al45tair
Copy link
Contributor Author

al45tair commented Oct 3, 2023

@swift-ci Please test

@al45tair al45tair merged commit 31617e1 into swiftlang:release/5.9 Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.9
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants