Xcode: iOS linker error when linking external frameworks - ios

I'm just starting iOS development.
I am trying to add frameworks to my app, but then get a linker error:
ld: warning: ld: warning: ignoring file /Users/user/Google
Drive/spring 2015/romo
project/RomoSDK_v1.0C/frameworks/RMCore.framework/RMCore, missing
required architecture x86_64 in file /Users/user/Google Drive/spring
2015/romo project/RomoSDK_v1.0C/frameworks/RMCore.framework/RMCore (3
slices)ignoring file /Users/user/Google Drive/spring 2015/romo
project/RomoSDK_v1.0C/CoreMotion.framework/CoreMotion, missing
required architecture x86_64 in file /Users/user/Google Drive/spring
2015/romo project/RomoSDK_v1.0C/CoreMotion.framework/CoreMotion (3
slices)
Any ideas why I would get this error and how to fix it?
Thank you.

The problem occurs because you have set the project to build for the iOS simulator,which is running on the x86_64 architecture. And the error tells you that this architecture is not supported by the romo framework.
Check what happens when you change to compile for a real device, the error should be gone.
I don't know the romo framework, but my guess would be that it only provides the armv6, armv7 and arm64 architectures for real iOS devices.

Related

WatchSimulator 3.1 SDK does not support x86_64 architecture?

This is the warning message appears when I compile my WatchKit 2 app
ignoring file
/Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator3.1.sdk/System/Library/Frameworks//WatchKit.framework/WatchKit,
file was built for i386 which is not the architecture being linked
(x86_64):
/Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator3.1.sdk/System/Library/Frameworks//WatchKit.framework/WatchKitld:
warning: ignoring file
/Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator3.1.sdk/System/Library/Frameworks//Foundation.framework/Foundation,
file was built for i386 which is not the architecture being linked
(x86_64):
/Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator3.1.sdk/System/Library/Frameworks//Foundation.framework/Foundation
And, finally, it failed to compile
ld: entry point (_main) undefined. for architecture x86_64
Architecture allowance in build setting is : i386 and x86_64.
However, if I force architecture to x86_64 only (which I dont want to apply for my project forever). There is another error
ld: illegal text-relocation to 'non_lazy_ptr' in
And I added OTHER_CFLAGS = $(inherited) -read_only_relocs suppress as recommended from some answers in stackoverflow.
But Xcode kept the same error message.
Edited: oh, my another mistake. This should be OTHER_LDFLAGS =... something.
Could any one give me any ideal how to overcome this.
Many thanks,
I figured out the problem.
Because I mistakenly set my WatchKit extension's architecture for WatchSimulator be i386 x86_64. Xcode automatically selected x86_64.
However, Watch Simulator SDK does not support x86_64. Because all current watch OS is built only for 32-bit architecture.
After I removed x86_64 from the architecture setting, Xcode builds my target with i386 architecture.
Then the warning and error disappeared.
Many thanks,

XCode 6.1 Missing required architecture X86_64 in file for extern library

I have an issue when trying to use an external lib : I can't compile the project as it throws an exception as below.
ld: warning: ignoring file /Users/renaudcousin/Documents/XCode/WORK/StimShopPOC/StimShopPOC/libStimshop_SDK.a, missing required architecture x86_64 in file /Users/renaudcousin/Documents/XCode/WORK/StimShopPOC/StimShopPOC/libStimshop_SDK.a (3 slices)
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_StimshopSDK", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)`
I tried lots of solutions found on stackoverflow (but for XCode 5.1 and not as well explained) without any change ...
I also found this topic XCode 6.1 Missing required architecture X86_64 in file that exactly correspond to my problem and
when looking at my lib's architecture with lipo -info command, it seems it's missing i386 and x86_64. How could I add them to my library architectures to be able compile ?
This means your .a library doesn't contain the x86_64 architecture (You can run lipo -info /path/to/your/lib.a to verify it). If you don't have the source code of the library, you have to modify your own project. In the build settings, change the valid architectures to armv7 and i386, or change Architectures to armv7 only. However, by doing so, your project won't be compiled to the arm64 architecture, which is required when uploading to the App Store after Feb 2015, according to Apple's announcement.
If your library doesn't contain x86_64 architecture, it is likely that it doesn't contain arm64 either. So you should avoid using old libraries.
If a library doesn't have the X86_64 architecture you can build it if you've picked a connected device rather than a simulator for your build target.
Basically, you can still build and develop but you can't use the simulator.
Click on your project > build setting > architecture. Change architecture as armv7 and delete others like armv6,etc, Then it will work :-
In the project that builds libStimshop_SDK.a, be sure the "Architectures" setting is set to $(ARCHS_STANDARD) and that it includes 64-bit settings in the compiler settings. Be sure the "Valid Architectures" setting includes 64-bit as well.

How to make framework support architecture x86_64?

I made my own framework and everything was fine. But when Apple releases 64bit architecture when another project uses 64-bit architecture my framework doesn't want to compile.
When I changed architecture of project just armv7 and armv7s - it complies good but when i changed architecture back to arm64 - it produces error -
(null): "_OBJC_CLASS_$MYFramework", referenced from:
objc-class-ref in RWAppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
So I've changed architecture of framework to include arm64, but error in my project still there
Is there another way to support arm64?
I added a screenshot of support architectures of framework
From error description you provided I can see that:
During linking phase for Intel 64bit architecture _OBJC_CLASS_$MYFramework symbol was not found. Which is quite strange as you sure you compiling for arm architecture. Maybe you should revise Makefiles of your framework?
Have a look here Shell you make target IOS7 32bit?

iOS Static Library Xcode (linking errors)

I created a static library with Xcode I have compiled selecting a device.
I added this to my library test project in Xcode 4.6
but I always have 2 errors during the linking...
I followed this tutorial: Static Library iOS Tutorial
if I download the sample code I have the same errors:
ld: warning: ignoring file /Users/Downloads/ICodeBlogStaticLibrarySample/MathTest/Classes/iCodeBlogsMathLibrary/libICodeMathUtils.a, missing required architecture i386 in file /Users/Downloads/ICodeBlogStaticLibrarySample/MathTest/Classes/iCodeBlogsMathLibrary/libICodeMathUtils.a (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_MathFunctions", referenced from:
objc-class-ref in MathTestAppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I had once made a static lirary , I had the same problem .
Solution was to "Run the app on device " not on simulator , it works fine then !!!
Hope this helps...
I followed this step by step tutorial:
Tutorial
in particular I had to add these flags: -ObjC and -all_load
You must have selected iOS simulator while building the project. Select iOS device and it should be fine.
Do read and try to understand the error message, it's a meaningful English phrase.
symbol(s) not found for architecture i386
So there's no compiled code for the i386 architecture in the library. This means that either it's compiled for ARM only (for actual iOS devices, like iPhone or iPad), or for the 64-bit simulator (x86_64). Use otool to find out the architectures present in the library.

"missing required architecture i386" warning

In my IOS application external display support is there. So I used libredirect_device.a framework. But I'm getting a warning:
ld: warning: in /Volumes/Decelopment/Subversion/Abbott/trunk/development/Source/Abbott/Abbott/ExternalDisplay/libredirect_device.a, missing required architecture i386 in file
Sounds to me like you'll only get that warning when compiling for simulator. Can you confirm that you're not getting it when compiling for device?
To get rid of the warning I think the library has to be recompiled, so unless you can get a hold of the source or an i386 version you can't get rid of the warning. You could possibly not include it when compiling for simulator.

Resources