[英]Error while compiling iOS app with openCV framework on real device
With latest open cv framework i am unable to compile code on IOS device. 使用最新的开放式cv框架,我无法在IOS设备上编译代码。 i am facing following error. 我面临以下错误。
Undefined symbols for architecture arm64: "_png_init_filter_functions_neon", referenced from: _png_read_filter_row in opencv2(pngrutil.o) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) 体系结构arm64的未定义符号:“ _ png_init_filter_functions_neon”,引用自:opencv2(pngrutil.o)中的_png_read_filter_row ld:体系结构arm64找不到符号clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)
Same app is able to compile for simulator but not for ios devices. 同一应用程序可以针对模拟器进行编译,但不能针对ios设备进行编译。 Can any one tell me why i am facing this problem. 谁能告诉我为什么我要面对这个问题。 Thanks in advance. 提前致谢。
我已经解决了这个问题。这个问题的核心是我们重新编译了libpng中的某些内容,也许它在其他ios框架中退出了。然后发生了冲突。Opncv3.1的代码中包含3rdparty。您应该做的是查找行117-121在libpng的pngpriv.h中,然后跟随Iphone-device-linker错误 。
It appears that this commit fixes the issue, while still keeping NEON support for iOS devices: 看来,该提交解决了该问题,同时仍然保持了对iOS设备的NEON支持:
https://github.com/opencv/opencv/commit/262a52f3063c50fbb1236e2cba2bd3c68f9979bb https://github.com/opencv/opencv/commit/262a52f3063c50fbb1236e2cba2bd3c68f9979bb
Essentially, the clause that appends -DENABLE_NEON=ON
to the cmake
line was only applying to architectures beginning with "armv"
(note the "v"); 本质上,将-DENABLE_NEON=ON
附加到cmake
行的子句仅适用于以"armv"
(请注意“ v”)开头的体系结构; the above commit changes opencv/platforms/ios/build_framework.py
to allow the cmake command to work with "arm64"
as well. 上面的提交更改了opencv/platforms/ios/build_framework.py
以允许cmake命令也可以与"arm64"
一起使用。
Before: 之前:
if arch.startswith("armv"):
cmakecmd.append("-DENABLE_NEON=ON")
After: 后:
if arch.startswith("armv") or arch.startswith("arm64"):
cmakecmd.append("-DENABLE_NEON=ON")
Diagnostic process, since it might be useful: 诊断过程,因为它可能有用:
Found this by starting a script build.log
before invoking python ../opencv/platforms/ios/build_framework.py ios
and digging through output; 通过在调用python ../opencv/platforms/ios/build_framework.py ios
并挖掘输出之前启动script build.log
发现此问题; arm_init.c
was not built for arm64
(which is where png_init_filter_functions_neon
was defined) but was for armv7
and armv7s
. arm_init.c
不是为arm64
构建的(定义png_init_filter_functions_neon
地方),而是为armv7
和armv7s
。 From there, looking through 3rdparty/libpng/CMakeLists.txt
pointed at ENABLE_NEON
not being set. 从那里查看3rdparty/libpng/CMakeLists.txt
指向未设置的ENABLE_NEON
。
I faced the same problem as @shahzaib described. 我遇到了@shahzaib描述的相同问题。 In simulator it works but in iPhone its not working and showing the same error. 在模拟器中,它可以工作,但在iPhone中,它不能工作,并显示相同的错误。
Previously I manually added OpenCV 3.1 in my iOS project. 以前,我在iOS项目中手动添加了OpenCV 3.1。 Later I changed it and install the OpenCV library via cocoapod https://cocoapods.org/pods/OpenCV 后来我更改了它并通过cocoapod https://cocoapods.org/pods/OpenCV安装了OpenCV库
And in cocoapod there is 3.1.0.1 version which fixed the issue. 在cocoapod中有3.1.0.1版本修复了该问题。
pod 'OpenCV', '~> 3.1.0.1'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.