Skip to content
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-13366] Package Manager fails to install XCFrameworks with Dynamic Library #4511

swift-ci opened this issue Aug 7, 2020 · 6 comments


Copy link

swift-ci commented Aug 7, 2020

Previous ID SR-13366
Radar rdar://problem/67361241
Original Reporter seanreinhardtapps (JIRA User)
Type Bug

Attachment: Download


Version 12.0 beta 4 (12A8179i)

Additional Detail from JIRA
Votes 1
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 75c780fed553462cf37e12e5ee11694c

Issue Description:

Closely associated with SR-13343, cannot install a signed XCFramework containing a Dynamic Library MachO type. The application builds and fails to launch with a Provisioning Profile error.

The error is not reproducible when the XCFramework is manually installed and Signed by the App (Embed & Sign setting).

We normally ship the XCFramework with instruction to set the embed setting to Embed and Sign, which as far as I could tell is not a possible configuration through the package manager.

Copy link
Contributor Author

Comment by Sean Reinhardt (JIRA)

Issue reproduced on Xcode Version 12.0 beta 5 (12A8189h)

Copy link

@swift-ci create

Copy link
Contributor Author

Comment by Sean Reinhardt (JIRA)

Package manager continues to fail to install XCFrameworks with dynamic libraries on Version 12.0 beta 6 (12A8189n).

It has actually become worse now. Instead of being a code sign issue, Xcode is now not even copying the dylib into the app bundle. When running, the app crashed with a dyld error:

dyld: Library not loaded: @rpath/HyprMX.framework/HyprMX
  Referenced from: /private/var/containers/Bundle/Application/DA46E1D4-863A-4688-9F37-4298CB27832B/
  Reason: image not found
dyld: launch, loading dependent libraries

I also check the build product, and the .app does not have a Frameworks folder, let alone the expected binary in it.

Copy link
Contributor Author

Comment by Sean Reinhardt (JIRA)

Package manager is still broken on Xcode 12 GM Version 12.0 (12A7209), although now the behavior looks like it did with beta 4/5 again.

Swift Packages, containing XCFrameworks that are dynamic libraries fail to install on device:

Unable to install "182-D"
Code: -402620395
A valid provisioning profile for this executable was not found.
Code: -402620395
User Info: {
    DVTRadarComponentKey = 487925;
    MobileDeviceErrorCode = "(0xE8008015)";
    "" = (
    0   DTDeviceKitBase                     0x000000012b9d993f DTDKCreateNSErrorFromAMDErrorCode + 220
    1   DTDeviceKitBase                     0x000000012ba18124 __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 155
    2   DVTFoundation                       0x000000010f211b53 DVTInvokeWithStrongOwnership + 71
    3   DTDeviceKitBase                     0x000000012ba17e65 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1440
    4   IDEiOSSupportCore                   0x000000012b888d28 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.292 + 3513
    5   DVTFoundation                       0x000000010f3402ba __DVT_CALLING_CLIENT_BLOCK__ + 7
    6   DVTFoundation                       0x000000010f341edc __DVTDispatchAsync_block_invoke + 1191
    7   libdispatch.dylib                   0x00007fff6b9a06c4 _dispatch_call_block_and_release + 12
    8   libdispatch.dylib                   0x00007fff6b9a1658 _dispatch_client_callout + 8
    9   libdispatch.dylib                   0x00007fff6b9a6c44 _dispatch_lane_serial_drain + 597
    10  libdispatch.dylib                   0x00007fff6b9a75d6 _dispatch_lane_invoke + 363
    11  libdispatch.dylib                   0x00007fff6b9b0c09 _dispatch_workloop_worker_thread + 596
    12  libsystem_pthread.dylib             0x00007fff6bbfba3d _pthread_wqthread + 290
    13  libsystem_pthread.dylib             0x00007fff6bbfab77 start_wqthread + 15

System Information

macOS Version 10.15.6 (Build 19G2021)
Xcode 12.0 (17219)

Copy link
Contributor Author

Comment by Sean Reinhardt (JIRA)

Determined I was able to deploy an unsigned version of the XCFramework to a device.

Previous tests have been conducted with an XCFramework that had been signed with a distribution certificate.

Copy link
Contributor Author

Comment by Elena Gordienko (JIRA)

I've run into the very same issue using Xcode 13.1 (Swift 5.5.1)

There is a module in my project, which has a package dependency with a binary target – an xcframework containing a dylib. The module itself isn't a package and it is linked to the project binary as a dynamic library.

It works fine on a simulator, but when it comes to running on a real device, there is an error indicating that the framework from the package could not be found:

dyld[676]: Library not loaded: @rpath/SomeFramework.framework/SomeFramework
Referenced from:
<path> (no such file), ...

It seems that the framework with dylib isn't even copied to the app bundle (meaning So when I modify Runpath Search Path in Build Settings to include path, where it is located (that is, I get another error:

dyld[586]: Library not loaded: @rpath/SomeFramework.framework/SomeFramework
Referenced from: /private/var/containers/Bundle/Application/<hash>/
Reason: tried: 
(code signature in <hash> '/private/var/containers/Bundle/Application/<hash>/' not valid for use in process: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.), ...

I believe this could be a bug in SwiftPM and not a project configuration issue.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

3 participants