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-12001] Swift 5.2 toolchain ObjC Availability API crash #54436
Comments
@swift-ci create |
This happens because the toolchains don't include compiler-rt libraries for iOS. We're looking into this, but in the meantime you can work around the problem by copying the compiler-rt libraries from Xcode. A command like this will take care of it (adjust the toolchain path as needed):
|
@mikeash looks like it fixed in Xcode 10.4b1 toolchain ? |
Xcode toolchains get built a bit differently so I think that's expected. This problem would show up with swift.org toolchains. |
Comment by Peter Steinberger (JIRA) This is still a problem with the June 9 Trunk Toolchain. Fix via: sudo cp `xcode-select -p`/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/*/lib/darwin/libclang_rt.STAR.a /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2020-06-09-a.xctoolchain/usr/lib/clang/10.0.0/lib/darwin Replace STAR with * (comment formatting issue) |
Hrm even with the cp workaround the original sample project still fails for me in the same way. I wonder if that isn't enough anymore? Notes: swift-5.3-DEVELOPMENT-SNAPSHOT-2020-08-10-a installed locally in ~/Library/Developer/Toolchains instead of globally. Passing the library forcibly still works as expected. |
Ok so the issue is that this call https://github.com/apple/llvm-project/blob/8cbcb6870920db32b52367504902b9bd8456ff91/clang/lib/Driver/ToolChains/Darwin.cpp#L1083 uses the default IgnoreSim = false value. So the derived library name is `libclang_rt.iossim.a` https://github.com/apple/llvm-project/blob/8cbcb6870920db32b52367504902b9bd8456ff91/clang/lib/Driver/ToolChains/Darwin.cpp#L1155-L1156 which doesn't exist in Xcode 11.5, but does exist in 12.x. Copying `libclang_rt.ios.a` to that path fixes the issue. |
This has now been merged to main as part of |
This is also merged as part of release/5.3 |
Please verify the fix with this 5.3 development build (nightly): https://swift.org/builds/swift-5.3-branch/xcode/swift-5.3-DEVELOPMENT-SNAPSHOT-2020-10-12-a/swift-5.3-DEVELOPMENT-SNAPSHOT-2020-10-12-a-osx.pkg |
Verified that with that toolchain I'm able to compile the sample program – also manually inspected the toolchain to ensure the files are there > ls /Library/Developer/Toolchains/swift-5.3-DEVELOPMENT-SNAPSHOT-2020-10-12-a.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.{ios,tvos,watchos}*
-rw-r--r--@ 1 root wheel 265776 Oct 12 22:52 /Library/Developer/Toolchains/swift-5.3-DEVELOPMENT-SNAPSHOT-2020-10-12-a.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.ios.a
-rw-r--r--@ 1 root wheel 265776 Oct 12 22:52 /Library/Developer/Toolchains/swift-5.3-DEVELOPMENT-SNAPSHOT-2020-10-12-a.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.iossim.a
-rw-r--r--@ 1 root wheel 225664 Oct 12 22:52 /Library/Developer/Toolchains/swift-5.3-DEVELOPMENT-SNAPSHOT-2020-10-12-a.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.tvos.a
-rw-r--r--@ 1 root wheel 225664 Oct 12 22:52 /Library/Developer/Toolchains/swift-5.3-DEVELOPMENT-SNAPSHOT-2020-10-12-a.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.tvossim.a
-rw-r--r--@ 1 root wheel 366152 Oct 12 22:52 /Library/Developer/Toolchains/swift-5.3-DEVELOPMENT-SNAPSHOT-2020-10-12-a.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.watchos.a
-rw-r--r--@ 1 root wheel 366152 Oct 12 22:52 /Library/Developer/Toolchains/swift-5.3-DEVELOPMENT-SNAPSHOT-2020-10-12-a.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.watchossim.a |
Also downloaded https://swift.org/builds/development/xcode/swift-DEVELOPMENT-SNAPSHOT-2020-10-15-a/swift-DEVELOPMENT-SNAPSHOT-2020-10-15-a-osx.pkg Test application builds and the builtins are in there > ls /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2020-10-15-a.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.{ios,tvos,watchos}*
-rw-r--r--@ 1 root wheel 265776 Oct 15 17:53 /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2020-10-15-a.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.ios.a
-rw-r--r--@ 1 root wheel 265776 Oct 15 17:53 /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2020-10-15-a.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.iossim.a
-rw-r--r--@ 1 root wheel 225664 Oct 15 17:53 /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2020-10-15-a.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.tvos.a
-rw-r--r--@ 1 root wheel 225664 Oct 15 17:53 /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2020-10-15-a.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.tvossim.a
-rw-r--r--@ 1 root wheel 366152 Oct 15 17:53 /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2020-10-15-a.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.watchos.a
-rw-r--r--@ 1 root wheel 366152 Oct 15 17:53 /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2020-10-15-a.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.watchossim.a |
Comment by Peter Steinberger (JIRA) This is not yet resolved. I downloaded the trunk development from November 12, 2020 and got this error:
I had to apply the same workaround: https://steipete.com/posts/building-with-swift-trunk/#libclang_rtprofile_iossima-not-found
After copying above, it works. |
I confirm this is not resolved, just tried the snapshot from 12th December with Xcode 12.3 Release Candidate:
|
This is unresolved in swift-DEVELOPMENT-SNAPSHOT-2021-03-25-a. After installing the toolchain, ls /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2021-03-25-a.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.*profile*
/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2021-03-25-a.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.profile_osx.a Compare this output with the xcode toolchain which has sudo ls /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.*profile*
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.profile_ios.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.profile_iossim.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.profile_osx.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.profile_tvos.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.profile_tvossim.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.profile_watchos.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.profile_watchossim.a The confusion here seems partly because there are a lot of libs in the toolchain but Xcode (ld) is looking specifically for libs with |
Attachment: Download
Environment
Xcode 11.3
Toolchain: Swift 5.2 Snapshot 2020-01-06 (a)
Additional Detail from JIRA
Watchers: @shahmishal
md5: 8b5bac5d2fb7aa52431d9bb6bd0d5418
Issue Description:
This code produces compiler crash:
Project minimum deployment target - iOS 8
The text was updated successfully, but these errors were encountered: