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

'Prepare Artifacts' stage failed to find .xcframework slice for 'armv7k arm64_32' architectures #9569

Closed
1 task done
bcosescu opened this issue Feb 28, 2020 · 5 comments · Fixed by #9575
Closed
1 task done
Labels
r:xcframeworks Related to the support for XCFrameworks s2:confirmed Issues that have been confirmed by a CocoaPods contributor
Milestone

Comments

@bcosescu
Copy link

bcosescu commented Feb 28, 2020

Report

Cocoapods script for artifacts fails to correctly find the slice for 'armv7k arm64_32' architectures in a .xcframework.

What did you do?

  1. Created a framework for watchOS with valid architectures: armv7k and arm64_32
  2. Created an .xcframework this framework for both the simulator and the architectures above
    The resulted .xcframework had the following structure:
    MyFramework.xcframework
    - Info.plist
    - watchos-armv7k_arm64_32
    - watchos-i386-simulator
  3. Created a local podspec called MyFramework.podspec to serve the .xcframework
  4. Created a sample app project with watch extension and added the following line for the WatchKit Extension target:
    pod 'MyFramework', :path => "<PATH_TO_MY_PODSPEC>"
  5. Run pod install, everything went smooth.
  6. Run the WatchKit Extension on a device

What did you expect to happen?

The test app should have run on the watch device.

What happened instead?

Watch app crashed:
dyld: dependent dylib '@rpath/MyFramework.framework/MyFramework' not found for '/private/var/containers/Bundle/Application/[UUID]/TestFrm2 WatchKit App.app/PlugIns/TestFrm2 WatchKit Extension.appex/TestFrm2 WatchKit Extension', tried but didn't find: ...

Build log showed:
[CP] Unable to find matching .xcframework slice in 'true watchos-armv7k_arm64_32/MyFramework.framework watchos-i386-simulator/MyFramework.framework' for the current build architectures (armv7k arm64_32).

CocoaPods Environment

Stack

   CocoaPods : 1.9.0
        Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
    RubyGems : 3.0.3
        Host : Mac OS X 10.15.3 (19D76)
       Xcode : 11.3.1 (11C504)
         Git : git version 2.21.1 (Apple Git-122.3)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : master - git - https://github.com/CocoaPods/Specs.git @ b33b78a48a78fa1ddff1fdb4b1ddcf673ad2837e

               trunk - CDN - https://cdn.cocoapods.org/

Installation Source

Executable Path: /usr/local/bin/pod

Plugins

cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.1.0
cocoapods-trunk       : 1.4.1
cocoapods-try         : 1.1.0

Podfile

# Uncomment the next line to define a global platform for your project


target 'TestFrm2' do
	platform :ios, '13.2'
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  pod 'MyFramework', :git => "[PRIVATE_REPO]"

  # Pods for TestFrm2

end

target 'TestFrm2 WatchKit App' do
	platform :watchos, '6.1'

  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!
  pod 'MyFramework', :path => "[LOCAL_PATH]"

  # Pods for TestFrm2 WatchKit App

end

target 'TestFrm2 WatchKit Extension' do
	platform :watchos, '6.1'
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  pod 'MyFramework', :path => "[LOCAL_PATH]"

  # Pods for TestFrm2 WatchKit Extension

end

Project that demonstrates the issue

Workaround this issues

If I modify the MyFramework.xcframework structure to this:

  • Info.plist
  • watchos-armv7k arm64_32
  • watchos-i386-simulator
    And also modify the Info.plist's LibraryIdentifier from 'watchos-armv7k_arm64_32' to 'watchos-armv7k arm64_32' the [CP] Prepare Artifacts will run with no warning and the extension runs on the device.

It appears that issue resides in the [CP] Prepare Artifacts script at line 94 where
target_arch is 'armv7k arm64_32' but does not match any value from:
'true watchos-armv7k_arm64_32/MyFramework.framework watchos-i386-simulator/MyFramework.framework'

When running for simulator everything is ok: target_arch is 'i386-simulator' and matches 'watchos-i386-simulator/MyFramework.framework' value.

@amorde amorde added the r:xcframeworks Related to the support for XCFrameworks label Feb 29, 2020
@amorde
Copy link
Member

amorde commented Feb 29, 2020

Likely related to building for multiple architectures at once - will try to reproduce this myself but a sample would be helpful

@amorde
Copy link
Member

amorde commented Mar 1, 2020

Ok able to reproduce locally. Seems to be caused by the watchOS extension target specifically.

We can do the transformation of armv7k arm64_32 --> armv7k_armv64_32 for now, but long term we might need a more robust solution.

@amorde amorde added the s2:confirmed Issues that have been confirmed by a CocoaPods contributor label Mar 1, 2020
amorde added a commit that referenced this issue Mar 1, 2020
amorde added a commit that referenced this issue Mar 1, 2020
@amorde amorde added this to the 1.9.1 milestone Mar 1, 2020
amorde added a commit that referenced this issue Mar 1, 2020
@dnkoutso dnkoutso closed this as completed Mar 2, 2020
@KleMiX
Copy link

KleMiX commented Mar 23, 2020

This also fixes armv7 arm64 iOS slices. For anyone who wonders if they should update. Spent half of the day digging into this just to find out it was already fixed.

@amorde
Copy link
Member

amorde commented Mar 23, 2020

That’s good to know, thanks for posting

@jerbob92
Copy link
Contributor

I don't think this is the best fix. What if the XCFramework slice contains more archs than you are building for? Then it still won't find the correct slice. I will try to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r:xcframeworks Related to the support for XCFrameworks s2:confirmed Issues that have been confirmed by a CocoaPods contributor
Projects
None yet
5 participants