2016-11-30

Fix the Build Error of OpenCV iOS: OSError: [Errno 2] No such file or directory

If you are building th opencv for iOS on MacOS, and met the following build error:

My-MacBook-Pro:OpenCV My$ python opencv/platforms/ios/build_framework.py ios
Executing: ['cmake', '-GXcode', '-DAPPLE_FRAMEWORK=ON', '-DCMAKE_INSTALL_PREFIX=install', '-DCMAKE_BUILD_TYPE=Release', '-DIOS_ARCH=armv7', '-DCMAKE_TOOLCHAIN_FILE=/Users/Shared/AppCofe/Study/OpenCV/opencv/platforms/ios/cmake/Toolchains/Toolchain-iPhoneOS_Xcode.cmake', '-DENABLE_NEON=ON', '/Users/Shared/AppCofe/Study/OpenCV/opencv', '-DCMAKE_C_FLAGS=-fembed-bitcode', '-DCMAKE_CXX_FLAGS=-fembed-bitcode'] in /Users/Shared/AppCofe/Study/OpenCV/ios/build/armv7-iPhoneOS
============================================================
ERROR: [Errno 2] No such file or directory
============================================================
Traceback (most recent call last):
  File "opencv/platforms/ios/build_framework.py", line 88, in build
    self._build(outdir)
  File "opencv/platforms/ios/build_framework.py", line 82, in _build
    self.buildOne(t[0], t[1], mainBD, cmake_flags)
  File "opencv/platforms/ios/build_framework.py", line 138, in buildOne
    execute(cmakecmd, cwd = builddir)
  File "opencv/platforms/ios/build_framework.py", line 34, in execute
    retcode = check_call(cmd, cwd = cwd)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 535, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 522, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception

OSError: [Errno 2] No such file or directory


Here is the solution to save your time:

in terminal install CMake
My-MacBook-Pro:OpenCV My$ brew install cmake

No comments:

Post a Comment