According to the literature, an A6 processor will execute ARMv7 code. My project is failing at link because a library was built for ARMv7, but the application is built for ARMv7s.
A typical message is (when I attach my iPad 4 (Retina) or iPhone 5):
ld: warning: ignoring file /usr/local/ssl/iphoneos/lib//fipscanister.o, file was built for armv7 which is not the architecture being linked (armv7s): /usr/local/ssl/iphoneos/lib//fipscanister.o
ld: warning: ignoring file /usr/local/ssl/iphoneos/lib//libcrypto.a, file was built for archive which is not the architecture being linked (armv7s): /usr/local/ssl/iphoneos/lib//libcrypto.a
Undefined symbols for architecture armv7s:
"_FIPS_incore_fingerprint", referenced from:
_FINGERPRINT_premain in fips_premain.o
"_FIPS_signature", referenced from:
_FINGERPRINT_premain in fips_premain.o
"_FIPS_text_start", referenced from:
_FINGERPRINT_premain in fips_premain.o
ld: symbol(s) not found for architecture armv7s
I know I can resolve this by removing ARMv7s from Valid Architectures (VALID_ARCHS), but I'm not sure why since the A6 processor can execute A5 object code. Or I can perform an additional build of the library for the ARMv7s architecture, but that's more work and requires a different on-disk directory structure.
Is there any magic to link an ARMv7 library with an ARMv7s application?
From Jim Grosbach on the Xcode mailing list, the linker switch -allow_sub_type_mismatches should allow ld to proceed with linking. And from Apple's ld man pages:
-allow_sub_type_mismatches
Normally the linker considers different cpu-subtype for ARM
(e.g. armv4t and armv6) to be different different architec-
tures that cannot be mixed at build time. This option
relaxes that requirement, allowing you to mix object files
compiled for different ARM subtypes.
There's also a Changelog entry that details the environmental variable called LD_ALLOW_CPU_SUBTYPE_MISMATCHES.
However, I found -allow_sub_type_mismatches simply did not work on Xcode 4.5.2. Grepping the web reveals a few Apple RADAR's for -allow_sub_type_mismatches. See, for example, radar://6134468.
Hopefully its fixed by now, but nothing surprises me when it comes to Apple and their defective software.
Related
I'm quite new to Xcode and Iphone development and ran into the following problem:
I opened a new project and added *.h and a *.a files (which I recived from a certain device vendor).
I get the following warning:
ld: warning: ignoring file /Users/udi/Desktop/Xcode/Xcode Projects/Scosche/libmyTrekSDK_armv7.a, missing required architecture i386 in file /Users/udi/Desktop/Xcode/Xcode Projects/Scosche/libmyTrekSDK_armv7.a (2 slices)
If I ignore the warning, and try to instanciate the class that is given to me in the header file, I get these errors:
ld: warning: ignoring file [Path/FileName.a], missing required architecture i386 in file [Path/FileName.a] (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_HRMonitor", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
I've checked the Framework Search Pathes (as mantioned in many other posts) and it clear.
More info:
I'm Using Xcode 4.6.1
The files are currently located at project's root folder.
I'm using a Single View Application tamplate.
Appreciate any help
This warning means that you're trying to use library made for Device (ARM) with your Simulator (i386).
You can use this terminal command to create a universal library:
lipo -create lib_arm.a lib_i386.a -output lib_universal.a
More info about lipo command here.
Change your target's "Build Settings > Build Active Architectures Only" to "No"
This is doing the same thing as Dmitry Zhukov's answer but doing it thru Xcode instead of going around its back.
If you are working with a 3rd party code, keep in mind that some SDKs may not work on the simulator. The same build error I have encountered vanished, when I ran the project on the device.
I'm creating a static library with some class files, and the library is creating well but if I install to library to another new Xcode project it showing error and the error is as follows ,
ld: warning: ignoring file /Users/rajesh/Desktop/Quntiles/01-03-2013/ConnectionExample-1/libAVTEmployee.a, file was built for archive which is not the architecture being linked (armv7s): /Users/rajesh/Desktop/Quntiles/01-03-2013/ConnectionExample-1/libAVTEmployee.a
Undefined symbols for architecture armv7s:
"_OBJC_CLASS_$_AVTEmployee", referenced from:
objc-class-ref in XMLParser-E51A1142A3EEED70.o
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Can any one please help me, how can I fix this issue so that I can use the my static library in my new project ,
I'm using Xcode 4.6 version.
Thanks in advance.
Probably your static library was created or compiled using an older version of XCode that didn't support armv7s architecture. Open the static library project and make sure that Architectures contains armv7 and armv7s architectures and Build Active Architectures Only is set to No under Build Settings.
So I have an iPhone static library that I am trying to build. I've got the script that was used in this question (http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4), but the issue I've hit is that I'm seemingly still unable to successfully build the static library for the simulator. When I build in the static library project, I get the follow warnings:
warning: no rule to process file '$(PROJECT_DIR)/GDInAppStore/GDInAppStore.m' of type sourcecode.c.objc for architecture i386
warning: no rule to process file '$(PROJECT_DIR)/GDInAppStore/SKProduct+priceAsString.m' of type sourcecode.c.objc for architecture i386
warning: no rule to process file '$(PROJECT_DIR)/GDInAppStore/VerificationControllerPBK.m' of type sourcecode.c.objc for architecture i386
I believe this issue is causing the problem that is leading to the universal library I get from the build script causing this error in my other project
ld: warning: ignoring file /Users/abotkin/Projects/Static Libraries/GDInAppStore/libGDInAppStore.a, missing required architecture i386 in file
"_OBJC_CLASS_$_GDInAppStore", referenced from:
objc-class-ref in SubscribeNowInAppController.o
ld: symbol(s) not found for architecture i386
I'm using Xcode 4.3.2 and have set the flags in the static library Xcode project so that i386 is included in the Architecture and Valid Architectures. Any tips?
Make sure you are building for the simulator if you are compiling for i386. Basically, your arch parameter has to match your sdk parameter. i.e.
xcodebuild -project proj.xcodeproj -arch armv64 -sdk iphoneos8.1 build
and
xcodebuild -project proj.xcodeproj -arch i386 -sdk iphonesimulator8.1 build
I was able to do a workaround this issue by using Karl's iOS Universal Framework that he mentioned in the other topic here https://stackoverflow.com/a/5721978/497718
That said, if anyone could point me into what I may have been doing wrong in using the script in that same topic, I'd love to learn how to do it the right way.
With Xcode 6, Apple has added iOS framework support to their build tools.
Using Apple's framework target for all new projects, as it is less hacky and is supported by Apple themselves.
i get this error when i am trying to use my compiled static library in my iphone aplication. I have no frigging idea what's wrong.
ld: warning: ignoring file /Users/rw/Library/Developer/Xcode/DerivedData/MSTicketingSaaS-gkznscznevvifjesoapzgwycbces/Build/Products/Debug-iphoneos/libMylib.a, file was built for archive which is not the architecture being linked (armv6)
Undefined symbols for architecture armv6:
"_OBJC_CLASS_$_AppData", referenced from:
It worked before upgrading to Xcode 4.0.2
I added the i386 architecture and now it compiles for the simulator but NOT for the device.
Check with lipo which is the architecture your lib has been built for:
lipo -info <path_to_lib>
If it does not contain "arm6" then you should go back to the library project and build it for the proper architecture. If this does not help, please, give more detail about the structure of your project(s).
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?