A bit complex this one. Configuring from a 3.4.1 tarball for aarch64 works if the cmake configuration stage is run on a native ARM64 machine. However, in a chroot with correctly installed Python 3 and numpy it fails. Any thoughts welcomed.
I think the core problem is CMake cannot complete the numpy probe. From the log below:
Cannot probe for Python/Numpy support (because we are cross-compiling OpenCV)
Running python3 in the chroot gives this.
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux Type "help", "copyright",
"credits" or "license" for more information.
>>> import numpy
>>> numpy.__version__ '1.15.0'
file /usr/bin/python3.5 /usr/bin/python3.5: ELF 64-bit LSB
shared object, ARM aarch64, version 1 (SYSV), dynamically linked,
interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0,
BuildID[sha1]=125327436b53ba5dbbc02d359984226437a132ce, stripped
The configuration options are (please bear in mind this is for an embedded platform so dependencies are minimized as far as possible)
cmake -D CMAKE_BUILD_TYPE=RELEASE -D BUILD_PYTHON3=ON -D BUILD_OPENCV_PYTHON2=OFF -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.4.1/modules _D WITH_NEON=ON -D BUILD_JAVA=OFF -D WITH_LAPACK=OFF -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D WITH_CAROTENE=OFF -D WITH_TBB=OFF -D WITH_OPENCL=OFF -D WITH_NVCUVID=OFF -D WITH_OPENCL_SVM=OFF -D WITH_OPENCLAMDFFT=OFF -D WITH_OPENCLAMDBLAS=OFF -D WITH_OPENEXR=OFF -D WITH_MATLAB=OFF -D WITH_GTK=OFF -D WITH_GSTREAMER=OFF -D WITH_GPHOTO2=OFF -D WITH_FFMPEG=OFF -D WITH_CUBLAS=OFF -D WITH_CUDA=OFF -D WITH_CUFFT=OFF -D WITH_EIGEN=OFF -D WITH_VTK=OFF -D WITH_JASPER=OFF -D WITH_WEBP=OFF -D WITH_1394=OFF -D BUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=install -D PYTHON3_LIBRARIES=usr/lib/aarch64-linux-gnu/libpython3.5m.so -D PYTHON3_LIBRARY=usr/lib/aarch64-linux-gnu/libpython3.5m.so -D PYTHON_INCLUDE_DIRS=/usr/include/python3.5m -D PYTHON3_INCLUDE_PATH=/usr/include/python3.5m -D PYTHON3_INCLUDE_DIR=/usr/include/python3.5m -D PYTHON3_NUMPY_INCLUDE_DIRS=/usr/local/lib/python3.5/dist-packages/numpy/core/include -DPYTHON_DEFAULT_EXECUTABLE=$(which python3) -D CMAKE_TOOLCHAIN_FILE=../opencv-3.4.1/platforms/linux/aarch64-gnu.toolchain.cmake ../opencv-3.4.1 2>&1 | tee config.log
The config.log file (why no text attachments BTW?) contains this:
-- The CXX compiler identification is GNU 6.3.0
-- The C compiler identification is GNU 6.3.0
-- Check for working CXX compiler: /usr/bin/aarch64-linux-gnu-g++
-- Check for working CXX compiler: /usr/bin/aarch64-linux-gnu-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc
-- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test HAVE_CXX11 (check file: cmake/checks/cxx11.cpp)
-- Performing Test HAVE_CXX11 - Success
-- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.13", minimum required is "2.7")
-- Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is at least version "2.7")
-- Cannot probe for Python/Numpy support (because we are cross-compiling OpenCV)
-- If you want to enable Python/Numpy support, set the following variables:
-- PYTHON2_INCLUDE_PATH
-- PYTHON2_LIBRARIES (optional on Unix-like systems)
-- PYTHON2_NUMPY_INCLUDE_DIRS
-- PYTHON3_INCLUDE_PATH
-- PYTHON3_LIBRARIES (optional on Unix-like systems)
-- PYTHON3_NUMPY_INCLUDE_DIRS
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.5.3", minimum required is "3.4")
-- Could NOT find PythonLibs (missing: PYTHON_INCLUDE_DIRS) (Required is at least version "3.5")