OpenCV.Framework不为armv7s架构编译 [英] OpenCV.Framework does not compile for the armv7s architecture

查看:156
本文介绍了OpenCV.Framework不为armv7s架构编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用openCV框架开发iphone应用程序。
一切都很好。然而,最近随着iOS 6和XCode 4.5的发布我将我的项目迁移到XCode 4.5
构建时我遇到了这个错误:

I am working on an iphone application using openCV framework. Everything was working fine. however lately with the release of iOS 6 and XCode 4.5 I was migrating my project to XCode 4.5 When building I encountered this error:


ld:文件是通用的(2个切片),但不包含(n)armv7s
切片:
/Users/jobs/iPhone_Client/workspace/MyProject/third-party/OpenCV.framework/OpenCV
for architecture armv7s clang:错误:链接器命令失败,退出
代码1(使用-v查看调用)

ld: file is universal (2 slices) but does not contain a(n) armv7s slice: /Users/jobs/iPhone_Client/workspace/MyProject/third-party/OpenCV.framework/OpenCV for architecture armv7s clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED * *

** BUILD FAILED **

以下构建命令失败:
Ld build / MyProject.build / Debug-iphoneos / MyProject.build / Objects-normal / armv7s / MyProject
普通armv7s(1次失败)

The following build commands failed: Ld build/MyProject.build/Debug-iphoneos/MyProject.build/Objects-normal/armv7s/MyProject normal armv7s (1 failure)

据我所知,这是由于新的 armv7s 架构。
OpenCV显然不是用armv7编译的。

As I understood this is due to the new armv7s architecture. OpenCV is apparently it is not compiling with armv7s.

如何解决此问题?

在哪里可以找到与armv7s架构兼容的新版本框架?

Where can I find a new release of the framework that is compatible with the armv7s architecture?

如果没有可用的兼容框架,有没有办法获取源代码并创建我自己的库,针对新架构编译?也许有一些快速步骤可以做到这一点?

And if there is no compatible framework available, is there a way to get the source code and create my own library compiled against the new architecture? Maybe some quick steps on how to do it?

注意:请注意我需要构建 armv7s 不是 armv7
谢谢

Note: Just to note that I need the build for armv7s not armv7. Thank you

推荐答案

这个答案建立在n9986给出的答案之上。正如他所建议的,我克隆了在

This answer builds upon the one given by n9986. As he suggested, I cloned the repository found at

https:// github上找到的存储库.com / jonmarimba / OpenCV-iOS

当我下载它时,项目内部的几个引用被打破了,这很奇怪,但它们很容易修复。修复后,它的行为与n9986所描述的完全相同,输出为armv7和armv7s编译的库。然而,出于我的目的,我要求将它们捆绑到一个.framework中,以便它们可以替代我一直在使用的旧框架。

When I downloaded it several references inside the project to different libraries were broken which was strange but they were easy to fix. After they were fixed it behaved exactly as n9986 described, outputting libraries compiled for both armv7 and armv7s. For my purposes however I required that they be bundled into a .framework so that they could be a drop in replacement for the old .framework I have been using.

之前我已经下载了最新版本的Opencv for ios 此处并花了相当多的时间尝试修改他们的cmake文件,以支持armv7s进行编译。 jonmarimba已经重新构建了xcode项目文件,以消除其cmake依赖关系,这使得更改目标架构变得更加直观。不幸的是,他没有构建与标准openCV构建一样多的库。我为jonmarimba的opencv_world项目添加了一个新目标,opencv_world是标准openCV版本中用于转换为框架的目标。一旦构建完成,我就用它作为标准openCV版本生成的框架文件结构中静态库的替代品。

Previously I had downloaded the latest version of Opencv for ios here and spent quite a bit of time trying to modify their cmake files to compile with support for armv7s. jonmarimba has already restructured the xcode project file to strip away its cmake dependencies which makes changing the target architecture much more intuitive. Unfortunately he does not build as many libraries as come with the standard openCV build. I added a new target to jonmarimba's project for opencv_world which is the target used in the standard openCV release for converting into a framework. Once that was built I used it as a drop in replacement for the static library in the framework file structure generated by the standard openCV release.

我创建的框架可以在这里下载。它对我来说非常适合作为我以前的opencv2.framework的替代品。我注意到jonmarimba没有转换opencv_videostab,opencv_stitching或opencv_nonfree的目标。如果您使用其中一个库,我的框架可能不适合您。如果是这种情况,请告诉我,我可以尝试将这些设置为xcode项目中的目标。

The framework I created can be downloaded here. It works perfectly for me as a drop in replacement for my previous opencv2.framework. I did notice however that jonmarimba has not converted the targets for opencv_videostab, opencv_stitching, or opencv_nonfree. It is possible that if you use one of those libraries my framework will not work for you. If that is the case let me know and I can try to set those up as targets in the xcode project for you.

更新

要编译其他体系结构,请将包含的xcode项目中的目标体系结构更改为opencv_world库中您喜欢的任何内容。构建之后,找到刚刚构建的库。将opencv_world库重命名为opencv2,并将.framework中的库文件替换为opencv_world。

To compile for other architectures, change the target architecture in the included xcode project to whatever you like for the opencv_world library. After you build it, go find the library you just built. Rename the opencv_world library to opencv2 and replace the library file found in the .framework with opencv_world.

Update2

OpenCV 2.4.3 现在默认编译armv7s,所以这些解决方案已过时。

OpenCV 2.4.3 now compiles with armv7s support by default so these solutions are outdated.

这篇关于OpenCV.Framework不为armv7s架构编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆