-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
add script to build Ubuntu cross compilation toolchain #1099
Conversation
I think we should add the usage instructions somewhere, maybe at top of the file or as a separate markdown file. |
added that to the |
@swift-ci please smoke test |
1 similar comment
@swift-ci please smoke test |
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.
LGTM... in conjunction with this can we get some internal document describing the keys we accept in the destination JSON file (in our internal docs somewhere) and then have this script point to that as the canonical place to describe what this is
fi | ||
} | ||
|
||
function fix_glibc_modulemap() { |
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.
Is this something we expect to always have to do, or should there be a bug tacking eliminating the need for it? (i.e., is it something we fix in Swift)
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.
@ddunbar that's a very good question. I think that's a bug in Swift.
To cross compile a binary, you will need a cross compilation toolchain which consists of the toolchain itself and an SDK. For example compiling an iPhone binary from your Mac will use
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk
or similar. If you want to compile a Swift binary for say Ubuntu Xenial on your Mac, you'll need the following pieces of softwareswiftc
andclang
are able to do that)libswiftCore
) for Ubuntu ✅ (that's part of the Swift distribution for Ubuntu).deb
packages available from Ubuntu)In other words, all the pieces of software are available for free online, they just need to be assembled in the correct way. This script is an example on how you can do that for Ubuntu Xenial.
Example use:
This should (after quite some time) result in a file called
/tmp/cross-toolchain/ubuntu-xenial-destination.json
which you can hand to SwiftPM using the--destination
flag introduced in #1098 . An example for that iswhich should result in a binary for Linux 😃