-
Notifications
You must be signed in to change notification settings - Fork 263
Build a static library version of xctest #190
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
I'm not sure a 100% statically linked Foundation is possible or desirable on Linux. We'll always have ICU as an external dependency, for example. |
We definitely want an option to statically link all the libraries present in the toolchain. This will, for e.g., allow server side Swift developers to create a portable binary. True that there will be some external dependencies like ICU and libcurl but installing them is much easier than installing the exact toolchain a binary was built with. Note that it is already possible on macOS to create portable Swift binaries using the package manager. Relevant SwiftPM bugs: |
@swift-ci please test |
Hey @spevans, I don't see any immediate issues with this patch, but I'd like to better understand how this fits into the static linking effort. How does a static Corelibs-XCTest build assist with producing a static Corelibs-Foundation? Could we get some additional bugs filed to help document the roadmap? |
Originally I was working on fully static binaries, which I did get working but has some downsides in requiring libicu and libcurl to be recompiled. After talking with @aciidb0mb3r we decided that making the So the steps to get this all working are:
Extra fixes
So Im currently working on part 2). For now, dont merge this PR as I will add another commit to put the lib in a different build dir. And the test failure on macOS is due to corelibs-foundation needing some swift4 fixes but they are also being worked on. The current status I have it at is:
v
|
@briancroom Does the above answer your questions? This PR is required for swiftlang/swift#9958 which should satisfy steps 1 & 2 above |
build_script.py
Outdated
@@ -206,6 +206,11 @@ def build(args): | |||
build_dir=build_dir, | |||
foundation_build_dir=foundation_build_dir)) | |||
|
|||
# Build the static library | |||
run("mkdir -p {build_dir}/static".format(build_dir=build_dir)) |
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.
It looks like there are three locations in this patch that are building {build_dir}/static
path. It seems worthwhile to extract a helper for producing this path, similar to the existing core_foundation_build_dir
method.
Hey @spevans, sorry for the delay! Things are pretty busy around here right now :) Thanks for the writeup with your progress! This looks like an intriguing effort. I'd recommend putting what you wrote into one or more issues on bugs.swift.org to make it easier to track progress as you push things forward. This patch looks good to me, though I left one minor suggestion. @parkera do you have anything more to add here? |
@swift-ci please test |
libXCTest.a can optionally be installed with --static-library-install-path - Put the static libXCTest.a into a static/ subdir when building - This simplifies linking in static libraries over shared libraries when using -static-stdlib during build testing.
@briancroom I updated https://bugs.swift.org/browse/SR-648 with the current status and added a |
@swift-ci please test |
1 similar comment
@swift-ci please test |
@briancroom the OSX tests failed due to corelibs-foundation not compiling - this is an unrelated issue but there are some PRs waiting to be merged that fix the issues |
@parkera Could you rerun the test on this PR please, I think the Foundation Xcode fixes should make it work now. |
Sure |
@swift-ci please test |
I think we're still trying to figure out where and when the mangling changes take effect... |
@swift-ci please test |
@modocache Could you rerun the tests on this PR please, hopefully the recent fixes should help |
@swift-ci please test |
Great! Let's get this landed. |
libXCTest.a can optionally be installed with
--static-library-install-path
This is required for working towards getting Foundation to be statically linkable on Linux