Segmentation Fault when attempting to import cv2 in Python 3 [closed]

asked 2019-07-17 17:49:18 -0500

132ikl gravatar image

updated 2019-07-17 22:00:50 -0500

Hi, I'm trying to use OpenCV 4.1.0, cross-compiled for armv6l from source with Python 3. When I try to import cv2 in Python, I receieve a Segementation fault and the Python interpreter is closed. Also, I recieve errors about Python not being able to find OpenCV .so files if I do not run ldconfig.

cmake -D CMAKE_BUILD_TYPE=Release \
    -D CMAKE_INSTALL_PREFIX="${ROOTFS_DIR}/usr/local" \
    -D CMAKE_TOOLCHAIN_FILE=../platforms/linux/arm-gnueabi.toolchain.cmake \
    -D OPENCV_ENABLE_NONFREE=ON \
    -D PYTHON3_INCLUDE_PATH=/usr/include/python3.7m \
    -D PYTHON3_LIBRARIES=/usr/lib/arm-linux-gnueabihf/libpython3.7m.so \
    -D PYTHON3_NUMPY_INCLUDE_DIRS=/usr/lib/python3/dist-packages/numpy/core/include \
    -D BUILD_opencv_python3=ON \
    -D PYTHON3_CVPY_SUFFIX='.cpython-37m-arm-linux-gnueabihf.so' \
    -D ENABLE_NEON=ON \
    -D ENABLE_VFPV3=ON \
    -D WITH_GTK=OFF \
    -D BUILD_TESTS=OFF \
    -D BUILD_DOCS=OFF \
    -D BUILD_EXAMPLES=OFF \
    -D BUILD_PERF_TESTS=OFF \
    -B "${CV_DIR}/build/" \
    -S "${CV_DIR}"

CMake Output: https://ikl.sh/c6d6

Make Output: https://ikl.sh/oQTA

Make Install Output: https://ikl.sh/QDrB

Thanks :)

EDIT: I can't answer my own question since I'm a new user.

The issue was that I was trying to use QEMU for the ARM target. It turns out it runs just fine on real hardware.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by berak
close date 2019-07-17 23:56:29.881674