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

Building for iOS Simulator, but linking in object file built for iOS. #744

Closed
albertpurnama opened this issue Sep 19, 2020 · 24 comments
Closed

Comments

@albertpurnama
Copy link

albertpurnama commented Sep 19, 2020

Description:
Cocoapod build failed on XCode 12.0. The build runs perfectly fine on XCode, but it failed when doing pod lib lint which is using the tool xcodebuild. The error is the following:

 ld: in /var/folders/7z/kbh9ck0s7k18scystzfy6hpw0000gn/T/CocoaPods-Lint-20200918-69109-xx8o5m-Cotter/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework/OneSignal.framework/OneSignal(OneSignal-arm64-master.o), building for iOS Simulator, but linking in object file built for iOS, file '/var/folders/7z/kbh9ck0s7k18scystzfy6hpw0000gn/T/CocoaPods-Lint-20200918-69109-xx8o5m-Cotter/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework/OneSignal.framework/OneSignal'
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have searched for answers, there are multiple promising solutions, but none of them works for me:

  1. https://developer.apple.com/forums/thread/656509

Please let me know if there are any additional information I can give, like stack trace, additional environment details, etc.

Environment

  1. What version of the iOS SDK are you using? 2.5.13
  2. How did you add the SDK to your project? Cocoapods
  3. XCode version: XCode 12.0
  4. Cocoapod version: 1.9.3

Steps to Reproduce Issue:

  1. Clone my open source project, using git clone https://github.com/cotterapp/ios-sdk.git
  2. cd ios-sdk
  3. pod lib lint --verbose to see the error I'm getting.

Anything else:

(crash stacktraces, as well as any other information here)

@lieferbaer
Copy link

Exactly same issue for me. I hang on to it too.

@haroldh17
Copy link

Same for me too!

@sethmills21
Copy link

anyone figured this out?

@albertpurnama
Copy link
Author

@sethmills21 I've reached out to OneSignal team at the dashboard. However, there's no answers to this yet

@haroldh17
Copy link

haroldh17 commented Sep 23, 2020

I had the same error but not the same way to reproduce it. My problem was when I tried to run the app on the simulator.
I figured this out on my end but I don’t know if it will help.
I set the scheme to Run > debug. For some reason it was set to release. So when I was trying to run on my phone it was working but not on the simulator.

I’m using React native. Let me know if it helps.

@gdeglin
Copy link
Member

gdeglin commented Sep 24, 2020

This appears to be due to a Cocoapods compatibility issue with XCode 12, as mentioned in the issue here CocoaPods/CocoaPods#10059.

Please try the recommendation in that thread to work around this for now:

add x86_64 to VALID_ARCH if need to run app on simulator, e.g., x86_64 arm64 arm64e

@sethmills21
Copy link

@gdeglin! thanks for the link. I'm still seeing weird stuff while uploading:

image

And it sort of looks specific to the OS pod and extension?

Knew I should have waited a few weeks for Xcode12 update haha

@sethmills21
Copy link

sethmills21 commented Sep 24, 2020 via email

@albertpurnama
Copy link
Author

This has worked for me

https://stackoverflow.com/a/63955114

Closing this issue. Thanks @gdeglin !

@cclaflin89
Copy link

I'm building the project for iOS simulator on Silicon M1. Excluding arm64 architecture for the simulator seems not an appropriate solution for me. Any idea on this?

@CodedMind97
Copy link

@cclaflin89 me too face same issue with M1 silicon any ideas ??

@cclaflin89
Copy link

@Rahulbhutani97 OneSignalXCFramework 3.2.0 released last week worked for me.

@CodedMind97
Copy link

how can i do that please help

@rgomezp
Copy link
Contributor

rgomezp commented Feb 22, 2021

how can i do that please help

In your Podfile, set the pod name to OneSignalXCFramework and the version to 3.2.1

@CodedMind97
Copy link

CodedMind97 commented Feb 23, 2021 via email

@juandelcano
Copy link

Hi, how did you solve this problem? I've tried with adding excluded archs for arm64. But it's still the same. Thanks

@CodedMind97
Copy link

CodedMind97 commented Mar 8, 2021 via email

@MujtabaFR
Copy link

MujtabaFR commented Mar 17, 2021

using OneSignalXCFramework fixed the issue


Another solution for M1 Macs: running Xcode under Rossetta will fix the issue (only temporary workaround)

1 - With Xcode closed (Important) Go to finder -> Applications
2 - Right Click on Xcode and select "Get Info"
3 - On the info panel check "Open using Rosetta"
4 - Double Click in the bottom large preview of the info panel.

** This will cause a decrease in speed and performance in Xcode and simulator

@aasamson
Copy link

is using OneSignalXCFramework even though it is not M1 solved the issue? I can't build in my QAT environment.

ld: in /Users/ai/Documents/perahub-ios/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework/OneSignal.framework/OneSignal(OneSignal-arm64-master.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/ai/Documents/perahub-ios/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework/OneSignal.framework/OneSignal'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@ospaarmann
Copy link

I was able to solve it by changing the build settings for the OneSignalNotificationServiceExtension in Xcode. In Architecture I set "Build Active Architecture Only" to Yes for Debug and Release.

Screenshot 2021-07-29 at 18 39 15

This StackOverflow thread is also related: https://stackoverflow.com/questions/63607158/xcode-12-building-for-ios-simulator-but-linking-in-object-file-built-for-ios/63955114#63955114

@Tenfleques
Copy link

Tenfleques commented Oct 4, 2021

how can i do that please help

In your Podfile, set the pod name to OneSignalXCFramework and the version to 3.2.1

target 'OneSignalNotificationServiceExtension' do
#   pod 'OneSignal', '>= 3.0', '< 4.0'
  pod 'OneSignalXCFramework'
end

worked on M1

@ricsantos
Copy link

Using the OneSignalXCFramework in the extension part of the Podfile does fix the building for iOS Simulator, but linking in object file built for iOS build error, however it produces this warning:

ld: warning: linking against a dylib which is not safe for use in application extensions: /Users/.../DerivedData/.../Debug-iphonesimulator/XCFrameworkIntermediates/OneSignal/OneSignal.framework/OneSignal

@Sifatsb
Copy link

Sifatsb commented Jul 18, 2023

Error (Xcode): In /Users/noob/Documents/Flutter/OutSide Projects/Shakib/Project-3/texibooking/ios/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework/OneSignal.framework/OneSignal(OneSignal-arm64-master.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/noob/Documents/Flutter/OutSide Projects/Shakib/Project-3/texibooking/ios/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework/OneSignal.framework/OneSignal'

Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)

I am not getting any solution. Anyone can help me to solve this?

@afa7789
Copy link

afa7789 commented Feb 22, 2024

same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests