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

Pod trunk push command Failed with Xcode12 #10065

Open
1 task
mike-igaw opened this issue Sep 17, 2020 · 20 comments · Fixed by pedrovgs/DeepPaneliOS#11
Open
1 task

Pod trunk push command Failed with Xcode12 #10065

mike-igaw opened this issue Sep 17, 2020 · 20 comments · Fixed by pedrovgs/DeepPaneliOS#11
Labels
s7:workaround available A workaround for the issue is available

Comments

@mike-igaw
Copy link

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:in run'
/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:in run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/bin/pod:55:in <top (required)>' /usr/local/bin/pod:23:in load'
/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.

@Br1an-Boyle
Copy link

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.

@Br1an-Boyle
Copy link

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?

@andr3a88
Copy link

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.

@Br1an-Boyle
Copy link

@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.

@richard-giantrobot
Copy link

@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!

@ezequielg
Copy link

@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!

@inbeacon
Copy link

@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

AndyQ added a commit to AndyQ/NFCPassportReader that referenced this issue Sep 21, 2020
@chrisvanbuskirk
Copy link

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

dylanjha added a commit to muxinc/stats-sdk-objc that referenced this issue Sep 24, 2020
dylanjha added a commit to muxinc/stats-sdk-objc that referenced this issue Sep 28, 2020
* fix this xcode 12 build CocoaPods/CocoaPods#10065
* update podspec so we can publish this
@ChenPingSheng
Copy link

--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.

@dnkoutso
Copy link
Contributor

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

@dnkoutso dnkoutso added the s7:workaround available A workaround for the issue is available label Sep 29, 2020
@Br1an-Boyle
Copy link

@dnkoutso My pod is a pre-built binary.

@dnkoutso
Copy link
Contributor

dnkoutso commented Sep 29, 2020

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".

@Br1an-Boyle
Copy link

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.

@Chandru0211
Copy link

@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!

@wujood
Copy link

wujood commented Oct 13, 2020

@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!

@scannillo
Copy link

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?

@dnkoutso dnkoutso added this to the 1.11.0 milestone Oct 20, 2020
vguerci added a commit to criteo/ios-publisher-sdk that referenced this issue Oct 27, 2020
vguerci added a commit to criteo/ios-publisher-sdk that referenced this issue Oct 28, 2020
@mwoollard
Copy link

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.

MrAsterisco added a commit to MrAsterisco/RxFireAuth that referenced this issue Nov 29, 2020
fillito added a commit to pedrovgs/DeepPaneliOS that referenced this issue Dec 3, 2020
pedrovgs pushed a commit to pedrovgs/DeepPaneliOS that referenced this issue Dec 4, 2020
* Fix image scaling function to support horizontal images

* Fix typos

* Patch bug introduced by Xcode 12 trying to support arm64 for the simulator target for Apple Silicon compatibility.
CocoaPods/CocoaPods#10065 (comment)

* Build for iOS 14.2

* Update podspec to include the tensorflowlite Metal subspec
cgossain added a commit to cgossain/FirebaseIdentity that referenced this issue Jan 12, 2021
@frouo
Copy link

frouo commented Feb 9, 2021

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? 🙏🏻

@polmum
Copy link

polmum commented Mar 9, 2021

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?

@Bharanitharan06
Copy link

Hi, Am new to react native expo projects, I tried to run my project in Macbook M1 chip and am facing the same issue and I don't know how to fix it.
/ios/Pods/GoogleIDFASupport/Libraries/libAdIdAccessLibrary.a' for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) i need more details about podspec how to find it in my project and how I can edit it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s7:workaround available A workaround for the issue is available
Projects
None yet
Development

Successfully merging a pull request may close this issue.