xcode 8 - ld: library not found for -lcrt1.3.1.o - iphone

Can someone tell me how to fix this error in xcode 8?
ld: library not found for -lcrt1.3.1.o
Thanks!

Error: ld: library not found for -lcrt1.3.1.o
Solution: If your project source have deployment target from iOS 5.0 then change it to iOS 6.0 or later and your error will be fix. Now that work fine for device too.

Related

Why is Xcode on my M1 Mac trying to build for `iOS Simulator-x86_64`? Why is it not building for an `arm` based simulator?

I have an M1 MacBook Air.
When building for a simulator in Xcode, I am seeing the following warnings and errors:
ld: warning: ignoring file /Users/kon/Library/Developer/Xcode/DerivedData/InvisibleComputersApp-hktlnhvaoskvxkcdhnahydmbodzw/Build/Products/Debug-iphonesimulator/GoogleSignIn.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /Users/kon/Library/Developer/Xcode/DerivedData/InvisibleComputersApp-hktlnhvaoskvxkcdhnahydmbodzw/Build/Products/Debug-iphonesimulator/AppAuth.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file
/Users/kon/Library/Developer/Xcode/DerivedData/InvisibleComputersApp-hktlnhvaoskvxkcdhnahydmbodzw/Build/Products/Debug-iphonesimulator/GTMAppAuth.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /Users/kon/Library/Developer/Xcode/DerivedData/InvisibleComputersApp-hktlnhvaoskvxkcdhnahydmbodzw/Build/Products/Debug-iphonesimulator/AppAuthCore.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /Users/kon/Library/Developer/Xcode/DerivedData/InvisibleComputersApp-hktlnhvaoskvxkcdhnahydmbodzw/Build/Products/Debug-iphonesimulator/GTMSessionFetcherCore.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_GIDConfiguration", referenced from:
objc-class-ref in GlobalState.o
"_OBJC_CLASS_$_GIDSignIn", referenced from:
objc-class-ref in GoogleAuthService.o
objc-class-ref in GoogleRefreshTokenService.o
objc-class-ref in InvisibleComputersAppApp.o
"_OBJC_CLASS_$_GIDSignInButton", referenced from:
objc-class-ref in LoginView.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This sounds to me like Xcode is somehow trying to build an x86 binary? Why is it even trying to do that, aren't the simulators arm based on the M1 Macs?
How can I
I spent 3 days on this issue beating my head against the wall. Today, I finally cracked it and understood the problem.
I am working on a highly modular project with ~100 frameworks. When migrating from the X86_64 (Intel) architecture to arm64 (M1) I was always getting this error:
Could not find module 'MyModule' for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator, at /my/path/
when building natively on M1.
The reason is that the simulator runs natively on M1 but the simulated app runs still under Intel. That's why the x86_64 architecture was built in the first place.
The two architectures are now beating each other as the simulator is arm64 while the simulated app is X86_64. Removing the arm64 architecture for the pods and project settings fixed the issue and I can build the project entirely on M1 now.
Here are screenshots from the ActivityMonitor. AchieveMe is the app running in the simulator.
To fix the problem for Cocoapods you can simply do:
target.build_configurations.each do |config|
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
end
I am using XcodeGen and there it can simply be added under debug configuration as:
YourSettings
...
configs:
Debug:
EXCLUDED_ARCHS[sdk=iphonesimulator*]: arm64
Best of luck, I hope it helps. I can sleep in peace now.
You can try opening Xcode with "Open using Rosetta" check ON.
Quit Xcode
Go to your Applications folder
Right click Xcode then select "Get Info"
Check "Open using Rosetta"
Open Xcode
If you have a dependency that does not support arm64, you can tell the build system to skip arm64 (this building x86_64) by adding "arm64" to the list of excluded architectures (EXCLUDED_ARCHS) in your targets' build settings.

ld: symbol dyld_stub_binding_helper not found, normally in crt1.o/dylib1.o/bundle1.o for architecture i386 xcode 5

I created iphone/ipad app that was working well by xcode 4 and iOS6
and I installed xcode 5 and I'm trying to run my app, but it now gives me the following error
ld: symbol dyld_stub_binding_helper not found, normally in crt1.o/dylib1.o/bundle1.o for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How can I fix this? hope anyone help me.
Thanks in advance.
For me, I also need to set up the Deployment Target from older version 3.0 to 7.0.
I solved it. I was forgot to change the deployment target to 7.0 and it was 3.
You need to change the Architecture is armv7 only.
if compiler is GCC, change to LLVM also,
And also need to change the deployment target 3.0 to 7.0.

Can not archive the app associated with Zbar sdk in Xcode 5

I have developed an application where i used the zbar sdk. It was working well in xcode 4.5, but recently i have updated to xcode 5. Now when i want to archive my app for app store, it shows the following error.
ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /Users/codemenmini2012-2/Desktop/QRTime (Zbar)/libzbar.a file '/Users/codemenmini2012-2/Desktop/QRTime (Zbar)/libzbar.a' for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How to solve the issue? Thanks in advance.
remove armv7s from valid architecture in project targets.

Why does this debug build reference a release library?

I just installed Xcode 4 and am getting this error in my project:
ld: warning: directory not found for option '-LDebug-iphonesimulator4.3'
ld: warning: ignoring file /Developer/Projects/BuildOutput/Release-iphoneos/libMyFramework.a, missing required architecture i386 in file
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_MyRandomNumber", referenced from:
objc-class-ref in myAppDelegate.o
objc-class-ref in RootViewController.o
I have the project set to iOS 4.3 Simulator. I did check that scheme and it is set to debug build configuration. Why does it reference a Release version of the above library?
Also, what is the i386 error about?
I'm seeing this type of error as well. The odd part is that I've been building, linking, and running successfully under the Simulator. I just now tried to fire my app up in my iPhone, and am totally bombing out during the link process.
I've run my app on my iPhone before. I've been building it under Xcode 3.2.x for the last year, and have never seen this problem.
A couple of other SO threads indicate that it could be due to copying a framework into the project folder, and that one should just "move the framework." Okay. Where, and how do I let Xcode know where it is? And if that's not the problem, then what is?
Xcode 4 has a ton of promise, but it is a sore pain in the ass sometimes....

iOS 4.3 Beta 2 Build Issue - Device Only

I just installed the 4.3 Beta 2 and now I can't build on my device (works fine on the simulator). My build settings are:
Base SDK: Latest iOS (iOS 4.3)
Architectures: Standard (armv6 armv7)
I am getting the below errors. What am I missing?
Error #1
Undefined symbols for architecture armv6:
"_OBJC_CLASS_$_UIProgressView", referenced from:
_OBJC_CLASS_$_PDColoredProgressView in PDColoredProgressView.o
....
ld: symbol(s) not found for architecture armv6
collect2: ld returned 1 exit status
Error #2
in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/lib/crt1.o, file is universal but does not contain a(n) armv7 slice for architecture armv7
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
Considering that iOS 4.3 is under NDA, as all betas are, you won't find much help here. And anyone who actually does offer you up an answer that could remotely help you, would be breaching their NDA and could be thrown out of the program. My suggestion is to take this to the apple developer forums, there's a private confidential information forum you can use there (it's in red).
What is the OS version on Device? Try setting the deployment target to 4.0
I tried deleting the framework and reading it. Still no go. To be sure I readded all of my frameworks and now I am also receiving these warnings.
ld: warning: ignoring file /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics, file was built for unsupported file format which is not the architecture being linked (armv6)
If I deleted the frameworks and readded them from iOS4.3 how can 4.2 still be referenced? Is there more to removing the reference than deleting the .framework file?