t8n
1
As of yesterday, an app I am developing is crashing on launch via TestFlight. It was working fine previously and the update was a very minor update (a couple of lines of business logic change). The issue seems to be related to the (new?) concurrency library, however the app doesn't use any of the new concurrency features. The app runs fine in the simulator and on a device when launched directly from Xcode.
When installed via TestFlight, the app crashes immediately on launch. The logs of the crash contain:
Library not loaded: @rpath/libswift_Concurrency.dylibuote
The workaround is to add libswift_Concurrency.tbd in the "Link Binary with Libraries" build phase (and make it optional).
Using: Xcode 13.1
So - I guess the question is: Do I wait for 13.2? I guess Apple is aware?
Also posting here so others don't waste too much time trying to figure it out (our certificate expired 12 hours before this happened, so we wasted most of the time thinking it was a certificate/provisioning issue...)
Full crash log:
Incident Identifier: F0A9BDB7-4CBE-4799-866A-AC2B22001BD0
Beta Identifier: 6628AAC7-9DEE-4CB1-BAF6-F7637C1AAEBF
Hardware Model: iPhone11,2
Process: Develop [525]
Path: /private/var/containers/Bundle/Application/702D0C8B-D184-416E-B22B-F4AC065D63A6/Develop.app/Develop
Identifier: <redacted>
Version: 1.0.0 (25)
AppStoreTools: 13C88a
AppVariant: 1:iPhone11,2:15
Beta: YES
Code Type: ARM-64 (Native)
Role: unknown
Parent Process: launchd [1]
Coalition: <redacted> [428]
Date/Time: 2021-12-08 14:46:27.2524 +1100
Launch Time: 2021-12-08 14:46:27.2352 +1100
OS Version: iPhone OS 15.1 (19B74)
Release Type: User
Baseband Version: 4.01.01
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: DYLD; [1]
Library not loaded: @rpath/libswift_Concurrency.dylib
Referenced from: /private/var/containers/Bundle/Application/702D0C8B-D184-416E-B22B-F4AC065D63A6/Develop.app/Develop
Reason: tried: '/private/var/containers/Bundle/Application/702D0C8B-D184-416E-B22B-F4AC065D63A6/Develop.app/Frameworks/libswift_Concurrency.dylib' (no such file), '/private/var/containers/Bundle/Application/702D0C8B-D184-416E-B22B-F4AC065D63A6/Develop.app/Frameworks/libswift_Concurrency.dylib' (no such file), '/usr/local/lib/libswift_Concurrency.dylib' (no such file), '/usr/lib/libswift_Concurrency.dylib' (no such file)
(terminated at launch; ignore backtrace)
Triggered by Thread: 0
Application Specific Information:
Thread 0 Crashed:
0 dyld 0x10328c198 __abort_with_payload + 8
1 dyld 0x103291d5c abort_with_payload_wrapper_internal + 104
2 dyld 0x103291d90 abort_with_payload + 16
3 dyld 0x1032622b4 dyld4::halt(char const*) + 328
4 dyld 0x10325f578 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 3280
5 dyld 0x10325da04 start + 488
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000006 x1: 0x0000000000000001 x2: 0x000000016cee2d60 x3: 0x000000000000009a
x4: 0x000000016cee2960 x5: 0x0000000000000000 x6: 0x0000000000000000 x7: 0x0000000000000530
x8: 0x0000000000000020 x9: 0x0000000000000009 x10: 0x0000000000000001 x11: 0x000000000000000a
x12: 0x0000000000000000 x13: 0x0000000000000035 x14: 0x0000000215ac4609 x15: 0x0000000000000000
x16: 0x0000000000000209 x17: 0x0000000103286830 x18: 0x0000000000000000 x19: 0x0000000000000000
x20: 0x000000016cee2960 x21: 0x000000000000009a x22: 0x000000016cee2d60 x23: 0x0000000000000001
x24: 0x0000000000000006 x25: 0x000000016cee3738 x26: 0x0000000000000001 x27: 0x0000000000000000
x28: 0x0000000000000000 fp: 0x000000016cee2930 lr: 0x0000000103291d5c
sp: 0x000000016cee28f0 pc: 0x000000010328c198 cpsr: 0x00000000
far: 0x00000001031c0000 esr: 0x56000080 Address size fault
Binary Images:
0x103244000 - 0x10329bfff dyld arm64e <c21dba379df93fc7b286734030e18bb1> /usr/lib/dyld
EOF
1 Like
doozMen
(Stijn Willems)
2
We have the same thing and it started happening since Tuesday. We are now trying to publish using the xcode 13.2 Release Candidate which hopefully will include this. Will keep you posted.
Here you can see Library not loaded: @rpath/libswift_Concurrency.dylib as the culprit of the crash
I included this and a link to this forum in a bug report to Apple Feedback Assistant
doozMen
(Stijn Willems)
3
So 2 workarounds worked. Using XCode 13.1 and disable bitcode or XCode 13.2 release candidate with bitcode enabled. We went for the last option but for 13.1 users this should be fixed in my opinion.
1 Like
Houwert
(Douwe Bos)
5
@doozMen How did you ever get it to work with the 13.2 RC?
For me the error just changes to DYLD, Symbol not found: chkstk_darwin .... This is on an iOS 12 device though.
tguidon
(Taylor Guidon)
6
@Houwert we have it partially working in Xcode 13.2 RC
- Yesterday all builds being uploading to TestFlight via Xcode 13.0 or 13.1 resulted in immediate crashes when opening. No crashes were observed when running locally on device.
- We migrated to Xcode 13.2 RC and apps work on iOS 15, but apps running on iOS 14 devices still crash
We're going to try disabling bitcode and using Xcode 13.1 next
In our case, our app (deployment target of iOS 12) was hit with this issue when uploading a Bitcode enabled build that was compiled with Xcode 13.1.
Since we support iOS 12, we don't even use Swift Concurrency features so the issue came as a surprise to me. I tracked the problem back to the fact that one of our dependencies (RealmSwift) has some async code which while it wasn't used, it was enough for Apple to break our build when they processed it :D
To fix the issue for our upcoming release, I've forked RealmSwift to make sure that the code that depends on Swift Concurrency isn't compiled using the following patch:
Hopefully by the time our next release comes, Apple will have either fixed the issue or we can migrate to Xcode 13.2 instead but this might be a useful workaround if you want to get a build out asap without making any bigger changes.
hammamm
(Hammam Abdulaziz)
8
what cause the issue is async / await , so if you do not use it, you may search your libraries and find out witch library is using it, in my case realm was using it and that cause the crash, so I downgrade the realm to the latest version that do not use async / await which is 10.14.0 then archive the app from Xcode 13.2 then it worked fine in devices above iOS 13
Disabling bitcode should work. Alternatively, you can add this to Other Linker Flags: -Wl,-weak-lswift_Concurrency -Wl,-rpath,/usr/lib/swift.
This surprises me, because anything built with Xcode 13.2 RC with a deployment target prior to iOS 15 should have the back-deployed concurrency library (libswift_Concurrency.dylib) embedded in the app bundle. Is it not there? Are you able to attach the app bundle to a feedback for us to inspect?
Doug
tremblay
(Colin Tremblay)
10
The "Other Linker Flags" solution is documented as a workaround in the Xcode 13.2 release notes
On iOS12 loading fails because the bundled libswift_Concurrency.dylib is built for iOS13.0.
So weak linking doesn't help.
Termination Description: DYLD, Symbol not found: ___chkstk_darwin | Referenced from: /private/var/containers/Bundle/Application/F448A9D5-5B6C-438D-B2B4-656C88BCE1D9/XYZ.app/Frameworks/libswift_Concurrency.dylib (which was built for iOS 13.0) | Expected in: dyld shared cache | in /private/var/containers/Bundle/Application/F448A9D5-5B6C-438D-B2B4-656C88BCE1D9/XYZ.app/Frameworks/libswift_Concurrency.dylib
We don't use the async/await parts of RealmSwift so I guess the ideal would be that libswift_Concurrency.dylib is removed from the app on iOS12...
1 Like
alexliubj
(Alex.Liu)
12
Hi @liamnichols
Where is this REALM_INCLUDE_CONCURRENCY defined? Do I need to set some flags in my build settings to use it?
alexliubj
(Alex.Liu)
13
By the way, with latest v13.2, app still crashes on iOS 12 devices.
I don't use swift concurrency but Realm uses it and my app has Realm integrated.
liamnichols
(Liam Nichols)
14
@alexliubj: REALM_INCLUDE_CONCURRENCY is not defined, and that's how we are sure that the #if compile condition evaluates as false (and therefore doesn't include the async code)... I just thought that it was cleaner to do this than commenting out the code 
doozMen
(Stijn Willems)
16
I received a mail from apple on the bug report FB9802787 (App distributed via TestFlight crashes on launch due to Library not loaded: @rpath/libswift_Concurrency.dylib when bitcode enabled) that it has been fixed as of 13.2.1
Had this problem yesterday. Compiling w/ Xcode 13.2RC fixed it for us. See this post for more info: https://developer.apple.com/forums/thread/696197
yo yo, this thread was so helpful so thank you to everyone who contributed. we were losing our minds on this but for us, found the fix was actually stripping bitcode out of both the core target project but also pods too if you use pods
just thought I'd drop in case helpful to anyone else
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
john23
(john23)
19
Had this problem yesterday. Compiling w/ Xcode 14.6RC fixed it for us. See this post for more info[:](GBWhatsapp APK) Sudden crash on launch from all Te… | Apple Developer Forums
I have the same problem. my app crashes in app store after releasing an update from xcode14.1.. crashes happens often in application didFinishLaunching options, sometimes in firebase configure method, sometimes in other places.. We are clueless with this issue, trying trial and error with bitcode and etc. can someone please direct me on the correct solution