无法为架构arm64和x86_64构建opencv ios框架 [英] Unable to build opencv ios framework for architecture arm64 and x86_64

查看:904
本文介绍了无法为架构arm64和x86_64构建opencv ios框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循opencv安装文档在iOS中安装当编译一个ios框架。但是,如果我没有更改 platform / ios / build_framework.py 并构建框架,我将会遇到以下错误:

I am following a opencv installation document Installation in iOS when compile a ios framework. However, if I did not change platform/ios/build_framework.py and build the framework, I will have the following errors:

build settings from command line:
    ARCHS = x86_64
    IPHONEOS_DEPLOYMENT_TARGET = 6.0
    SDKROOT = iphonesimulator6.1

Build Preparation
Build task concurrency set to 8 via user default IDEBuildOperationMaxNumberOfConcurrentCompileTasks

=== BUILD AGGREGATE TARGET ZERO_CHECK OF PROJECT OpenCV WITH CONFIGURATION Release ===
Check dependencies


=== BUILD NATIVE TARGET zlib OF PROJECT OpenCV WITH CONFIGURATION Release ===

=== BUILD NATIVE TARGET libjpeg OF PROJECT OpenCV WITH CONFIGURATION Release ===

** BUILD FAILED **

Build settings from command line:
    ARCHS = x86_64
    IPHONEOS_DEPLOYMENT_TARGET = 6.0
    SDKROOT = iphonesimulator6.1

=== BUILD NATIVE TARGET zlib OF PROJECT OpenCV WITH CONFIGURATION Release ===
Check dependencies
No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386).


** BUILD FAILED **

很多尝试,我发现如果我只编译架构armv7,armv7s和i386通过更改以下脚本在 platform / ios / build_framework.py 框架可以成功地构建。

Then, after many tries, I found that if I only compile for architecture armv7, armv7s and i386 by changing the following scripts in platform/ios/build_framework.py the framework can be built successfully.

targets = ["iPhoneOS", "iPhoneOS", "iPhoneSimulator"] #"iPhoneOS", "iPhoneSimulator"
    archs = ["armv7", "armv7s", "i386"]#"arm64", , "x86_64"
    for i in range(len(targets)):
        build_opencv(srcroot, os.path.join(dstroot, "build"), targets[i], archs[i])

任何想法如何我可以编译为arm64和x86_64架构?谢谢。

Any ideas on how I can compile for the arm64 and x86_64 architecture? Thanks.

推荐答案

取出i386并编译armv7,armv7s和arm64-这些是Xcode的64位的架构选项 - iPhone 5S。

Take out the i386 and compile for armv7,armv7s, and arm64 - these are the architecture option for Xcode for 64 bit - iphone5s.

不要混用英特尔和手臂规格,他们不会和不能混合。 architecture命令是通知编译器如何创建目标代码。因为intel是一个CISC处理器,而arm是一个RISC,它们的内部对象代码是非常不同的。
例如,MOVE命令可以为intel生成x'80'opcode(命令指令),而为ARM生成x'60'。据我所知,i386是旧的intel 32位架构,Xcode可能会做一些魔术,以具有通用的目标代码,可以运行在英特尔和RISC如果这样做 - 它不会有效率,它将永远是更好的编译到特定的架构。

Do not mix intel and arm specification they will not and cannot mix. The architecture command is to inform the compiler on how the object code will be created. Because intel is a CISC processor and arm is a RISC internally their object codes are very different. a MOVE command for example may generate an x'80'opcode (command instruction) for intel but an x'60'for ARM. far as I know an i386 is the old intel 32 bit architecture, Xcode maybe doing some magic to have universal object codes that can run on both intel and RISC if it is doing so - it will not be efficient, it will always be better to compile to specific architectures.

32位,64位128 ...是寻址模式 - 它们也是处理器寄存器的大小, (RAM)可以由CPU访问。一般来说,除了具有巨大RAM的能力之外,较高位的处理器通常会减少执行特定任务的指令数量。

The 32 bit, 64 bit 128 ..... are addressing modes - they are also the size of the processor registers and determine how much memory (RAM) can be accessed by the CPU. In general, aside from the ability to have huge RAM, higher bit processors will usually reduce the number of instructions to do a particular task.

由于向下兼容性通常是内置的,为armv6编译的应用程序通常在兼容模式下在armv7或arm64中运行,但是它不能利用运行一个真正的64位应用程序。

Because downward compatibility is usually built in, an app compiled for armv6 will typically run in armv7 or even arm64 in compatibility mode but it will not be able to harness the advantages of running a true 64 bit application.

目标是一个更高级别的规范,指定哪些命令可以用于例如iPad的UIPopViewController,但这不是在iPhone或一个iPod touch。

The targets is a higher level specification which specifies which commands can be used for example an iPad has UIPopViewController but this is not supported in an iPhone or an iPod touch.

最后一件事 - 只有iPhone 5s与arm64配合使用,如果你设置另一个目标,它可能会将arm64标记为不是一个选项。

One last thing - only iPhone 5s works with arm64 if you set another target it will probably flag arm64 as not an option.

这篇关于无法为架构arm64和x86_64构建opencv ios框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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