In attempting to compile a dummy program for iphoneos, Xcode4, gcc does not appear to reach beyond the initial sysroot directory
$ echo $ISYSROOT
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
$ gcc -arch armv6 --sysroot=$ISYSROOT test.cpp
ld: in /usr/lib/system/libcache.dylib, missing required architecture armv6 in file for architecture armv6
collect2: ld returned 1 exit status
If I leave out sysroot,
$ gcc -arch armv6 test.cpp
ld: warning: ignoring file /usr/lib/crt1.o, missing required architecture armv6 in file
ld: warning: ignoring file /usr/lib/libgcc_s.1.dylib, missing required architecture armv6 in file
ld: warning: ignoring file /usr/lib/libSystem.dylib, missing required architecture armv6 in file
Undefined symbols for architecture armv6:
"start", referenced from:
-u command line option
ld: symbol(s) not found for architecture armv6
collect2: ld returned 1 exit status
The following works, but it feels very cheesy, and not scalable. What's going on here?
$ gcc -arch armv6 -L$ISYSROOT/usr/lib/system --sysroot=$ISYSROOT test.cpp
Update. Apparently this is a known issue, though it still is not clear how to pass sysroot to gcc but isysroot to ld
http://www.doitscared.com/?m=201104
When compiling the library, if you see this error “ld: file not found:
/usr/lib/system/libcache.dylib for architecture armv7″, then your
linker command is using “–sysroot” which doesn’t work in Xcode 4.
Instead, change the linker command to use “-isysroot”. (Note: This
only applies to the linker command. The compile commands must continue
to use “–sysroot”. See here for more details.)
Change the Deployment Target of your project to be at least 4.3 and it will work. This is a problem with XCode 4 but there really isn't a need to deploy apps to iOS versions prior to 4.3. iOS users tend to stay pretty up-to-date with their iOS versions.
Related
I am using Unity3D5.2 to export a iOS project, but when compile in Xcode encounter this problem,please help!
ld: warning: directory not found for option '-
L/Users/lzy/Downloads/IOS88888/LibrariesPlugins/iOS'
Undefined symbols for architecture arm64:
"_saveToGallery", referenced from:
_ScreenshotManager_saveToGallery_m182 in Bulk_Assembly-CSharp_0.o
(maybe youmeant: _ScreenshotManager_saveToGallery_m182)
ld: symbol(s) not found for
architecture arm64 clang: error: linker command failed with exit code 1 (use
-v to see invocation)
One of your library miss the target architecture. Try Simulator or another device with difference cpu.
List all available architecture in your library with cmmand 'lipo -info'
eg:
localhost:~ user$ lipo -info /Applications/iTerm.app/Contents/Frameworks/Sparkle.framework/Sparkle
Architectures in the fat file: /Applications/iTerm.app/Contents/Frameworks/Sparkle.framework/Sparkle are: ppc i386 x86_64
You miss an additional '/' in your library search path. it's a bug in Vuforia that there are '\' instead of '/' in the pathnames. Apple (and linux) treats '\' as escape characters in pathnames.
you have : '/LibrariesPlugins/iOS'
right path: '/Libraries/Plugins/iOS'
My project, in iPhone5s simulator running above normal, but iPhone5 compile error, an error message is as follows:
ld: warning: directory not found for option '-L/Users/apple/Desktop/……/UMSocial_Sdk_3.3.7'
ld: warning: ignoring file /Users/apple/Desktop/……_SDK/lib/libP2P_device.a, missing required architecture i386 in file /Users/apple/Desktop/……_SDK/lib/libP2P_device.a (2 slices)
ld: warning: ignoring file /Users/apple/Desktop/……/UMAnalytics_Sdk/libMobClickLibrary_armv6.a, file was built for archive which is not the architecture being linked (i386): /Users/apple/Desktop/……_Sdk/libMobClickLibrary_armv6.a
ld: warning: ignoring file /Users/apple/Desktop/……_iOS_SDK/lib/libP2P.a, file was built for archive which is not the architecture being linked (i386): /Users/apple/Desktop/……2P.a
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_InterfaceJump", referenced from:
objc-class-ref in CommonFunc.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Your project link some file didn't support i386 architecture. Maybe this file ??just support arm architecture.
You should make sure your "Build Settings" -> "Valid Architectures" didn't contain i386. iPhone5's architecture is "armv7", it shouldn't compile for architecture i386.
If your just want to build target phone architecture, you can set "Build Active Architecture Only" to YES.
I sorry, I think your iPhone5 is device, you can try to change "Valid Architecture" to only support 64bit or 32bit arm architecture, and change "Build Active Architecture Only" to have a try.
iPhone5 simulator is build fine, and iPhone5s build failed usually is arm64 problem.
I added PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions!) and I got the 9 linking errors that I feel like many people have gotten before.
First time working with Facebook in an app and I added every framework, the header, and filled in the info.plist
I had to unwrap launchOptions so can someone help me out on how to get rid of these Mach-O Linker errors.
Updated with error log
ld: warning: directory not found for option '-F(1)'
ld: warning: Auto-Linking supplied '/Users/fabricemulumba/Documents/FacebookSDK/FBSDKShareKit.framework/FBSDKShareKit', framework linker option at /Users/fabricemulumba/Documents/FacebookSDK/FBSDKShareKit.framework/FBSDKShareKit is not a dylib
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_PFFacebookUtils", referenced from:
__TMaCSo15PFFacebookUtils in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Maybe you are using the old version of the Facebook's framework? I've just checked the library out that it does not have
ParseFacebookUtils(PFFacebookTokenCachingStrategy.o) class.
To check that you could use
otool -L ParseFacebookUtilsV4.framework/ParseFacebookUtilsV4 -arch arm64
or
otool -L libParseFacebookUtilsV4Lib.a -arch arm64
the output will be like this
libParseFacebookUtilsV4Lib.a(PFFacebookUtils.o):
libParseFacebookUtilsV4Lib.a(PFFacebookAuthenticationProvider.o):
and I've checked out all dependencies libraries they also dont have any FBRequest and FBSession classes.
Try to use newest versions of sdk or link dependencies by CocoaPods.
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.
I had this question going on, but now I am a little further:
I added this framework to my project:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/AdSupport.framework
Now this works fine if I run the app on any device, however this framework is just for the architectures armv7, armv7s and arm64
When running the app on the simulator, the build fails because the architecture i386 is missing. This is included in:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/AdSupport.framework
How can I achieve that all architectures can be used? I played a lot with the build-settings but nothing worked so far!
error report:
ld: warning: ignoring file /Users/XXXXXXX/Documents/app1/app1/AdSupport.framework/AdSupport, missing required architecture i386 in file /Users/XXXXXXX/Documents/app1/app1/AdSupport.framework/AdSupport (3 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_ASIdentifierManager", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADDevice.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Thanks a lot!
Go to the Project Target.and make architecture like below image.
/Users/XXXXXXX/Documents/app1/app1/AdSupport.framework/AdSupport is missing an i386 slice; I suspect that it was likely built for arm and not intel. It looks like that framework is external to your project, so I suggest you rebuild it for the simulator.
You can check the current architectures of the framework by running file /Users/XXXXXXX/Documents/app1/app1/AdSupport.framework/AdSupport