Lately I got some Apple Mach-O Linker Error when I was trying to compile my iOS project with a Core Plot (1.4) library against iPhone6 simulator. Error message looks like:
ld: warning: ignoring file .../libCorePlot-CocoaTouch.a, file was built for archive which is not the architecture being linked (i386): .../libCorePlot-CocoaTouch.a Undefined symbols for architecture i386: "_CPTDecimalFromDouble", referenced from:...
The reason is, that my library was built with an architecture for 32-bit simulator and iPhone5s, iPhone6 or iPhone6 Plus simulators need a 64bit architecture.
You can check the architecture your library is built for in terminal using lipo
lipo -info libCorePlot-CocoaTouch.a
If output looks like this
armv7 armv7s i386
you need to create a build for x86_64.
At first download Core Plot an unzip it.
Then open the Core Plot project in XCode. It is located at CorePlot_1.4/Source/framework/CorePlot-CocoaTouch.xcodeproj.
After that you have to make sure, that the project is built for the right architecture. So you select Standard architecture (armv7, arm64) and for Base SDK Latest iOS (iOS 8.0) like in image below.
Now you build the library with CMD+B. It can happen that the build fails and you get some errors. That can be managed if you change Treat Warnings as Errors to No like in image below.
The library can be found in CorePlot_1.4/Source/build/Debug-iphonesimulator/libCorePlot-CocoaTouch.a
That library works for all 64bit simulators but if you like to use that library in e.g. iPhone5 simulator you get the Linker Error again.
To make your library universal you have to combine libraries for both architectures. For that copy the libCorePlot-CocoaTouch.a from CorePlot_1.4/Binaries/iOS/ to CorePlot_1.4/Source/build/Debug-iphonesimulator/ with new filename libCorePlot-CocoaTouch2.a.
Now go to terminal and change the directory to CorePlot_1.4/Source/build. Then create the new combined library file:
lipo -create Debug-iphonesimulator/libCorePlot-CocoaTouch.a Debug-iphonesimulator/libCorePlot-CocoaTouch2.a -output coreplot_new.a
The new file coreplot_new.a can now be used for all simulators and architectures in your xcode project.