I'm trying out a core plot iphone example and I get:
No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=i386, VALID_ARCHS=armv6 armv7).
Under project settings -> architecture, the only options are standard, optimized, and native arch.
Any ideas?
Thank you.
Add i386 to Valid Architectures
I was getting the same error while trying to run some older sample code... It turns out that the project build settings get changed (by the iOS 4.1 SDK?). Anyway, changing these settings back worked for me:
ORIG PROJECT "BUILD" SETTINGS:
Architecture: $(NATIVE_ARCH)
and
Valid Architectures: i386
NEW SETTINGS:
Architectures: armv6 armv7
and
Valid Architectures: armv6 armv7 i386
Just like magic...
~Paul
Related
While facing no issue with actual iPhone device, my project does not build for simulators. I get this error (which occurres for many fies):
ld: warning: ignoring file /Users/stephanedeluca/Library/Developer/Xcode/DerivedData/AladdinWorkspace-afneoinpxpyfmofvnattjgylgxgo/Build/Products/Debug-iphonesimulator/GoogleDataTransport.o, building for iOS Simulator-arm64 but attempting to link with file built for unknown-x86_64
Which sounds like mixing ARM and 86 architectures.
My VALID_ARCHS is set to arm64 arm64e armv7 armv7s i386
I tried to remove VALID_ARCHS value as stated in the following answer without success:
Xcode 13 failing building with "entry point (_main) undefined. for architecture arm64"
I also tried to delete the DerivedData folder without success either.
[UPDATE] I forgot to mention that there is no more PODs in my workspace as I replaced them by the corresponding g Swift packages.
Any idea?
I found the solution: for some reasons, the architecture for macOS being ˋi386ˋ was not longer right, as I had to change it for x86_64.
Finally, my valid architectures are now:
arm64 arm64e armv7 armv7s x86_64
I've got some static libraries I've built for use on armv7 architectures. When I try to use them in a iOS project which I testrun on the iphone 5.0 simulator, I get errors telling me about undefined symbols for architecture i386 in my static libraries.
So I guess this means the iphone simulator wants libraries compiled for i386? What is the point of the simulator then - why dosn't it emulate armv7 architecture as well?
So the only way I can test my static libraries is to connect a physical iOS device and run it?
Or did I get it wrong?
So I guess this means the iphone simulator wants libraries compiled
for i386? What is the point of the simulator then - why dosn't it
emulate armv7 architecture as well?
You've answered your own question. It's a simulator, not an emulator. Therefore it is a Mac OSX program, running on i386 architecture. If you compile your static libraries for i386 as well you will be able to use them on the simulator.
I am not very sure but i386 is for Simulator and armv7 is for Devices that you have connected to your Machine.
You can actually compile the app through Xcode command line tool using i386 architecture (there is also a way to run it in Xcode UI by modifying the build settings).
xcodebuild -sdk iphonesimulator6.1 -arch i386 VALID_ARCHS="i386 armv7 armv7s" clean install
Run this command in the directory that you have the projectName.xcodeproj file.
Here's a break down of the script:
-sdk iphonesimulator6.1 // Build the app on iPhone simulator 6.1
-arch i386 // Build your app using i386 architecture
VALID_ARCHS="i386 armv7 armv7s" // Specify these architectures are valid
clean install // Clean all the builds then re-build and install
If you want to try simulators with i386 just go for =< iPhone 5.
Until xcode 4 final (I was using 3.latest and 4 GM for the time it was available) this didn't happen. When I upgraded to xcode 4 final version, I started getting a linking error while trying to link the armv7 version with my non armv7 library (my project is set with the default Standard armv6 armv7 valid architectures):
ld: warning: ignoring file ../bin/iOS static/arm/libssl.a, file was built for archive which is not the architecture being linked (armv7)
ld: warning: ignoring file ../bin/iOS static/arm/libcrypto.a, file was built for archive which is not the architecture being linked (armv7)
Undefined symbols for architecture armv7: -- list of symbols --
The armv6 version compiles just fine, but the overall compilation process fails with 77 link errors.
I understand this is the expected behavior, it wont link towards armv7 with an armv6 lib. The fix is setting my project to armv6 only. My question here is: why was this working in the previous versions of xcode?
If I set to armv6 only, I start to get this warning:
Check dependencies
[BWARN]warning: all apps should include an armv7 architecture (current ARCHS = "armv6").
I don't like seeing warnings :-) Anybody having similar issues?
Thanks,
Fernando
I just turned the Build active architecture only to Yes in the Project -> Build Setting -> Architectures tab.
In iOS SDK 4.3, it looks like the linker will simply refuse to use a armv6 library in an armv7 binary - this wasn't the case before.
That's why I had to update the http://code.google.com/p/ios-static-libraries/ project to generate both armv6 and armv7 versions of the libraries.
I have added 3rd Party framework with some demo classes into project but once implemented it successfully I removed those demo classes and since then the error started coming up
Error
"ld: ........., file is universal but does not contain a(n) armv6 slice for architecture armv6"
After scratching my head for a whole day I found this solution next morning maybe helpful for fellow iphone buddies coz I know the pain
Targets->"Your Project Target"-> Get Info ->Build Active Architecture only set to YES
Thats it..
Had the same problem.
But the reason was different I suppose.
I was using the library.a file built for simulator and trying to run it on device.. came to know that i need different .a files for simulator and device. I hope this helps someone ;)
Although I still don't know why this started happening only in the xcode 4 final version, I found that my external libs (ssl and crypto) were compiled against both armv6 and armv7 in the google code project very few days ago:
http://code.google.com/p/ios-static-libraries/
This will fix the issue if you define two different library search path: one for armv6, one for armv7.
Thanks,
Until xcode 4 final (I was using 3.latest and 4 GM for the time it was available) this didn't happen. When I upgraded to xcode 4 final version, I started getting a linking error while trying to link the armv7 version with my non armv7 library (my project is set with the default Standard armv6 armv7 valid architectures):
ld: warning: ignoring file ../bin/iOS static/arm/libssl.a, file was built for archive which is not the architecture being linked (armv7)
ld: warning: ignoring file ../bin/iOS static/arm/libcrypto.a, file was built for archive which is not the architecture being linked (armv7)
Undefined symbols for architecture armv7: -- list of symbols --
The armv6 version compiles just fine, but the overall compilation process fails with 77 link errors.
I understand this is the expected behavior, it wont link towards armv7 with an armv6 lib. The fix is setting my project to armv6 only. My question here is: why was this working in the previous versions of xcode?
If I set to armv6 only, I start to get this warning:
Check dependencies
[BWARN]warning: all apps should include an armv7 architecture (current ARCHS = "armv6").
I don't like seeing warnings :-) Anybody having similar issues?
Thanks,
Fernando
I just turned the Build active architecture only to Yes in the Project -> Build Setting -> Architectures tab.
In iOS SDK 4.3, it looks like the linker will simply refuse to use a armv6 library in an armv7 binary - this wasn't the case before.
That's why I had to update the http://code.google.com/p/ios-static-libraries/ project to generate both armv6 and armv7 versions of the libraries.
I have added 3rd Party framework with some demo classes into project but once implemented it successfully I removed those demo classes and since then the error started coming up
Error
"ld: ........., file is universal but does not contain a(n) armv6 slice for architecture armv6"
After scratching my head for a whole day I found this solution next morning maybe helpful for fellow iphone buddies coz I know the pain
Targets->"Your Project Target"-> Get Info ->Build Active Architecture only set to YES
Thats it..
Had the same problem.
But the reason was different I suppose.
I was using the library.a file built for simulator and trying to run it on device.. came to know that i need different .a files for simulator and device. I hope this helps someone ;)
Although I still don't know why this started happening only in the xcode 4 final version, I found that my external libs (ssl and crypto) were compiled against both armv6 and armv7 in the google code project very few days ago:
http://code.google.com/p/ios-static-libraries/
This will fix the issue if you define two different library search path: one for armv6, one for armv7.
Thanks,
I know this question has been posed several times, but my goal is slightly different with regard to what I have found searching the web. Specifically, I am already able to build a static library for iPhone, but the final fat file I am able to build only contains arm and i386 architectures (and I am not sure to what arm refers: is v6 or v7?). I am not able to compile specifically for armv6 and armv7 and them merge both architectures using lipo. The lipo tool complains that the same architecture (arm, not armv6 or armv7) is present in both the armv6 and armv7 libraries.
Can someone explain exactly how to build for armv6 and armv7, and them merge these libraries into a fat file using lipo?
EDIT: I need to build not using Xcode but compiling directly a traditional unix library.
Here is a good solution I found: Static Libs With Support to iOS 5 and Arm64
Edited:
The solution is to build different architectures separated then bind them using lipo, by using command line (or Rakefile).
First build the binary with arm using xcodebuild:
xcodebuild -project 'StaticLibDemo.xcodeproj' -configuration 'Release' -sdk 'iphoneos7.0' clean build ARCHS='armv7 armv7s' IPHONEOS_DEPLOYMENT_TARGET='5.0' TARGET_BUILD_DIR='./build-arm' BUILT_PRODUCTS_DIR='./build-arm'
Note that you must set IPHONEOS_DEPLOYMENT_TARGET='5.0' and ARCHS='armv7 armv7s', it’s recommended to set build and product dirs to make the things more clear, take a look at Build Setting Reference for more details what this flags means.
Next build for arm64:
xcodebuild -project 'StaticLibDemo.xcodeproj' -configuration 'Release' -sdk 'iphoneos7.0' clean build ARCHS='arm64' IPHONEOS_DEPLOYMENT_TARGET='7.0' TARGET_BUILD_DIR='./build-arm64' BUILT_PRODUCTS_DIR='./build-arm64'
Note the difference on ARCHS and IPHONEOS_DEPLOYMENT_TARGET. We also need to build for simulator, in this case we have to change the sdk to iphonesimulator7.0 and build in two steps first for i386:
xcodebuild -project 'StaticLibDemo.xcodeproj' -configuration 'Release' -sdk 'iphonesimulator7.0' clean build ARCHS='i386' IPHONEOS_DEPLOYMENT_TARGET='5.0' TARGET_BUILD_DIR='./build-i386' BUILT_PRODUCTS_DIR='./build-i386'
Now the tricky part! If you just change the ARCHS to x86_86 depending on your Xcode setting you will got an error like: “x86_64 is not a valid arch”. To avoid this just add VALID_ARCHS='x86_64':
xcodebuild -project 'StaticLibDemo.xcodeproj' -configuration 'Release' -sdk 'iphonesimulator7.0' clean build ARCHS='x86_64' VALID_ARCHS='x86_64' IPHONEOS_DEPLOYMENT_TARGET='7.0' TARGET_BUILD_DIR='./build-x86_64' BUILT_PRODUCTS_DIR='./build-x86_64'
Finally we just have to create a fat binary with all the 5 architectures:
lipo -create './build-arm/libStaticLibDemo.a' './build-arm64/libStaticLibDemo.a' './build-i386/libStaticLibDemo.a' './build-x86_64/libStaticLibDemo.a' -output 'libStaticLibDemo.a'
The author created a working example of this, you can get it: https://github.com/diogot/StaticLibDemo
Here is the Link to the post: Static Libs With Support to iOS 5 and Arm64
All credits go to Diogo Tridapalli.
Just use libtool to link the two arm6 and arm7 versions together - its what XCode does. However you will have problems if you try to combine these static libraries into a new super-library. If you need to do that then read this.
If you are doing this already, that would be why lipo is complaining that your "armv6" library contains both armv6 and armv7. My post has a fix that will probably be easier for you since you don't use XCode, but basically you use lipo -extract to make sure you have a thin armv6 library and a thin armv7 library before you go any further.
There doesn't seem to be a need to extract from the fat library before rejoining any more (as described in jamie's answer). I'm using the final 4.0 SDK from apple, which appear to create the fat armv6/armv7 libraries by default.
I was previously specifying the architecture for the input lib like so:
$DEVROOT/usr/bin/lipo -arch arm $PROJECT_DIR/buildlib/Release-iphoneos/lib.a -arch i386 $PROJECT_DIR/buildlib/Release-iphonesimulator/lib.a -create -output $PROJECT_DIR/buildlib/lib.a
This fails on the later SDKs, but removing the architecture from the (now fat) arm lib works fine:
$DEVROOT/usr/bin/lipo $PROJECT_DIR/buildlib/Release-iphoneos/lib.a -arch i386 $PROJECT_DIR/buildlib/Release-iphonesimulator/lib.a -create -output $PROJECT_DIR/buildlib/lib.a
Lipo must now be able to detect the architectures in the fat libraries.
Make sure to have your build settings set to Valid Architectures: armv6 armv7 and Architectures: Optimized (armv6 armv7). This should result in a binary optimized for both v6 & v7. If you're not sure it worked out, just set the Architectures: Standard (armv6) and compare the file sizes. Optimized should produce double the size (when I remember rightly).
You also always can use lipo -info on your binary to see all the included architecures.
Running it on a distribution build of my app gives me:
ullrich ~/Code/.../build/Distribution-iphoneos/My.app (streaming)$ lipo -info My
Architectures in the fat file: My are: armv6 armv7