-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Remove hardcoded iOS version of clang target for Mac Catalyst #106925
Remove hardcoded iOS version of clang target for Mac Catalyst #106925
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @wesleywiser (or someone else) soon. Please see the contribution instructions for more information. |
These commits modify compiler targets. |
gentle @rustbot ping macos |
Hello @thomcc , sorry to bother! Could you help me to ping |
Sure. I'll also try to take a look later (my project grant covers improving rust support for apple targets). @rustbot ping macos |
Hey MacOS Group! This issue or PR could use some MacOS-specific guidance. Could one |
Thank you so much! No rush at all! |
Hello @hkratz @inflation @nvzqz @shepmaster @thomcc, May I have some feedbacks of this PR? Thanks in advance! |
Do you know from which Apple LLVM version that the target triple has changed? Because I think we pass the target to the linker and this change could break on older Xcode or CLT. |
Good question!
Update: it won't make sense if I just talk about it here. So I did some experiments: Sample build using macOS 11/12 with Xcode 13.0 to 14.2.0: https://github.com/imWildCat-archived/clang-triple-catalyst-test/actions/runs/4012618388/jobs/6891193915 To sum up, catalyst triples without specifying iOS version (e.g. |
I'm inclined to suggest that it's a tier3 platform so compatibility with very old toolchains (especially at the cost of new ones) might be too much for users to expect, so we should probably just take this even if it causes issues with some old toolchains (that said it's obviously not my call to make). That said, if someone with a wider number of XCode toolchains installed (I think @BlackHoleFox might have this setup (or did at one point), but I could also do so if they're too busy) could test on some older ones to see if this does indeed work there, that'd be useful. |
Thanks for your review, @thomcc! To address your concerns, I think we can use relatively old toolchains available on GitHub actions to see the result: https://github.com/imWildCat-archived/clang-triple-catalyst-test/actions/runs/4016723276/jobs/6900131561 I also want to test Xcode 11.0, which is the version Apple toolchain that supports Mac Catalyst. However, we don't have macOS 10.14 on GitHub Actions (actions/runner-images#2347 (comment)).
From my tests, we can see:
|
@thomcc Hello! Let me add another update:
|
0d0a635
to
5209d6f
Compare
|
Hello @thomcc @inflation , may I have another round of review, given the conversation above? I've got another review from @terhechte . Thanks in advance! |
This looks good to me, but @wesleywiser is the assigned reviewer (I'm not a compiler reviewer). |
LGTM |
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.
I don't have a mac setup to test this but the testing in this thread seems sufficient for a Tier 3 target to me.
Thanks @imWildCat! @bors r+ |
⌛ Testing commit 5209d6f with merge 9d0db326e679bfb0b7339568d3a55a8e5fc80b63... |
💔 Test failed - checks-actions |
@bors retry CI was broken |
…ed-ios-macbi-target-version, r=wesleywiser Remove hardcoded iOS version of clang target for Mac Catalyst ## Background From `clang` 13.x, `-target x86_64-apple-ios13.0-macabi` fails while linking: ``` = note: clang: error: invalid version number in '-target x86_64-apple-ios13.0-macabi' ``` <details> <summary>Verbose output</summary> ``` error: linking with `cc` failed: exit status: 1 | = note: LC_ALL="C" PATH="[removed]" VSLANG="1033" ZERO_AR_DATE="1" "cc" "-Wl,-exported_symbols_list,/var/folders/p8/qpmzbsdn07g5gxykwfxxw7y40000gn/T/rustci8tkvp/list" "-target" "x86_64-apple-ios13.0-macabi" "/var/folders/p8/qpmzbsdn07g5gxykwfxxw7y40000gn/T/rustci8tkvp/symbols.o" "/path/to/my/[project]/[user]/target/x86_64-apple-ios-macabi/release/deps/[user].[user].a2ccc648-cgu.0.rcgu.o" "-L" "/path/to/my/[project]/[user]/target/x86_64-apple-ios-macabi/release/deps" "-L" "/path/to/my/[project]/[user]/target/release/deps" "-L" "/path/to/my/[project]/[user]/target/x86_64-apple-ios-macabi/release/build/blake3-74e6ba91506ce712/out" "-L" "/path/to/my/[project]/[user]/target/x86_64-apple-ios-macabi/release/build/blake3-74e6ba91506ce712/out" "-L" "/Users/[user]/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-apple-ios-macabi/lib" "/var/folders/p8/qpmzbsdn07g5gxykwfxxw7y40000gn/T/rustci8tkvp/libblake3-343c1616c8f62c66.rlib" "/path/to/my/[project]/[user]/target/x86_64-apple-ios-macabi/release/deps/libcompiler_builtins-15d4f20b641cf9ef.rlib" "-framework" "Security" "-framework" "CoreFoundation" "-framework" "Security" "-liconv" "-lSystem" "-lobjc" "-framework" "Security" "-framework" "Foundation" "-lc" "-lm" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk" "-Wl,-syslibroot" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk" "-L" "/Users/[user]/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-apple-ios-macabi/lib" "-o" "/path/to/my/[project]/[user]/target/x86_64-apple-ios-macabi/release/deps/lib[user].dylib" "-Wl,-dead_strip" "-dynamiclib" "-Wl,-dylib" "-nodefaultlibs" = note: clang: error: invalid version number in '-target x86_64-apple-ios13.0-macabi' warning: `[user]` (lib) generated 6 warnings error: could not compile `[user]` due to previous error; 6 warnings emitted ``` </details> ### Minimal example C code: ```c #include <stdio.h> void main() { int a = 1; int b = 2; int c = a + b; printf("%d", c); } ``` `clang` command sample: ``` ➜ 202301 clang -target x86_64-apple-ios13.0-macabi main.c clang: error: invalid version number in '-target x86_64-apple-ios13.0-macabi' ➜ 202301 clang -target x86_64-apple-ios14.0-macabi main.c main.c:2:1: warning: return type of 'main' is not 'int' [-Wmain-return-type] void main() { ^ main.c:2:1: note: change return type to 'int' void main() { ^~~~ int 1 warning generated. ➜ 202301 clang -target x86_64-apple-ios15.0-macabi main.c main.c:2:1: warning: return type of 'main' is not 'int' [-Wmain-return-type] void main() { ^ main.c:2:1: note: change return type to 'int' void main() { ^~~~ int 1 warning generated. ➜ 202301 clang -target x86_64-apple-ios-macabi main.c main.c:2:1: warning: return type of 'main' is not 'int' [-Wmain-return-type] void main() { ^ main.c:2:1: note: change return type to 'int' void main() { ^~~~ int 1 warning generated. ➜ 202301 clang --version Apple clang version 14.0.0 (clang-1400.0.29.202) Target: arm64-apple-darwin22.2.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin ``` This PR is a simplified version of rust-lang#96392, inspired by rust-lang/cc-rs#727
☀️ Test successful - checks-actions |
Finished benchmarking commit (821b2a8): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
|
Background
From
clang
13.x,-target x86_64-apple-ios13.0-macabi
fails while linking:Verbose output
Minimal example
C code:
clang
command sample:This PR is a simplified version of #96392, inspired by rust-lang/cc-rs#727