Crash on launch when adding a Swift package with a binary target

I have compiled Google's WebRTC library and bundled up everything into xcframework in order to distribute as a binary framework in Swift package manager.

When I add the package to my project it compiles and runs on a simulator. However, on a physical device, it crashes on launch with the following error:

dyld: Library not loaded: @rpath/WebRTC.framework/WebRTC
Referenced from: /private/var/containers/Bundle/Application/AA9F8C9C-7EF4-4556-8848-1EEFE1785658/WebRTC-Demo.app/WebRTC-Demo
Reason: image not found
dyld: launch, loading dependent libraries
DYLDLIBRARYPATH=/usr/lib/system/introspection
DYLDINSERTLIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib

Further investigation:

  • After archiving the project and exporting ipa file, the ipa file is missing the binary framework and still crashing on launch.

  • Removing the Swift package and attaching the xcframework manually (by drag and drop) works on Simulators and physical devices.


Tech specs

  • XCFramework created on macOS 10.15.5 with Xcode 11.5

  • Used Xcode 12.0 beta 1 on macOS 10.15 for the app which uses the framework.

  • I got the error above on iPhone X and iPad pro 10.5"

  • Used the following Package.swift file.

  • Framework download link can be found in the Package.Swift file above.


Any suggestions/insights would be helpful.

Thanks!
Answered by stasel in 670178022
The issue has been fixed in one of the recent Xcode 12.x releases (not sure which exactly, maybe 12.1)

I'm facing the same issue any update on this thread?

Version 13.4 (13F17a)

[libprotobuf FATAL google/protobuf/stubs/common.cc:67] This program requires version 3.2.0 of the Protocol Buffer runtime library, but the installed version is 3.1.0. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "/Users/ci/civil/workspace/m_streamclient/label/mobile_ios/libstreamclient/src/ys_streamprotocol.pb.cc".) libc++abi: terminating with uncaught exception of type google::protobuf::FatalException: This program requires version 3.2.0 of the Protocol Buffer runtime library, but the installed version is 3.1.0. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "/Users/ci/civil/workspace/m_streamclient/label/mobile_ios/libstreamclient/src/ys_streamprotocol.pb.cc".) dyld4 config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib:/usr/lib/libMTLCapture.dylib terminating with uncaught exception of type google::protobuf::FatalException: This program requires version 3.2.0 of the Protocol Buffer runtime library, but the installed version is 3.1.0. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "/Users/ci/civil/workspace/m_streamclient/label/mobile_ios/libstreamclient/src/ys_streamprotocol.pb.cc".)

Crash on launch when adding a Swift package with a binary target
 
 
Q