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
[SR-14126] Regression: Cross-compile host to iPhoneOS stopped working #56507
Comments
Comment by Jonathan Hemi (JIRA) CodaFi (JIRA User) would really appreciate your eyes on this if you get a a chance. |
Could you provide the link line being emitted by clang? If that doesn’t contain a suitable -platform_version it will fall back to the host’s platform which id what it seems to be doing here. |
Comment by Jonathan Hemi (JIRA) I think this is everything, also attached the entire folders since they're small.
{{ Run Build Command(s):/usr/local/bin/ninja cmTC_51f01 && [1/2][ 50%][0.034s] Building C object CMakeFiles/cmTC_51f01.dir/testCCompiler.c.o}} {{ }}
|
Comment by Jonathan Hemi (JIRA) But the host is macOS, isn't the ELF a weird outcome? |
Perhaps the issue is the old-style triple. Try `arm64-apple-ios14.0`. You may need to reconfigure your build. |
Comment by Jonathan Hemi (JIRA) No luck. It will not create the output folders, failing with:
The error is coming from here and the expected triple format is parsed here (seems iphoneos-arm64 is the only valid option). |
Comment by Jonathan Hemi (JIRA) I think I can distill it to the simplest clang invocation of a 'return 0' c program: ~ clang -arch arm64 -target arm64-apple-iphoneos14.0 ./hello.c vs. ~ clang -arch arm64 -miphoneos-version-min=14.0 ./hello.c Get a Mach-O 64-bit executable arm64 |
@swift-ci create |
Okay, it's definitely the old-style triple being passed to clang (not to build script). Check out the difference here clang -Wno-unknown-warning-option -Werror=unguarded-availability-new -arch arm64 -target arm64-apple-ios14.0 -fno-stack-protector -v -c /Users/rwidmann/Downloads/cmark-iphoneos-arm64/CMakeFiles/3.19.3/CompilerIdC/CMakeCCompilerId.c -o /Users/rwidmann/Downloads/cmark-iphoneos-arm64/CMakeFiles/3.19.3/CompilerIdC/CMakeCCompilerId.o
objdump --headers /Users/rwidmann/Downloads/cmark-iphoneos-arm64/CMakeFiles/3.19.3/CompilerIdC/CMakeCCompilerId.o | head -n 2
/Users/rwidmann/Downloads/cmark-iphoneos-arm64/CMakeFiles/3.19.3/CompilerIdC/CMakeCCompilerId.o: file format mach-o arm64 versus clang -Wno-unknown-warning-option -Werror=unguarded-availability-new -arch arm64 -target arm64-apple-iphoneos14.0 -fno-stack-protector -v -c /Users/rwidmann/Downloads/cmark-iphoneos-arm64/CMakeFiles/3.19.3/CompilerIdC/CMakeCCompilerId.c -o /Users/rwidmann/Downloads/cmark-iphoneos-arm64/CMakeFiles/3.19.3/CompilerIdC/CMakeCCompilerId.o
objdump --headers /Users/rwidmann/Downloads/cmark-iphoneos-arm64/CMakeFiles/3.19.3/CompilerIdC/CMakeCCompilerId.o | head -n 2
/Users/rwidmann/Downloads/cmark-iphoneos-arm64/CMakeFiles/3.19.3/CompilerIdC/CMakeCCompilerId.o: file format elf64-littleaarch64 |
Please ensure you have this patch applied to your checkout f9be289b9e04b3d7650a6c093e624ff321cf399b, then remove your build directory and rerun the build. |
Comment by Jonathan Hemi (JIRA) Just saw the patch. Indeed this solves the issue. Thanks so much! |
Attachment: Download
Environment
macOS 11.1
Swift cloned from https://github.com/apple/swift
Main branch.
Built with Ninja.
Clang version 12.0.0 (clang-1200.0.32.28)
Additional Detail from JIRA
md5: 57805d3b9702704ea008460f92552183
Issue Description:
Cross-compiling Swift for iOS (using
cross-compile-hosts=iphoneos-arm64
) has recently stopped working.I suspect the issue comes from deprecating min-version in this recent commit.
Seems min-version parameter might still be required by clang (using latest version 12.0.0 (clang-1200.0.32.28)).
On the first target (cmark-iphoneos-arm64), clang emits:
clang: warning: argument unused during compilation: '-arch arm64' [-Wunused-command-line-argument]
ld: warning: ignoring file CMakeFiles/cmTC_00702.dir/testCCompiler.c.o, building for iOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
{{ ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/usr/lib/libSystem.tbd, missing required architecture x86_64 in file /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk/usr/lib/libSystem.tbd (4 slices)}}
{{ Undefined symbols for architecture x86_64:}}
{{ "_main", referenced from:}}
{{ implicit entry/start for main executable}}
{{ ld: symbol(s) not found for architecture x86_64}}
For reference, the build flags for CMakeCCompilerId.o in latest code is:
;;-Wno-unknown-warning-option;-Werror=unguarded-availability-new;-arch;arm64;-target;arm64-apple-iphoneos14.0;-fno-stack-protector
which produce a wrong file type of:
ELF 64-bit LSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
And the build flags from before the commit, which works:
;;-Wno-unknown-warning-option;-Werror=unguarded-availability-new;-arch;arm64;;-miphoneos-version-min=14.0;-fno-stack-protector
And correctly produce a
Mach-O 64-bit object arm64
.{{ }}
The text was updated successfully, but these errors were encountered: