ios 文件 libCorePlot-CocoaTouch.a 中缺少所需的架构 x86_64

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20264574/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 22:32:30  来源:igfitidea点击:

missing required architecture x86_64 in file libCorePlot-CocoaTouch.a

iosiphonexcodexcode5core-plot

提问by Erzékiel

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

根据Ray Wenderlich 教程,我完成了以下操作:

Step 1 -I downloaded CorePlot_1.4.zipon the official website

第 1 步 -我在官方网站上下载了CorePlot_1.4.zip

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

第 2 步 -我将CorePlotHeaders 文件夹名为 libCorePlot-CocoaTouch.a静态库添加到我的项目中(选中“Copy items into destination group's folder (if needed)”

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

第 3 步 -我在其他链接器标志字段添加了以下内容:-ObjC

Step 4- I checked into Link Binary with Librariesif libCorePlot-CocoaTouch.aand QuartzCoreframeworks were here

第 4 步-如果libCorePlot-CocoaTouch.aQuartzCore框架在这里,我会检查Link Binary with Libraries

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 :

结果:当我编译我的项目时,当我使用Iphone Retina (4-Inch)时它工作正常。但是当我使用Iphone Retina(4 英寸 64 位)时,当我尝试构建和运行时收到以下消息:

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

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...

我在这个问题上花了几个小时...请帮忙...

回答by Eric Skroch

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.

如果您想要 64 位版本的 Core Plot,则必须构建一个新版本的静态库。Arm64 构建需要 iOS 7,但 Core Plot 也支持早期版本,因此预构建库仅为 32 位。

Open CorePlot-CocoaTouch.xcodeprojand 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.

打开CorePlot-CocoaTouch.xcodeproj并将架构设置更改为“标准架构(包括 64 位)”。要么构建“通用库”目标并包含生成的静态库来代替 Core Plot 1.4 中包含的静态库,要么使用相关项目设置。

回答by Ojancano

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.

CorePlot 已发布 1.5.1 以与 Xcode 5.1 配合使用。您只需要将 CorePlotHeaders 文件夹和 libCorePlot-CocoaTouch.a 文件复制到您的项目中。

You can download it from here.

你可以从这里下载。

回答by Ivan Genchev

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.

它表明该库是为 armv7、armv7s 和 i386(32 位模拟器)构建的,不包括 64 位模拟器。您必须为 64 位模拟器构建库,然后您可以使用 lipo 将 64 位库添加到 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).

PS:它也不适用于 iPhone 5S(没有 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:

以下是生成包含 arm64 和 x86_64 架构的二进制文件所需执行的步骤:

  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
  1. https://code.google.com/p/core-plot/downloads/detail?name=CorePlot_1.4.zip&can=2&q=下载 CorePlot_1.4
  2. 打开位于 CorePlot_1.4/Source/framework 的 Xcode 项目 (CorePlot-CocoaTouch.xcodeproj)
  3. 为“架构”选择“标准架构”,为“基础 SDK”选择“最新 iOS (iOS 7)”
  4. 构建库 (CMD+B)
  5. 转到终端中的 CorePlot_1.4/Source/build/
  6. 运行 lipo -create ./Debug-iphoneos/libCorePlot-CocoaTouch.a ./Debug-iphonesimulator/libCorePlot-CocoaTouch.a -output core_plot_all.a
  7. 将新创建的库 (core_plot_all.a) 添加到您的项目中
  8. 你准备好了

回答by codercat

change the setting of Architecture of Xcode

更改 Xcode 架构的设置

enter image description here

在此处输入图片说明

回答by James Whong

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.

如果你不想经历下载和构建项目的过程,我构建了通用库(适用于 armv7、armv7s 和 arm64)并放在这里

This is built from coreplot commit id cc0a18cef8915f4a11e0699e9429c0a2f0018b42.

这是从 coreplot 提交 ID cc0a18cef8915f4a11e0699e9429c0a2f0018b42 构建的。

回答by firebear

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'.

我在带有 iOS SDK 9.2 的 Xcode 7.2.1 中遵循了官方文档“在应用程序中使用核心绘图”。即使 .a 支持 arm64,我也遇到了同样的错误,直到我在“-OjbC”之外添加了链接器标志“-lCorePlot-CocoaTouch”。

回答by firebear

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.

如果您尝试了以上所有方法但仍然无效,请尝试在“构建设置”或您的项目目标中将 -ObjC -lCorePlot-CocoaTouch 设置为“其他链接器标志”。

回答by shubham mishra

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 :-

对我有用的最简单的解决方案:转到您的项目 > 构建设置 > 架构。将架构更改为 armv7 并删除其他架构,如 armv6 等,如下图所示:-

Change required

需要更改

回答by kmugitani

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

我在 Xcode7.3 + CocoaPod 上遇到了同样的错误。我用 Other Linker Flags= $(inherited) 解决了这个问题。

Of course, this setting is only valid with CocoaPod.

当然,这个设置只对 CocoaPod 有效。