Cocoapods: Pod trunk push command Failed with Xcode12

Created on 17 Sep 2020  ·  19Comments  ·  Source: CocoaPods/CocoaPods

Report

What did you do?

ℹ Please replace these two lines with what you did.
e.g. Run pod install
Run 'pod trunk push MyCocoaPodProject.podspec --verbose'

What did you expect to happen?

update my pod correctly.

ℹ Please replace these two lines with what you expected to happen.
e.g. Install all pod dependencies correctly.
Update my pod correctly.

What happened instead?

Update failed with error message.

Ld /Users/jinwon/Library/Developer/Xcode/DerivedData/App-cbmpwldthekvhagivcbaijqgcvci/Build/Intermediates.noindex/App.build/Release-iphonesimulator/App.build/Objects-normal/arm64/Binary/App normal arm64 (in target 'App' from project 'App')
    cd /var/folders/fq/g3bnj1n90pnfcd8x0w61t2rr0000gn/T/CocoaPods-Lint-20200917-13791-t0aisw-AdBrixRemasteredPreview
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target arm64-apple-ios9.0-simulator -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.0.sdk -L/Users/jinwon/Library/Developer/Xcode/DerivedData/App-cbmpwldthekvhagivcbaijqgcvci/Build/Products/Release-iphonesimulator -F/Users/jinwon/Library/Developer/Xcode/DerivedData/App-cbmpwldthekvhagivcbaijqgcvci/Build/Products/Release-iphonesimulator -F/var/folders/fq/g3bnj1n90pnfcd8x0w61t2rr0000gn/T/CocoaPods-Lint-20200917-13791-t0aisw-AdBrixRemasteredPreview/Pods/AdBrixRemasteredPreview -filelist /Users/jinwon/Library/Developer/Xcode/DerivedData/App-cbmpwldthekvhagivcbaijqgcvci/Build/Intermediates.noindex/App.build/Release-iphonesimulator/App.build/Objects-normal/arm64/App.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/jinwon/Library/Developer/Xcode/DerivedData/App-cbmpwldthekvhagivcbaijqgcvci/Build/Intermediates.noindex/App.build/Release-iphonesimulator/App.build/Objects-normal/arm64/App_lto.o -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -framework AdBrixRM -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/jinwon/Library/Developer/Xcode/DerivedData/App-cbmpwldthekvhagivcbaijqgcvci/Build/Intermediates.noindex/App.build/Release-iphonesimulator/App.build/App.app-Simulated.xcent -framework Foundation -framework Pods_App -Xlinker -dependency_info -Xlinker /Users/jinwon/Library/Developer/Xcode/DerivedData/App-cbmpwldthekvhagivcbaijqgcvci/Build/Intermediates.noindex/App.build/Release-iphonesimulator/App.build/Objects-normal/arm64/App_dependency_info.dat -o /Users/jinwon/Library/Developer/Xcode/DerivedData/App-cbmpwldthekvhagivcbaijqgcvci/Build/Intermediates.noindex/App.build/Release-iphonesimulator/App.build/Objects-normal/arm64/Binary/App
ld: building for iOS Simulator, but linking in dylib built for iOS, file '/var/folders/fq/g3bnj1n90pnfcd8x0w61t2rr0000gn/T/CocoaPods-Lint-20200917-13791-t0aisw-AdBrixRemasteredPreview/Pods/AdBrixRemasteredPreview/AdBrixRM.framework/AdBrixRM' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED **


The following build commands failed:
    Ld /Users/jinwon/Library/Developer/Xcode/DerivedData/App-cbmpwldthekvhagivcbaijqgcvci/Build/Intermediates.noindex/App.build/Release-iphonesimulator/App.build/Objects-normal/arm64/Binary/App normal arm64
(1 failure)

Testing with xcodebuild.
-> AdBrixRemasteredPreview (1.6.5210)
- ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.
- NOTE | xcodebuild: note: Using new build system
- NOTE | xcodebuild: note: Building targets in parallel
- NOTE | xcodebuild: note: Using codesigning identity override: -
- NOTE | [iOS] xcodebuild: note: Planning build
- NOTE | [iOS] xcodebuild: note: Constructing build description
- NOTE | [iOS] xcodebuild: warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')
- NOTE | [iOS] xcodebuild: clang: error: linker command failed with exit code 1 (use -v to see invocation)

[!] The spec did not pass validation, due to 1 error.

/Library/Ruby/Gems/2.6.0/gems/cocoapods-trunk-1.5.0/lib/pod/command/trunk/push.rb:138:in validate_podspec' /Library/Ruby/Gems/2.6.0/gems/cocoapods-trunk-1.5.0/lib/pod/command/trunk/push.rb:72:inrun'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in run' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/command.rb:52:inrun'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/bin/pod:55:in <top (required)>' /usr/local/bin/pod:23:inload'
/usr/local/bin/pod:23:in `

'

ℹ Please replace these two lines with of what happened instead.
e.g. Pod A is missing the subspec B for target C.

CocoaPods Environment

ℹ Please replace these two lines with the output of pod env.
e.g. via pod env | pbcopy

Stack

   CocoaPods : 1.9.3
        Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
    RubyGems : 3.0.3
        Host : Mac OS X 10.15.6 (19G2021)
       Xcode : 12.0 (12A7209)
         Git : git version 2.24.3 (Apple Git-128)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : 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.5.0
cocoapods-try         : 1.2.0

Project that demonstrates the issue

ℹ Please link to a project we can download that reproduces the issue.
You can delete this section if your issue is unrelated to build problems,
i.e. it's only an issue with CocoaPods the tool.

workaround available

Most helpful comment

@mike-igaw I found a solution and managed to push my pod to trunk.

My understanding of this issue is that the cocoapods validation step is trying to build a dummy Xcode project for all architecture types. In Xcode 12, Apple introduced support for Apple Silicon and it uses arm64 for the simulator. For iOS x86_64 is used for the simulator.
My pod does not yet support Apple Silicon and I explicitly do not bundle an arm64 architecture slice for the simulator in my binary. Therefore when cocoapods was performing its validation and running an xcodebuild for all architectures, it failed when building for arm64 simulator architecture.

The solution is to explicitly exclude the arm64 architecture slice for the simulator by adding the following to the podspec.

s.pod_target_xcconfig = {
    'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'
  }
  s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }

This will modify the pod and user build settings to exclude the arm64 architecture for the simulator. Most users will have Build For Active Architectures Only set to YES, so they won't see this. But if they don't this will prevent a build failure.

The long term solution is to use an XCFramework binary to distribute your pod because it will be able to bundle all architecture slices in the one binary.

All 19 comments

I'm also experiencing the same issue. Minor difference in the error message ld: building for iOS Simulator, but linking in object file built for iOS, but the same problem.

A few others have experienced the same error in a different context.
https://developer.apple.com/forums/thread/657913
https://stackoverflow.com/questions/63607158/xcode-12-building-for-ios-simulator-but-linking-in-object-file-built-for-ios

It seems that adding arm64 to the Excluded Architectures build setting solves this problem.
I presume the reason we are seeing this issue for cocoapods validation is because the dummy app used for validation is simply building for all architectures?

Maybe we have the same issue, If you pass --no-clean to pod lib lint at the end of the log you have the path for the dummy app:

Pods workspace available at `/var/folders/_0/01g2rzqs7_3821295d6mytk40000gp/T/CocoaPods-Lint-20200917-73858-1bibbaj-SDK/App.xcworkspace` for inspection.

I tried to build App.xcworkspace and the build error is:

Bundle identifier is missing. App doesn't have a bundle identifier. Add a value for PRODUCT_BUNDLE_IDENTIFIER in the build settings editor.

@mike-igaw I found a solution and managed to push my pod to trunk.

My understanding of this issue is that the cocoapods validation step is trying to build a dummy Xcode project for all architecture types. In Xcode 12, Apple introduced support for Apple Silicon and it uses arm64 for the simulator. For iOS x86_64 is used for the simulator.
My pod does not yet support Apple Silicon and I explicitly do not bundle an arm64 architecture slice for the simulator in my binary. Therefore when cocoapods was performing its validation and running an xcodebuild for all architectures, it failed when building for arm64 simulator architecture.

The solution is to explicitly exclude the arm64 architecture slice for the simulator by adding the following to the podspec.

s.pod_target_xcconfig = {
    'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'
  }
  s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }

This will modify the pod and user build settings to exclude the arm64 architecture for the simulator. Most users will have Build For Active Architectures Only set to YES, so they won't see this. But if they don't this will prevent a build failure.

The long term solution is to use an XCFramework binary to distribute your pod because it will be able to bundle all architecture slices in the one binary.

@mike-igaw I found a solution and managed to push my pod to trunk.

My understanding of this issue is that the cocoapods validation step is trying to build a dummy Xcode project for all architecture types. In Xcode 12, Apple introduced support for Apple Silicon and it uses arm64 for the simulator. For iOS x86_64 is used for the simulator.
My pod does not yet support Apple Silicon and I explicitly do not bundle an arm64 architecture slice for the simulator in my binary. Therefore when cocoapods was performing its validation and running an xcodebuild for all architectures, it failed when building for arm64 simulator architecture.

The solution is to explicitly exclude the arm64 architecture slice for the simulator by adding the following to the podspec.

s.pod_target_xcconfig = {
    'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'
  }
  s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }

This will modify the pod and user build settings to exclude the arm64 architecture for the simulator. Most users will have Build For Active Architectures Only set to YES, so they won't see this. But if they don't this will prevent a build failure.

The long term solution is to use an XCFramework binary to distribute your pod because it will be able to bundle all architecture slices in the one binary.

Excluding the simulator in the pod spec file has also allowed me to push to the trunk. Thx for the solution!

@mike-igaw I found a solution and managed to push my pod to trunk.

My understanding of this issue is that the cocoapods validation step is trying to build a dummy Xcode project for all architecture types. In Xcode 12, Apple introduced support for Apple Silicon and it uses arm64 for the simulator. For iOS x86_64 is used for the simulator.
My pod does not yet support Apple Silicon and I explicitly do not bundle an arm64 architecture slice for the simulator in my binary. Therefore when cocoapods was performing its validation and running an xcodebuild for all architectures, it failed when building for arm64 simulator architecture.

The solution is to explicitly exclude the arm64 architecture slice for the simulator by adding the following to the podspec.

s.pod_target_xcconfig = {
    'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'
  }
  s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }

This will modify the pod and user build settings to exclude the arm64 architecture for the simulator. Most users will have Build For Active Architectures Only set to YES, so they won't see this. But if they don't this will prevent a build failure.

The long term solution is to use an XCFramework binary to distribute your pod because it will be able to bundle all architecture slices in the one binary.

This worked for me as well!. Thanks a lot!

@mike-igaw I found a solution and managed to push my pod to trunk.

My understanding of this issue is that the cocoapods validation step is trying to build a dummy Xcode project for all architecture types. In Xcode 12, Apple introduced support for Apple Silicon and it uses arm64 for the simulator. For iOS x86_64 is used for the simulator.
My pod does not yet support Apple Silicon and I explicitly do not bundle an arm64 architecture slice for the simulator in my binary. Therefore when cocoapods was performing its validation and running an xcodebuild for all architectures, it failed when building for arm64 simulator architecture.

The solution is to explicitly exclude the arm64 architecture slice for the simulator by adding the following to the podspec.

s.pod_target_xcconfig = {
    'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'
  }
  s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }

This will modify the pod and user build settings to exclude the arm64 architecture for the simulator. Most users will have Build For Active Architectures Only set to YES, so they won't see this. But if they don't this will prevent a build failure.

The long term solution is to use an XCFramework binary to distribute your pod because it will be able to bundle all architecture slices in the one binary.

A lifesaver! thanks very much. The only way to get fat-frameworks pushed without reaching for --skip-import-validation

What about deal with dependencies? If you have them in your Podspec?

--skip-import-validation

@mike-igaw I found a solution and managed to push my pod to trunk.
My understanding of this issue is that the cocoapods validation step is trying to build a dummy Xcode project for all architecture types. In Xcode 12, Apple introduced support for Apple Silicon and it uses arm64 for the simulator. For iOS x86_64 is used for the simulator.
My pod does not yet support Apple Silicon and I explicitly do not bundle an arm64 architecture slice for the simulator in my binary. Therefore when cocoapods was performing its validation and running an xcodebuild for all architectures, it failed when building for arm64 simulator architecture.
The solution is to explicitly exclude the arm64 architecture slice for the simulator by adding the following to the podspec.

s.pod_target_xcconfig = {
    'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'
  }
  s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }

This will modify the pod and user build settings to exclude the arm64 architecture for the simulator. Most users will have Build For Active Architectures Only set to YES, so they won't see this. But if they don't this will prevent a build failure.
The long term solution is to use an XCFramework binary to distribute your pod because it will be able to bundle all architecture slices in the one binary.

A lifesaver! thanks very much. The only way to get fat-frameworks pushed without reaching for --skip-import-validation

Thanks, --skip-import-validation can also work.

Are all the reports here based on pods that are pre-built binaries or do they include sources too?

@dnkoutso My pod is a pre-built binary.

So my feeling is that pre-built pods that do not include arm64 architecture will not work for apps that consume them _unless_ the apps themselves add EXCLUDED_ARCHS to exclude arm64 for simulator.

I generally strongly discourage using s.user_target_xcconfig and has been there for avoiding a breaking change as it changes the users project. It kinda make sense to add it though because a pod author is signaling that "my pre-built pod does not support this architecture".

That's my thinking on the matter too @dnkoutso. I dislike using s.user_target_xcconfig but it allows me to explicitly say that "this pod does not support this architecture". This situation should hasten the move to XCFramework.

@mike-igaw I found a solution and managed to push my pod to trunk.
My understanding of this issue is that the cocoapods validation step is trying to build a dummy Xcode project for all architecture types. In Xcode 12, Apple introduced support for Apple Silicon and it uses arm64 for the simulator. For iOS x86_64 is used for the simulator.
My pod does not yet support Apple Silicon and I explicitly do not bundle an arm64 architecture slice for the simulator in my binary. Therefore when cocoapods was performing its validation and running an xcodebuild for all architectures, it failed when building for arm64 simulator architecture.
The solution is to explicitly exclude the arm64 architecture slice for the simulator by adding the following to the podspec.

s.pod_target_xcconfig = {
    'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'
  }
  s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }

This will modify the pod and user build settings to exclude the arm64 architecture for the simulator. Most users will have Build For Active Architectures Only set to YES, so they won't see this. But if they don't this will prevent a build failure.
The long term solution is to use an XCFramework binary to distribute your pod because it will be able to bundle all architecture slices in the one binary.

This worked for me as well!. Thanks a lot!

@mike-igaw I found a solution and managed to push my pod to trunk.

My understanding of this issue is that the cocoapods validation step is trying to build a dummy Xcode project for all architecture types. In Xcode 12, Apple introduced support for Apple Silicon and it uses arm64 for the simulator. For iOS x86_64 is used for the simulator.
My pod does not yet support Apple Silicon and I explicitly do not bundle an arm64 architecture slice for the simulator in my binary. Therefore when cocoapods was performing its validation and running an xcodebuild for all architectures, it failed when building for arm64 simulator architecture.

The solution is to explicitly exclude the arm64 architecture slice for the simulator by adding the following to the podspec.

s.pod_target_xcconfig = {
    'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'
  }
  s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }

This will modify the pod and user build settings to exclude the arm64 architecture for the simulator. Most users will have Build For Active Architectures Only set to YES, so they won't see this. But if they don't this will prevent a build failure.

The long term solution is to use an XCFramework binary to distribute your pod because it will be able to bundle all architecture slices in the one binary.

It worked! I had to downgrade before and now i can upgrade again 😁 Thanks a lot!

Would a better solution instead of using user_target_xcconfig be to have a flag/ setting that allows us to specify the architectures supported by the dummy app that is spun up on pod trunk push?

I've not been able to get builds to work with any of the above suggestions, we publish privately and have many dependencies both between internal pods and public. However I have resolved by modifying validation.rb to inject exclude architecture settings to both the App project and Pods project level build settings. I check which architecture the script is running on and exclude either 'arm64' or 'x86_64' depending on whether on x86_64 or not so should be compatible with arm based macOS hardware. Will hopefully submit a PR later today for consideration.

In my case, this works

  s.tvos.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=appletvsimulator*]' => 'arm64', }
  s.tvos.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=appletvsimulator*]' => 'arm64' }

Note the specification for tvos spec with appletvsimulator sdk.

I must confess that I don't understand why I do not need to do the same with ios spec. My pod also supports iOS. If anyone knows? 🙏🏻

Hello!
I've been having trouble linting a private spec that has s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' } defined. I've tracked down the issue to a dependency of this spec that has a different definition of EXCLUDED_ARCHS: `"user_target_xcconfig": { "EXCLUDED_ARCHS[sdk=iphonesimulator*]": "i386" }.

I get the the warning Can't merge user_target_xcconfig for pod targets and the linting fails. I ran the pod lib lint with the --no-clean option and found that when this warning appears, cocoapods ends up not settings the EXCLUDED_ARCHS configuration to any value. Is there a workaround for this?

Was this page helpful?
0 / 5 - 0 ratings