-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Allow the iOS toolchain to be built on Linux #88072
Allow the iOS toolchain to be built on Linux #88072
Conversation
The iOS toolchain can be built on Linux with minor changes. The compilation will invoke `xcrun` to find the path to the iPhone SDK but a fake `xcrun` executable can be used. ``` #!/bin/sh echo "/path/to/sdk" ``` The iOS toolchain can then be built and linked with rustup. ``` $ ./x.py build --stage 2 --host x86_64-unknown-linux-gnu \ --target aarch64-apple-ios $ rustup toolchain link stage1 build/x86_64-unknown-linux-gnu/stage1 ``` It's possible to take this toolchain and compile an iOS executable with it. This requires the ld64 linker and an iOS SDK. The ld64 linker can be taken from [cctools](https://github.com/tpoechtrager/cctools-port). A project's .cargo/config can then be edited to use the linker for this target. ``` [target.aarch64-apple-ios] linker = "/path/to/cctools/bin/arm-apple-darwin-ld" rustflags = [ "-C", """ link-args= -F/path/to/sdk/System/Library/Frameworks -L/path/to/sdk/usr/lib -L/path/to/sdk/usr/lib/system/ -adhoc_codesign """, ] ```
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) soon. Please see the contribution instructions for more information. |
Hmm, could you change this to check if |
This case is already handled and, from what I can tell, is handled before the check against the host operating system:
|
@bors r+ rollup |
📌 Commit 79e402e has been approved by |
…-on-linux, r=Mark-Simulacrum Allow the iOS toolchain to be built on Linux The iOS toolchain can be built on Linux with minor changes. The compilation will invoke `xcrun` to find the path to the iPhone SDK but a fake `xcrun` executable can be used. ``` #!/bin/sh echo "/path/to/sdk" ``` The iOS toolchain can then be built and linked with rustup. ``` $ ./x.py build --stage 2 --host x86_64-unknown-linux-gnu \ --target aarch64-apple-ios $ rustup toolchain link stage1 build/x86_64-unknown-linux-gnu/stage1 ``` It's possible to take this toolchain and compile an iOS executable with it. This requires the ld64 linker and an iOS SDK. The ld64 linker can be taken from [cctools](https://github.com/tpoechtrager/cctools-port). A project's .cargo/config can then be edited to use the linker for this target. ``` [target.aarch64-apple-ios] linker = "/path/to/cctools/bin/arm-apple-darwin-ld" rustflags = [ "-C", """ link-args= -F/path/to/sdk/System/Library/Frameworks -L/path/to/sdk/usr/lib -L/path/to/sdk/usr/lib/system/ -adhoc_codesign """, ] ```
Rollup of 13 pull requests Successful merges: - rust-lang#87604 (CI: Verify commits in beta & stable are in upstream branches.) - rust-lang#88057 (Update RELEASES to clarify attribute macro values.) - rust-lang#88072 (Allow the iOS toolchain to be built on Linux) - rust-lang#88170 (Update release note for 1.55.0.) - rust-lang#88172 (Test that type alias impl trait happens in a submodule) - rust-lang#88179 (Mailmap entry for myself) - rust-lang#88182 (We meant to use a trait instead of lifetime here) - rust-lang#88183 (test TAIT in different positions) - rust-lang#88189 (Add TAIT struct test) - rust-lang#88192 (Use of impl trait in an impl as the value for an associated type in a dyn) - rust-lang#88194 (Test use of impl Trait in an impl as the value for an associated type in an impl trait) - rust-lang#88197 (Test tait use in a fn type) - rust-lang#88201 (Test that incomplete inference for TAITs fail) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
The iOS toolchain can be built on Linux with minor changes. The compilation will invoke
xcrun
to find the path to the iPhone SDK but a fakexcrun
executable can be used.The iOS toolchain can then be built and linked with rustup.
It's possible to take this toolchain and compile an iOS executable with it. This requires the ld64 linker and an iOS SDK. The ld64 linker can be taken from cctools. A project's .cargo/config can then be edited to use the linker for this target.