-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[cxx-interop] Make Cxx
Swift library static
#61160
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
Conversation
@swift-ci please smoke test |
60a30df
to
8238105
Compare
@swift-ci please smoke test |
@swift-ci please smoke test |
1 similar comment
@swift-ci please smoke test |
8238105
to
9ae3c39
Compare
@swift-ci please smoke test |
553278a
to
af9bdf5
Compare
@swift-ci please smoke test |
Can't reproduce the macOS test failure locally 😕
|
@swift-ci please clean smoke test macOS |
af9bdf5
to
20daad3
Compare
@swift-ci please smoke test |
@swift-ci please smoke test Linux |
1 similar comment
@swift-ci please smoke test Linux |
20daad3
to
c1601e6
Compare
@swift-ci please smoke test |
c1601e6
to
0ae6d05
Compare
@swift-ci please smoke test |
0ae6d05
to
3401f29
Compare
@swift-ci please smoke test |
3401f29
to
6dbc3c5
Compare
@swift-ci please smoke test |
6dbc3c5
to
f249493
Compare
@swift-ci please smoke test |
f249493
to
2727a98
Compare
@swift-ci please smoke test |
Windows failure with
|
Instead of a dynamic `swiftCxx.dylib` library, let's build a static library to simplify backdeployment and reduce potential compatibility difficulties in the future. This also adds `NO_LINK_NAME` option to `add_swift_target_library` to prevent the CMake scripts from passing `-module-link-name` to swiftc when building a given module. This fixes linker errors, which would otherwise occur due to the force-load symbol name (`_swift_FORCE_LOAD_$xyz`) being emitted for the libraries that are now static (`swiftCxx`, `swiftstd`).
#52881 / rdar://49906866
2727a98
to
5d86f3e
Compare
@swift-ci please smoke test |
this->addLinkLibrary(LinkLibrary("stdc++", LibraryKind::Library)); | ||
|
||
// Do not try to link Cxx with itself. | ||
if (!getSwiftModule()->getName().is("Cxx")) | ||
this->addLinkLibrary(LinkLibrary("swiftCxx", LibraryKind::Library)); | ||
|
||
// Only link with std on platforms where the overlay is available. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh, the overlay is available on windows as well. This seems wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swiftstd
is not built on Windows, only swiftCxx
is available currently.
I've tried enabling swiftstd
on Windows (#62232) but ran into build issues that I haven't figured out so far.
@@ -372,7 +375,7 @@ function(_compile_swift_files | |||
cmake_parse_arguments(SWIFTFILE | |||
"IS_MAIN;IS_STDLIB;IS_STDLIB_CORE;IS_SDK_OVERLAY;EMBED_BITCODE;STATIC" | |||
"OUTPUT;MODULE_NAME;INSTALL_IN_COMPONENT;MACCATALYST_BUILD_FLAVOR;BOOTSTRAPPING" | |||
"SOURCES;FLAGS;DEPENDS;SDK;ARCHITECTURE;OPT_FLAGS;MODULE_DIR" | |||
"SOURCES;FLAGS;DEPENDS;SDK;ARCHITECTURE;OPT_FLAGS;MODULE_DIR;NO_LINK_NAME" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is NO_LINK_NAME
a multi-value option? It doesn't look like it gets used in this function.
Instead of a dynamic
swiftCxx.dylib
library, let's build a static library to simplify backdeployment and reduce potential compatibility difficulties in the future.