Cocoapods: strip_invalid_archs() Breaks Symlinks

Created on 3 Nov 2018  路  17Comments  路  Source: CocoaPods/CocoaPods

I believe there _may_ be an issue with the CocoaPods script that strips unused architectures from fat/universal frameworks. It appears to be causing the stripped framework to have an invalid bundle structure.

Note: I have attached a project that reproduces the issue below, but you can also reproduce this issue by installing my pod (OneSignalDynamic), I am the author of this pod. I am not sure if this is an issue _with my pod_, or if it's an issue with cocoa pods, but from what I've investigated so far it seems to be an issue with the strip_invalid_archs() function in CocoaPods breaking symlinks?

Report

What did you do?

Ran pod install for a pod that uses a fat (universal) dynamic framework.
Attempted to build the project with Xcode

What did you expect to happen?

Expected the project to build successfully

What happened instead?

The build fails with the following error:

PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/bradhesse/Library/Developer/Xcode/DerivedData/OneSignalDemo-ezxexrhgiimhyuctbdzduqnabevp/Build/Intermediates.noindex/OneSignalDemo.build/Debug-iphonesimulator/OneSignalDemo.build/Script-49EC5985D357B148EB37CD10.sh (in target: OneSignalDemo)
    cd /Users/bradhesse/onesignal/OneSignal-iOS-SDK/Examples/SwiftExample
    /bin/sh -c /Users/bradhesse/Library/Developer/Xcode/DerivedData/OneSignalDemo-ezxexrhgiimhyuctbdzduqnabevp/Build/Intermediates.noindex/OneSignalDemo.build/Debug-iphonesimulator/OneSignalDemo.build/Script-49EC5985D357B148EB37CD10.sh

mkdir -p /Users/bradhesse/Library/Developer/Xcode/DerivedData/OneSignalDemo-ezxexrhgiimhyuctbdzduqnabevp/Build/Products/Debug-iphonesimulator/OneSignalDemo.app/Frameworks
rsync --delete -av --filter P .*.?????? --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "/Users/bradhesse/onesignal/OneSignal-iOS-SDK/Examples/SwiftExample/Pods/OneSignalDynamic/iOS_SDK/OneSignalSDK/Framework/Dynamic/OneSignal.framework" "/Users/bradhesse/Library/Developer/Xcode/DerivedData/OneSignalDemo-ezxexrhgiimhyuctbdzduqnabevp/Build/Products/Debug-iphonesimulator/OneSignalDemo.app/Frameworks"
building file list ... done
deleting OneSignal.framework/Resources
OneSignal.framework/
OneSignal.framework/.DS_Store
OneSignal.framework/OneSignal
OneSignal.framework/Resources/
OneSignal.framework/Resources/Info.plist
OneSignal.framework/Versions/

sent 5144617 bytes  received 104 bytes  10289442.00 bytes/sec
total size is 10280859  speedup is 2.00
Stripped /Users/bradhesse/Library/Developer/Xcode/DerivedData/OneSignalDemo-ezxexrhgiimhyuctbdzduqnabevp/Build/Products/Debug-iphonesimulator/OneSignalDemo.app/Frameworks/OneSignal.framework/OneSignal of architectures: i386 armv7 arm64
Code Signing /Users/bradhesse/Library/Developer/Xcode/DerivedData/OneSignalDemo-ezxexrhgiimhyuctbdzduqnabevp/Build/Products/Debug-iphonesimulator/OneSignalDemo.app/Frameworks/OneSignal.framework with Identity -
/usr/bin/codesign --force --sign -  --preserve-metadata=identifier,entitlements '/Users/bradhesse/Library/Developer/Xcode/DerivedData/OneSignalDemo-ezxexrhgiimhyuctbdzduqnabevp/Build/Products/Debug-iphonesimulator/OneSignalDemo.app/Frameworks/OneSignal.framework'
/Users/bradhesse/Library/Developer/Xcode/DerivedData/OneSignalDemo-ezxexrhgiimhyuctbdzduqnabevp/Build/Products/Debug-iphonesimulator/OneSignalDemo.app/Frameworks/OneSignal.framework: replacing existing signature
/Users/bradhesse/Library/Developer/Xcode/DerivedData/OneSignalDemo-ezxexrhgiimhyuctbdzduqnabevp/Build/Products/Debug-iphonesimulator/OneSignalDemo.app/Frameworks/OneSignal.framework: bundle format is ambiguous (could be app or framework)
Command PhaseScriptExecution failed with a nonzero exit code

CocoaPods Environment

Stack

   CocoaPods : 1.6.0.beta.2
        Ruby : ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
    RubyGems : 2.5.2.3
        Host : Mac OS X 10.14 (18A391)
       Xcode : 9.4.1 (9F2000)
         Git : git version 2.15.2 (Apple Git-101.1)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ ed170b67c25a73a8de167064e2e4663a98f1e2b6
               OneSignalPro - https://github.com/Hiptic/OneSignal-iOS-SDK-PRO.git @ 289b89f65a28e633f142eae229dd13593708deba
               twilio - https://github.com/twilio/cocoapod-specs @ 15612163b2cae5be50339701ce3702af12a090f8

Installation Source

Executable Path: /usr/local/bin/pod

Plugins

cocoapods-deintegrate : 1.0.2
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.3.1
cocoapods-try         : 1.1.0

Podfile

platform :ios, '10.3'

target 'OneSignalDemo' do
  pod 'OneSignalDynamic', '>= 2.9.3', '< 3.0'
end

target 'OneSignalNotificationServiceExtension' do
   pod 'OneSignalDynamic', '>= 2.9.3', '< 3.0'
end

Project that demonstrates the issue

Here is a link to a project that reproduces this issue (pods included).

moderate awaiting input

All 17 comments

its code signing that fails here not strip invalid archs. I believe the .framework for iOS is not in the right format. I will need take a look though.

@dnkoutso Codesigning errors are also common with invalid framework bundles. The strip arch鈥檚 function seems to be breaking/changing the framework structure. Normally this framework works just fine - until it gets stripped by the cocoapods function.

So I鈥檓 not entirely sure if it鈥檚 an issue with cocoapods or an issue with my framework.

@Nightsd01 does code signing work when you use your framework without CocoaPods?

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem :+1:

@dnkoutso Sorry for the late reply - yes - code signing works fine when using the framework without cocoapods.

This issue should realllllly not be closed because it's still a problem even with the latest beta (1.6.0.beta.2)

When I inspect what Cocoapods actually does, it seems like the strip_invalid_archs() function in Cocoapods is actually breaking the structure of the framework, it seems to be deleting several folders and symlinks. It deletes the Modules and Headers folders + symlinks.

Any updates on this issue? @dnkoutso

I鈥檓 not seeing any updates, I think we鈥檇 love to be able to review a PR that fixes the script!

Any updates please?

This is a blocker and we are stuck because of this issue. @segiddins @dnkoutso Please look into this issue its been almost a year.

No idea where to even begin

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Not sure that this has been resolved

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem :+1:

Not sure this has been resolved

Actually I may have resolved this in #9334 - can you try the latest beta?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

luhui picture luhui  路  3Comments

steffendsommer picture steffendsommer  路  3Comments

hmistry picture hmistry  路  3Comments

iosdev-republicofapps picture iosdev-republicofapps  路  3Comments

evermeer picture evermeer  路  3Comments