-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix swift-corelibs-foundation for Musl compatibility #4876
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This lets us override the library subdir name when its derivation isn't straightforwardly just the lower-case version of `CMAKE_SYSTEM_NAME`. rdar://123381867
This is needed when we're statically linking, otherwise we can't pull in Dispatch because we won't have RT::rt as a CMake target. rdar://123381867
Musl doesn't have fts built-in; it's in a separate library, which we need to add if we're going to use it. rdar://123381867
@swift-ci Please test |
Hmmm. OK, looks like I need to tweak the auto linking stuff a bit. |
parkera
approved these changes
Feb 22, 2024
What do we do about ICU data when statically linking? |
:-) Currently I just build it all into static libraries and link it. |
For static linking, we need to list all the dependencies of libcurl or libxml2 that we're using. This differs from dynamic linking, because in the latter case that information is in the shared objects, which is not true in the statically linked case. rdar://123381867
Use CMake to check for the existence of strlcpy(), strlcat() and issetugid() before using them. rdar://123381867
We might be using musl instead, which doesn't have __GLIBC_PREREQ as it isn't Glibc. rdar://123381867
This means we're in the same boat as for Android - we need to use `strlen`. rdar://123381867
This is mostly checking for and importing the `Musl` module and, where necessary, using it instead of the `Glibc` module. rdar://123381867
4e815d0
to
56c4738
Compare
@swift-ci Please test |
@swift-ci test windows |
We need to include CheckSymbolExists on Windows as well as on Linux. rdar://123381867
@swift-ci Please test Linux platform |
@swift-ci Please test Windows platform |
@swift-ci test windows |
1 similar comment
@swift-ci test windows |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A few fixes are needed for swift-corelibs-foundation to make it work with Musl and the new fully-static Linux support I’m adding to Swift.
As with swift-corelibs-dispatch, we need a way to set the Swift libdir name that isn’t just lowercasing
CMAKE_SYSTEM_NAME
(because that won’t always work).Musl doesn’t have
strlcpy()
orstrlcat()
, so we need to handle that (we should get CMake to look for these). It also doesn’t have__GLIBC_PREREQ
(since it isn’t Glibc).Another issue is that in order to support static linking, we need to make sure we’re linking with all the dependencies we need (we need to add
libz
,libcrypto
andlibssl
in a couple of places, as well aslibfts
in the case of Musl. We also need to locatelibrt
when we’re statically linking.rdar://123381867