I've just upgraded to Xcode 4.5GM
and tidied up some screens in my iPhone project to cope with the extra screen size on iPhone 5. The project is targeting iOS 5.1
and I've just come to build it for my phone and I get this linker error :
file is universal (2 slices) but does not contain a(n) armv7s slice: /Users/JonathanW/Documents/MyXcode/myApp/myApp/CorePlot/libCorePlot-CocoaTouch.a for architecture armv7s
I'm using the Core Plot 1.0
static library in my project and have not had any issues with it until now. Looking around I can see similar errors to do with the build architecture settings but not sure where to go from here. The project works fine in the simulator (both iOS 5.1
and iOS 6
). Any ideas?
By the looks of it you'll need to rebuild the libCorePlot library with Xcode 4.5GM so that there's a ARMV7S build of the library. Seems as if it's trying to use the version you built with the older Xcode.
I'm also using the Core Plot 1.0 static library in my project. I was able to address the problem by Setting Build Active Architectures Only to Yes. Build Active Architectures Only is in the Architecture section of the Target's Build Settings in Xcode.
I downloaded the Core Plot 1.0 zip file which seems to be incomplete so I cannot rebuild the libraries.
It works in the simulator because the simulator will always use i386 architecture. That hasn't changed with the new SDK. What has changed is the presence of the iPhone 5, which uses a new architecture (armv7s). The project for your app automatically added armv7s as a valid architecture, but the library was likely compiled without knowledge of it. Thus, your arm7s-enabled app tries to link against a library that was built without armv7s and fails.
To fix it, you'll just need access to the project that produces the library. Modify the "Valid Architecture" setting on the target to include armv7s, then rebuild.
I have been struggling with this for days now and finally succeeded getting it to work by creating a new static library.
I used the Mercurial Source Code control system via the instructions here: Create a static library using Mecurial and the "Core-Plot Static Library Install" from the wiki found here: How to do a Static Library Install of Core-Plot
I am posting this for people like me, with low experience, as this is quite simple and self explained.
did you do a clean and rebuild? Also check to see that you have armv6 and armv7 in the architectures. You may need to recompile your targets and re-add the libraries to the target
Switch the compiler on the CorePlot project from the Apple LLVM Compiler 4.1 to LLVM GCC 4.2
Simply i compiled the core-plot library and followed the Dependent Project install from this link http://code.google.com/p/core-plot/wiki/UsingCorePlotInApplications
and every thing going like a charm (my project now support both armv7 and armv7s without any problems) , in addition i still set Build Active Architecture Only to NO , to be sure to support all Architectures
You just need to remove armv7s from the list of valid architectures.
just do the following things. -Select your project from the Project Navigator -Select your target from the list of targets -Select the build settings tab -Find the ‘Valid Architectures’ setting. It should say armv7 armv7s. Remove armv7s and there will be only armv7 in your valid architectures. Now your project will compile correctly.
Fix linker errors for Core Plot when using Xcode 5
I've been using Core Plot for years and was getting a bunch of "Apple Mach-O Linker Warning" errors about armv7s not supporting certain files in the "CorePlotHeader" folder that was updated (deleted folder currently in my project and dragged the new folder into my project) to reflect the CorePlot_1.4 changes. I also deleted the old "libCorePlot-CocoaTouch.a" library and brought that into my Frameworks folder. Everything worked fine in the simulator, but I couldn't build on my iPad 4 with iOS 7.0.2.
Here's the only thing I found that works when Debugging (seems to work when Archiving, etc.):
1) Do everything I mentioned above, set Build Active Architectures to No, then clean
2) You might get an error about the architecture "arm64" not being supported, so delete the "arm64" out of your "Valid Architecture" section in Build Settings
3) Right click on your "MyApp.app" file in your Products folder when Debugging, and you might see the old "libCorePlot-CocoaTouch.a" (if the modified date is pre 9/28/13) compiling with your app.
4) Delete that library and copy the new one into the build folder, clean then rebuild
This works for the "Static Library Install" method and hasn't been tested using the "Dependent Project Install" method
I use Core Plot 1.0 static library for iOS 6.1 in Xcode 4.4. After updating to Xcode 4.5 with iOS 7.0 I faced the same problem as yours.
To fix it, I deleted the CorePlotHeaders folder and libCorePlot-CocoaTouch.a in my project. If you delete it in Xcode, choose the option "Move To Trash".
Then I download CorePlot_1.4.zip from https://code.google.com/p/core-plot/downloads/list, then I follow Static Library Install from https://code.google.com/p/core-plot/wiki/UsingCorePlotInApplications
Hope it helps
来源:https://stackoverflow.com/questions/12411077/ios-linker-error-after-upgrading-to-xcode-4-5-possibly-core-plot-related