opencv / opencv/opencv-python

Cross-compiling for aarch64

Open
#1,027 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.4k
Forks
1k
Avg merge
22h 17m
Merged PRs (30d)
3

Description

I am trying to cross-compile and create a wheel file for the aarch64 board.

`

sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu

export CC=aarch64-linux-gnu-gcc
export CXX=aarch64-linux-gnu-g++
export CMAKE_ARGS="-DWITH_GSTREAMER=ON -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DCMAKE_C_COMPILER=${CC} -DCMAKE_CXX_COMPILER=${CXX}"

pip wheel . --verbose

`

These are the steps I followed.

I am facing the below error.

`  [633/1779] Building CXX object modules/flann/CMakeFiles/opencv_flann.dir/src/miniflann.cpp.o
  ninja: build stopped: subcommand failed.
  Traceback (most recent call last):
    File "/tmp/pip-build-env-6betf83d/overlay/lib/python3.8/site-packages/skbuild/setuptools_wrap.py", line 668, in setup
      cmkr.make(make_args, install_target=cmake_install_target, env=env)
    File "/tmp/pip-build-env-6betf83d/overlay/lib/python3.8/site-packages/skbuild/cmaker.py", line 696, in make
      self.make_impl(clargs=clargs, config=config, source_dir=source_dir, install_target=install_target, env=env)
    File "/tmp/pip-build-env-6betf83d/overlay/lib/python3.8/site-packages/skbuild/cmaker.py", line 741, in make_impl
      raise SKBuildError(msg)

  An error occurred while building with CMake.
    Command:
      /tmp/pip-build-env-6betf83d/overlay/lib/python3.8/site-packages/cmake/data/bin/cmake --build . --target install --config Release --
    Install target:
      install
    Source directory:
work/learn/OCV_BUILD/opencv-python
    Working directory:
      work/learn/OCV_BUILD/opencv-python/_skbuild/linux-x86_64-3.8/cmake-build
  Please check the install target is valid and see CMake's output for more information.

  error: subprocess-exited-with-error
  
  × Building wheel for opencv-python (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command:miniconda3/envs/dms/bin/python miniconda3/envs/dms/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /tmp/tmpa3qkfach
  cwd: work/learn/OCV_BUILD/opencv-python
  Building wheel for opencv-python (pyproject.toml) ... error
  ERROR: Failed building wheel for opencv-python
Failed to build opencv-python
ERROR: Failed to build one or more wheels

`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the aarch64 wheel build with the shown compiler and CMAKE_ARGS settings, then inspect the compiler diagnostics preceding the ninja failure in modules/flann. Compare the wheel build configuration and CMake output; done means the command completes and produces an aarch64 wheel.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.