missing required architecture x86_64 in file libCorePlot-CocoaTouch.a
Asked Answered
V

9

19

According to the Ray Wenderlich tutorial, I done the following :

Step 1 - I downloaded CorePlot_1.4.zip on the official website

Step 2 - I added to my project the CorePlotHeaders folder and the static library named libCorePlot-CocoaTouch.a (checking “Copy items into destination group’s folder (if needed)”)

Step 3 - I added into Other Linker Flags field the following : -ObjC

Step 4 - I checked into Link Binary with Libraries if libCorePlot-CocoaTouch.a and QuartzCore frameworks were here

Result : When I compile my project, it works fine when I'm using Iphone Retina (4-Inch). But when I'm using Iphone Retina (4-Inch 64-bit) I got the following message when I try to build and run :

ld: warning: ignoring file /blah/blah/libCorePlot-CocoaTouch.a, missing required architecture x86_64 in file /blah/blah/libCorePlot-CocoaTouch.a (3 slices)

Here the complete message :

ld: warning: ignoring file /Users/me/Desktop/project/libCorePlot-CocoaTouch.a, missing required architecture x86_64 in file /Users/me/Desktop/project/libCorePlot-CocoaTouch.a (3 slices)
Undefined symbols for architecture x86_64:
"_CPTDecimalFromCGFloat", referenced from:
  -[PatientConstanteVisualiser configurePlots] in PatientConstanteVisualiser.o
  -[PatientConstanteVisualiser configureAxes] in PatientConstanteVisualiser.o
"_CPTDecimalFromInteger", referenced from:
  -[PatientConstanteVisualiser configureAxes] in PatientConstanteVisualiser.o
"_OBJC_CLASS_$_CPTAxisLabel", referenced from:
  objc-class-ref in PatientConstanteVisualiser.o
"_OBJC_CLASS_$_CPTColor", referenced from:
  objc-class-ref in PatientConstanteVisualiser.o
"_OBJC_CLASS_$_CPTFill", referenced from:
  objc-class-ref in PatientConstanteVisualiser.o
"_OBJC_CLASS_$_CPTMutableLineStyle", referenced from:
  objc-class-ref in PatientConstanteVisualiser.o
"_OBJC_CLASS_$_CPTMutableTextStyle", referenced from:
  objc-class-ref in PatientConstanteVisualiser.o
"_OBJC_CLASS_$_CPTPlotSymbol", referenced from:
  objc-class-ref in PatientConstanteVisualiser.o
"_OBJC_CLASS_$_CPTScatterPlot", referenced from:
  objc-class-ref in PatientConstanteVisualiser.o
"_OBJC_CLASS_$_CPTTheme", referenced from:
  objc-class-ref in PatientConstanteVisualiser.o
"_OBJC_CLASS_$_CPTXYGraph", referenced from:
  objc-class-ref in PatientConstanteVisualiser.o
"_kCPTStocksTheme", referenced from:
  -[PatientConstanteVisualiser configureGraph] in PatientConstanteVisualiser.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 spent several hours on this issue... Please help...

Vandavandal answered 28/11, 2013 at 11:11 Comment(4)
change the architecture of the xcodePumpernickel
i tough coreplot not supported for 64 bit architecture did check outPumpernickel
No, I already used Core Plot in another project, and I was able to run it with Iphone Retina (4-Inch 64-bit). But I can't find why it does not work in my new project...Vandavandal
check my answer now @Pumpernickel
C
20

If you want a 64-bit version of Core Plot, you'll have to build a new version of the static library. Arm64 builds require iOS 7 but Core Plot supports earlier versions, too, so the pre-built library is 32-bit only.

Open CorePlot-CocoaTouch.xcodeproj and change the architecture settings to "Standard Architectures (including 64-bit)". Either build the "Universal Library" target and include the resulting static library in place of the one included with Core Plot 1.4 or use the dependent project setup instead.

Campanile answered 28/11, 2013 at 12:23 Comment(7)
Yep, it works ! It's weird because I do not need to do all these stuff in an other project, and it works like a charm both on 32 or 64 bit emulator...Vandavandal
I accept this answer, because it works. But the Ivan Genchev answer is working too. So thanks a lot Ivan, and Eric.Vandavandal
Hey Eric, I have a question about the CorePlot-CocoaTouch.xcodeproj. It won't open, and says that the "project.xcworkspace" is invalid and the "project.pbxproj" is missing. What's wrong?Stark
CorePlot-CocoaTouch.xcodeproj doesn't depend on any other projects or workspaces. What version are you using? How was it installed (from GitHub, from a release package, etc.)?Campanile
I just updated to XCode 5.1 and am just now seeing this problem. Building the Universal Library from Core Plot doesn't seem to fix anything, though-- I still get the same errors as Erzekiel. Is there anything new in 5.1 that bringing this problem back?Yates
Xcode 5.1 requires the 64-bit build. It was optional in prior versions.Campanile
I just noticed your post in the github issues about merging v2.0 into the master (issue #62) this weekend, so I may just wait and see if that fixes things. I tried building with 64-bit architecture as noted above, but I must be doing something wrong. Thanks for your work and answers, by the way!Yates
T
14

CorePlot has released 1.5.1 to work with Xcode 5.1. You only need to copy the CorePlotHeaders folder and the libCorePlot-CocoaTouch.a file to your project.

You can download it from here.

Trinetta answered 23/3, 2014 at 18:1 Comment(2)
thanks a lot, no more arm64 issues, just a small comment CorePlotHeaders folder and the libCorePlot-CocoaTouch.a are in Binaries\iOS folder of CorePLor_1.5.1.zip. Works like a charm.Volley
Can you please tell me where can i find CorePlotHeaders folder ?Psychodiagnosis
I
13

Try:

lipo -info libCorePlot-CocoaTouch.a

It's showing that the library is built for armv7, armv7s and i386 (32bit simulator) and that's not including the 64bit simulator. You'll have to build the lib for 64bit simulator and after that you can use lipo to add the 64bit lib to libCorePlot-CocoaTouch.a.

Output:

Architectures in the fat file: libCorePlot-CocoaTouch.a are: armv7 armv7s i386

PS: It's not going to work on iPhone 5S as well (no arm64).

EDIT:

Here are the steps you need to make in order to produce a binary that has both the arm64 and x86_64 architectures in it:

  1. download CorePlot_1.4 from https://code.google.com/p/core-plot/downloads/detail?name=CorePlot_1.4.zip&can=2&q=
  2. Open the Xcode project (CorePlot-CocoaTouch.xcodeproj) located in CorePlot_1.4/Source/framework
  3. Select "Standard architectures" for "architectures" and "Latest iOS (iOS 7)" for "Base SDK"
  4. Build the library (CMD+B)
  5. Go to CorePlot_1.4/Source/build/ in the terminal
  6. Run lipo -create ./Debug-iphoneos/libCorePlot-CocoaTouch.a ./Debug-iphonesimulator/libCorePlot-CocoaTouch.a -output core_plot_all.a
  7. Add the newly created lib (core_plot_all.a) to your project
  8. You're ready to go
Irisation answered 28/11, 2013 at 11:16 Comment(18)
I don't know what is lipo. Can you explain where can I find it ?Vandavandal
It is a command line tool. If you want to know more about lipo you can try man 1 lipo on the command line. If you are not familiar with bash you can also open the CorePlot-CocoaTouch.xcodeproj and build the library yourself (after you add the required architectures).Irisation
You can open the project (CorePlot-CocoaTouch.xcodeproj) and after that you have to change the base SDK to "Latest iOS (iOS 7)" and set the architectures to "Standard architectures", build the project (CMD+B) and after you are going to have two libraries in two separate dirs (/proj_dir/.../Debug-iphoneos/libCorePlot-CocoaTouch.a and /proj_dir/.../Debug-iphonesimulator/libCorePlot-CocoaTouch.a) and then you can use lipo to merge them: lipo -create ../Debug-iphoneos/libCorePlot-CocoaTouch.a ../Debug-iphonesimulator/libCorePlot-CocoaTouch.a -output core_plot_all.a.Irisation
I used lipo in the terminal. Here my result : Architectures in the fat file: /Users/me/Desktop/project/libCorePlot-CocoaTouch.a are: armv7 (cputype (12) cpusubtype (11)) i386Vandavandal
That is for the library that you already have. You have to download the Core Plot project, build the library yourself and after that you have to use "lipo -create", like I explained in my previous comment, because you don't have the required architectures in your current file. "lipo -info" is just showing the current architectures in the fat file.Irisation
It is in the link, that you added in you question: code.google.com/p/core-plot/downloads/…Irisation
You can find it in the CorePlot_1.4/Source/framework directoryIrisation
Oups ! Sorry. Ok, I try that you saidVandavandal
I edited my answer with all the steps you need to make in order to create your fat lib with all the required architectures in it.Irisation
Ok, I can build and run on Iphone Retina (4-Inch 64-bit) ! But now, I have many warnings with this message : "Implicit conversion loses integer precision: 'NSInteger' (aka 'long') to 'int'"... pffffVandavandal
That's because NSInteger (typedef long NSInteger;) is long on the 64bit CPU your Mac is running on... and you are casting that to int.Irisation
There's no need to use lipo to build a new static library. See my answer.Campanile
The universal library target was still building two separate libraries (for sim and device) and the one in Binaries/iOS/ was still the old one... maybe something got messed up.Irisation
"PS: It's not going to work on iPhone 5S as well (no arm64)." - This is incorrect arm64 is backwards compatible.Luxuriance
It is correct since the application supports arm64.Irisation
If you support armv7s and arm64 for example the Xcode build system is just creating two separate binaries (for armv7s and arm64) and merging them together using lipo at the end of the build (check your build logs). If the library you are linking to doesn't contain the arm64 slice you'll get linker errors during the link phase of the arm64 binary. If you only have an armv7s slice (you don't support arm64 at all) it will run on arm64.Irisation
@IvanGenchev Genchev I have followed all your steps as mentioned above & I have also found ./Debug-iphonesimulator/libCorePlot-CocoaTouch.a but I ma not able to find ./Debug-iphoneos/libCorePlot-CocoaTouch.a path after building it with 64 bit Standard_Architecture. Could you please help me out in this.Lolland
@Rajat Deep Singh - you have to build it for the device as well.Irisation
P
6

change the setting of Architecture of Xcode

enter image description here

Pumpernickel answered 28/11, 2013 at 11:12 Comment(1)
@Erzékiel try with new answerPumpernickel
P
5

If you don't want to go through the process of downloading and building the project, I built the universal library (for armv7, armv7s and arm64) and put it up here.

This is built from coreplot commit id cc0a18cef8915f4a11e0699e9429c0a2f0018b42.

Pulverable answered 9/2, 2015 at 19:39 Comment(0)
D
0

I followed the official document 'Using Core Plot In An Application' in Xcode 7.2.1 with iOS SDK 9.2. I got the same error even if the .a supported arm64, until I add the linker flag '-lCorePlot-CocoaTouch' in addition to '-OjbC'.

Derwin answered 20/3, 2016 at 14:40 Comment(0)
D
0

If you tried all above but still not work, try to set -ObjC -lCorePlot-CocoaTouch to 'Other Linker Flags' in 'Build Settings' or your project target.

Derwin answered 20/3, 2016 at 16:48 Comment(0)
V
0

Simplest Solution that works for me: Go to your project > build setting > architecture. Change architecture as armv7 and delete others like armv6,etc like as given in the image below :-

Change required

Vorfeld answered 17/5, 2016 at 9:21 Comment(1)
And what if you want to test under 64-bit simulator?Doeskin
I
0

I got same errors with Xcode7.3 + CocoaPod. And I fixed the issue with Other Linker Flags= $(inherited) .

Of course, this setting is only valid with CocoaPod.

Induction answered 28/5, 2016 at 3:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.