iOS - Linker error after upgrading to Xcode 4.5, possibly Core Plot related
Asked Answered
C

10

17

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?

Crownwork answered 13/9, 2012 at 16:49 Comment(2)
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 targetKerrykersey
Sorry should have said yes I've done all the usual full cleans, delete derived data, rebuild etc. I even did a complete re-install of Xcode.Crownwork
J
15

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.

Jackelynjackeroo answered 13/9, 2012 at 16:53 Comment(8)
This fixed an identical issue I saw with AFNetworking after I updated to Xcode 4.5GMGenerate
@Ben How do you rebuild the libCorePlot library?Eccentricity
How have you added it? A sub project, sibling project, framework?Jackelynjackeroo
Many thanks Ben, your answer is spot on. Recompiling the Core Plot library with Xcode 4.5 was even more of a challenge but got there in the end! @Eccentricity - I got some code fixes for Core Plot here : code.google.com/p/core-plot/issues/detail?id=442 I'm hoping they will release another master build after iOS6 comes out.Crownwork
...and this is why we recommend people work from the latest code in the repository: code.google.com/p/core-plot/source/checkout rather than the binary snapshots. Follow the dependent project instructions here: code.google.com/p/core-plot/wiki/UsingCorePlotInApplications and this should build fine with the new architecture.Kimbell
One thing to add to this is that you need to go to the Core Plot project, go down to the Build Active Architecture Only build setting, and change that to No for both the Debug and Release builds. Combined with compiling from the latest repository source, this clears up any armv7s linker errors you might see.Kimbell
I checked out this build code.google.com/r/andybrett-xcode-45-fixes/source/… , rebuilt the CorePlot-CocoaTouch.xcodeproj using xCode 4.5. I didn't need to change any settings in my project to fix my build issues.Lai
@BradLarson check out my fix for Xcode 5 linker error problems, nothing got rid of the errors until I deleted the old library out of the Debug-iphoneos folder..even though this fixes the errors, I still had to delete the "arm64" arch to get it to run on the iPad. Any ideas on how to keep that part of the build without waiting for a new CorePlot version?Kandacekandahar
E
7

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.

Ethnogeny answered 2/10, 2012 at 14:53 Comment(0)
A
4

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.

Argentina answered 13/9, 2012 at 16:57 Comment(1)
Many thanks Matt, your answer is spot on. I've accepted Ben's answer as he was first.Crownwork
S
2

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.

Sugihara answered 30/9, 2012 at 16:20 Comment(0)
K
0

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

Kerrykersey answered 13/9, 2012 at 16:54 Comment(0)
M
0

Switch the compiler on the CorePlot project from the Apple LLVM Compiler 4.1 to LLVM GCC 4.2

Maribelmaribelle answered 21/9, 2012 at 12:15 Comment(1)
No, this is not a recommended practice. Grab the latest repository code and build based on that.Kimbell
N
0

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

Niu answered 4/11, 2012 at 11:37 Comment(0)
W
0

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.

Wayward answered 13/12, 2012 at 10:25 Comment(0)
K
0

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

Kandacekandahar answered 22/10, 2013 at 17:29 Comment(0)
E
0

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

Echinoderm answered 23/10, 2013 at 4:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.