Compile OpenCV for iOS fails

2019-08-03 16:04发布

Does anyone have idea why this error occurs?

I run $ python platforms/ios/build_framework.py ios to create the framework of OpenCV for iOS. But the install failed.

Platform information: OpenCV latest commit from today, CMake 2.8.12.2, XCode 5.1.1, Mac OSX 10.9.2

I followed this tutorial: Installing Opencv For iOS

** INSTALL FAILED **


The following build commands failed:
    Libtool ios/build/iPhoneSimulator-x86_64/modules/world/UninstalledProducts/libopencv_world.a normal x86_64
(1 failure)
Traceback (most recent call last):
  File "platforms/ios/build_framework.py", line 112, in <module>
    build_framework(os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "../..")), os.path.abspath(sys.argv[1]))
  File "platforms/ios/build_framework.py", line 104, in build_framework
    put_framework_together(srcroot, dstroot)
  File "platforms/ios/build_framework.py", line 80, in put_framework_together
    shutil.copytree(tdir0 + "/install/include/opencv2", dstdir + "/Headers")
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 171, in copytree
    names = os.listdir(src)
OSError: [Errno 2] No such file or directory: '../build/iPhoneOS-arm64/install/include/opencv2'

3条回答
对你真心纯属浪费
2楼-- · 2019-08-03 16:37

Just today I've faced the same problem and solved it with a simple command:

brew install cmake

This solution was described here.

查看更多
Juvenile、少年°
3楼-- · 2019-08-03 16:49

molbdnilo is right:) Building the latest release is always better idea than building the latest commit. Thanks. I have downloaded the latest release of OpenCV which is 2.4.8 right now and built it again. Everything worked fine.

查看更多
来,给爷笑一个
4楼-- · 2019-08-03 16:51

As @enreas mentioned in his answer, the problem is that you don't have cmake installed. That would solve the problem.

There are many ways to do this, the easiers are via either homebrew or MacPorts:

homebrew version:

brew install cmake

MacPorts:

port install cmake
查看更多
登录 后发表回答