Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opencv recipe build error #871

Closed
Fak3 opened this issue Aug 26, 2016 · 3 comments
Closed

opencv recipe build error #871

Fak3 opened this issue Aug 26, 2016 · 3 comments

Comments

@Fak3
Copy link
Contributor

Fak3 commented Aug 26, 2016

I tried to build distro with opencv, but got an error

$ p4a create  --dist_name=testpygame --bootstrap=pygame --requirements=pygame,openssl,opencv,setuptools,python2,tinydb
...
[INFO]:    Building opencv for armeabi
[INFO]:    -> directory context /home/u1/.local/share/python-for-android/build/other_builds/opencv/armeabi/opencv
('path is', '/home/z/soft/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86/bin/:/home/z/soft/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/:/home/z/soft/android-ndk-r12b:/home/u1/Android/Sdk/tools:/usr/local/heroku/bin:/home/u1/.local/bin:/usr/local/heroku/bin:/home/u1/.local/bin:/home/u1/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/opt/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:.:/usr/sbin:/usr/sbin')
[INFO]:    -> running cmake -DP4A=ON -DANDROID_ABI=armeabi -DCMAKE_TOOLCHAIN_FILE=/home/u1/.local/share/python-for-android/build/other_builds/opencv/armeabi/opencv/platforms/android/an...(and 748 more)
Traceback (most recent call last):                                                                                                                                                                                 
  File "/usr/bin/p4a", line 9, in <module>
    load_entry_point('python-for-android==0.4', 'console_scripts', 'p4a')()
  File "/usr/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 790, in main
    ToolchainCL()
  File "/usr/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 464, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/usr/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 145, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/usr/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 188, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx)
  File "/usr/lib/python2.7/site-packages/pythonforandroid/build.py", line 561, in build_recipes
    recipe.build_arch(arch)
  File "/usr/lib/python2.7/site-packages/pythonforandroid/recipes/opencv/__init__.py", line 52, in build_arch
    _env=env)
  File "/usr/lib/python2.7/site-packages/pythonforandroid/logger.py", line 173, in shprint
    for line in output:
  File "/usr/lib/python2.7/site-packages/sh.py", line 565, in next
    self.wait()
  File "/usr/lib/python2.7/site-packages/sh.py", line 500, in wait
    self.handle_command_exit_code(exit_code)
  File "/usr/lib/python2.7/site-packages/sh.py", line 516, in handle_command_exit_code
    raise exc(self.ran, self.process.stdout, self.process.stderr)
sh.ErrorReturnCode_1: 

  RAN: '/usr/bin/cmake -DP4A=ON -DANDROID_ABI=armeabi -DCMAKE_TOOLCHAIN_FILE=/home/u1/.local/share/python-for-android/build/other_builds/opencv/armeabi/opencv/platforms/android/android.toolchain.cmake -DPYTHON_INCLUDE_PATH=/home/u1/.local/share/python-for-android/build/python-installs/testpygame/include/python2.7 -DPYTHON_LIBRARY=/home/u1/.local/share/python-for-android/build/python-installs/testpygame/lib/libpython2.7.so -DPYTHON_NUMPY_INCLUDE_DIR=/home/u1/.local/share/python-for-android/build/python-installs/testpygame/lib/python2.7/site-packages/numpy/core/include -DANDROID_EXECUTABLE=/home/u1/Android/Sdk/tools/android -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_ANDROID_EXAMPLES=OFF -DPYTHON_PACKAGES_PATH=/home/u1/.local/share/python-for-android/build/python-installs/testpygame/lib/python2.7/site-packages /home/u1/.local/share/python-for-android/build/other_builds/opencv/armeabi/opencv'

  STDOUT:
CMake Error at platforms/android/android.toolchain.cmake:827 (list):
  list index: 5 out of range (-5, 4)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/CMakeDetermineSystem.cmake:98 (include)
  CMakeLists.txt:56 (project)


CMake Error at platforms/android/android.toolchain.cmake:873 (message):
  Specified Android native API level 'android-8' is not supported by your
  NDK/toolchain.
Call Stack (most recent call first):
  /usr/share/cmake/Modules/CMakeDetermineSystem.cmake:98 (include)
  CMakeLists.txt:56 (project)


-- Detected version of GNU GCC: 49 (409)
-- Performing Test HAVE_CXX_FSIGNED_CHAR
CMake Error at /home/u1/.local/share/python-for-android/build/other_builds/opencv/armeabi/opencv/platforms/android/android.toolchain.cmake:727 (message):
  Specified ANDROID_ABI = "armeabi" is not supported by this cmake toolchain
  or your NDK/toolchain.

     Supported values are: "x86"

Call Stack (most recent call first):
  /tmp/p4a-build/other_builds/opencv/armeabi/opencv/CMakeFiles/3.0.2/CMakeSystem.cmake:6 (include)
  CMakeLists.txt:2 (project)


CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Configuring incomplete, errors occurred!
See also "/tmp/p4a-build/other_builds/opencv/armeabi/opencv/CMakeFiles/CMakeOutput.log".


  STDERR:

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@Fak3
Copy link
Contributor Author

Fak3 commented Aug 26, 2016

I managed to fix that by adding two flags to cmake in the recipe:

'-DANDROID_NATIVE_API_LEVEL=%s' % os.environ['ANDROIDAPI'],
 '-DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.9',

Hardcoded toolchain name only works for my NDK version. The real fix should somehow detect the proper value for ANDROID_TOOLCHAIN_NAME from what NDK provides

@inclement
Copy link
Member

Thanks for noting the fix!

@inclement
Copy link
Member

Fixed by #1650, other fixes can follow from that if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants