JetsonHacksNano / buildOpenCV

Scripts for build OpenCV on the NVIDIA Jetson Nano Developer Kit
MIT License
143 stars 93 forks source link

Using the build script OpenCV-4.1.1-dirty-aarch64.sh #6

Closed lackdaz closed 4 years ago

lackdaz commented 4 years ago

So I'm one of those folks trying to use the packaged installer with the magic flag turned on, e.g: https://stackoverflow.com/questions/60081474/install-opencv-from-deb-file-in-docker

What I did: 1) Created a docker container with the following Dockerfile:

FROM nvcr.io/nvidia/l4t-base:r32.3.1 as base

ENV DEBIAN_FRONTEND noninteractive

WORKDIR /usr/src

RUN apt-get update && apt-get install -y --no-install-recommends make g++

COPY ./deviceQuery ./deviceQuery/

RUN make -C ./deviceQuery

FROM nvcr.io/nvidia/l4t-base:r32.3.1 as develop

COPY --from=base /usr/src/deviceQuery/deviceQuery /usr/src/deviceQuery
COPY ./torch-1.4.0-cp36-cp36m-linux_aarch64.whl /usr/src/.
COPY ./torch-1.4.0-cp36-cp36m-linux_aarch64.whl /tmp/
COPY ./OpenCV-4.1.1-dirty-aarch64.sh /tmp/

WORKDIR /usr/src

RUN apt-get update && \
    apt-get --yes install python3 python3-pip python3-wheel python3-numpy python3-scipy python3-dev \
    libopenblas-base mlocate && \
    sudo updatedb && \

    python3 -m pip install -U pip && \
    python3 -m pip install cython numpy /tmp/torch-1.4.0-cp36-cp36m-linux_aarch64.whl && \
    rm -rf /var/lib/apt/lists/* && \
    apt-get clean && \
    /tmp/OpenCV-4.1.1-dirty-aarch64.sh --prefix=/usr/local/ --skip-license && \
    rm *.whl

CMD ['tail -f /dev/null']

where I've copied in the installer OpenCV-4.1.1-dirty-aarch64.sh after saving it from a build with the same l4t image in a different container.

2) running /tmp/OpenCV-4.1.1-dirty-aarch64.sh --prefix=/usr/local/ --skip-license either in bash or during the build for the Dockerfile would move the binaries and lib files into its respective places in /usr/ or /usr/local - I've tried both

3) Finally I ran sudo ldconfig to update the python bindings

What I would expect 4) Running import cv2 in python3 would be successful, instead I get the dreaded segmentation fault error.

Python Version 3.6.9

lackdaz commented 4 years ago

I solved this by installing sudo apt-get install qt5-default

Maybe its because the QT flag was left on for my build because I can't understand why it would end up being a dependency