Docker build fails on docker hub

asked 2020-04-28 10:34:45 -0500

Josvds gravatar image

I`m creating a dockerfile which contains both .NET Core, OpenCV and OpenCVSharp. You can find the full Dockerfile here: https://github.com/Josvds/dotnetopenc...

During the build I get the following error, no matter what I change. I have tried this with using git clone and checking out the exact version also tried it with downloading zip and extracting.

[ 77%] Built target opencv_datasets
[ 77%] Generating qrc_window_QT.cpp
RCC: Error in '/build/opencv/modules/highgui/src/window_QT.qrc': Cannot find file 'files_Qt/Milky/48/28.png'

make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/build.make:78: modules/highgui/qrc_window_QT.cpp] Error 1

make[1]: *** [CMakeFiles/Makefile2:4375: modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2

make: *** [Makefile:163: all] Error 2

Removing intermediate container ee966db89e4a
The command '/bin/sh -c make -j$(nproc)' returned a non-zero code: 2

When building this on my desktop (windows) or my personal server (debian) the build works perfectly.

RUN cmake \
    # Compiler params
    -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/build/dist \
    -D OPENCV_GENERATE_PKGCONFIG=YES \
    # Modules
    -D OPENCV_EXTRA_MODULES_PATH=/build/opencv_contrib/modules \
    # No examples
    -D INSTALL_PYTHON_EXAMPLES=NO \
    -D INSTALL_C_EXAMPLES=NO \
    # Support
    -D WITH_IPP=NO \
    -D WITH_1394=NO \
    -D WITH_LIBV4L=NO \
    -D WITH_V4l=YES \
    -D WITH_TBB=YES \
    -D WITH_FFMPEG=YES \
    -D WITH_GPHOTO2=YES \
    -D WITH_GSTREAMER=YES \
    -D WITH_QT=YES \
    -D WITH_OPENGL=YES \
    # NO doc test and other bindings
    -D BUILD_DOCS=NO \
    -D BUILD_TESTS=NO \
    -D BUILD_PERF_TESTS=NO \
    -D BUILD_EXAMPLES=NO \
    -D BUILD_opencv_java=NO \
    -D BUILD_opencv_python2=NO \
    -D BUILD_ANDROID_EXAMPLES=NO ..
RUN make -j$(nproc)
RUN make install

What I want to achieve with this is having one container (which I don't have to build over and over again) for several applications I`m creating. Within this I would like to be able to read MP4 files and RTSP streams (via TCP and UDP) from .NET Core with OpenCVSharp.

Someone with any idea what I`m doing wrong?

edit retag flag offensive close merge delete

Comments

will this even run on a machine with a desktop / monitor ?

somehow your qt install looks broken, but i bet you do not need any gui at all here and could just

cmake -DBUILD_opencv_highgui=OFF
berak gravatar imageberak ( 2020-04-28 10:46:44 -0500 )edit

Thanks for the quick response. I tried this out now I get this.

[ 81%] Building CXX object modules/dnn_objdetect/CMakeFiles/opencv_dnn_objdetect.dir/src/core_detect.cpp.o
In file included from /build/opencv_contrib/modules/dnn_objdetect/src/core_detect.cpp:6:
/build/opencv_contrib/modules/dnn_objdetect/include/opencv2/core_detect.hpp:10:10: fatal error: opencv2/highgui.hpp: No such file or directory
 #include <opencv2/highgui.hpp>
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [modules/dnn_objdetect/CMakeFiles/opencv_dnn_objdetect.dir/build.make:63: modules/dnn_objdetect/CMakeFiles/opencv_dnn_objdetect.dir/src/core_detect.cpp.o] Error 1
Josvds gravatar imageJosvds ( 2020-04-28 11:25:03 -0500 )edit

that's a small bug (dnn_objdetect should not depend on highgui at all)

for now, you can disable it:

cmake -DBUILD_opencv_objdetect=OFF

if you want to keep the module, it seems safe to remove the include, it's not needed at all

berak gravatar imageberak ( 2020-04-29 02:10:12 -0500 )edit

After changing this setting, i still got the same error.. I`m also not exactly sure which of these I need for MP4 and RTSP.

-D WITH_IPP=NO \
-D WITH_1394=NO \
-D WITH_LIBV4L=NO \
-D WITH_V4l=YES \
-D WITH_TBB=YES \
-D WITH_FFMPEG=YES \
-D WITH_GPHOTO2=YES \
-D WITH_GSTREAMER=YES \
-D WITH_QT=YES \
-D WITH_OPENGL=YES \
Josvds gravatar imageJosvds ( 2020-04-29 11:37:06 -0500 )edit

which of these I need for MP4 and RTSP.

ffmpeg or gstreamer

berak gravatar imageberak ( 2020-04-29 13:00:14 -0500 )edit

Thanks this worked for me, by reducing these items I was able to get it working on docker hub. Thanks a lot.

Josvds gravatar imageJosvds ( 2020-04-30 04:10:50 -0500 )edit