opencv / opencv

Open Source Computer Vision Library
https://opencv.org
Apache License 2.0
79.04k stars 55.82k forks source link

docker Compiling opencv with from openjdk 11 gives cc1: warning: ‘-Werror=’ argument ‘-Werror=non-virtual-dtor’ #20768

Closed HughWick closed 3 years ago

HughWick commented 3 years ago

System information (version):

docker version 20.10.8
opencv version 3.4.4
oenjdk11 gcc version 10.2.1 20210110 (Debian 10.2.1-6) 
openjdk8 gcc version 8.3.0 (Debian 8.3.0-6) 

The opencv version number is all 3.4.4, but when the docker container is openjdk8, the service builds and starts fine, but when I switch from openjdk8 to openjdk11, I encounter the following C compilation error

[  1%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jcapistd.c.o
cc1: warning: ‘-Werror=’ argument ‘-Werror=non-virtual-dtor’ is not valid for C
cc1: warning: command-line option ‘-Wsign-promo’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-Wno-delete-non-virtual-dtor’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-fvisibility-inlines-hidden’ is valid for C++/ObjC++ but not for C
[  2%] Generate opencv.pc
[  2%] Building C object 3rdparty/ittnotify/CMakeFiles/ittnotify.dir/src/ittnotify/ittnotify_static.c.o
[  2%] Building C object 3rdparty/quirc/CMakeFiles/quirc.dir/src/version_db.c.o
cc1: warning: ‘-Werror=’ argument ‘-Werror=non-virtual-dtor’ is not valid for C
cc1: warning: command-line option ‘-Wsign-promo’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-Wno-delete-non-virtual-dtor’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-fvisibility-inlines-hidden’ is valid for C++/ObjC++ but not for C
[  2%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc_pch_dephelp.dir/opencv_imgproc_pch_dephelp.cxx.o
[  2%] Building CXX object modules/ml/CMakeFiles/opencv_ml_pch_dephelp.dir/opencv_ml_pch_dephelp.cxx.o
cc1: warning: ‘-Werror=’ argument ‘-Werror=non-virtual-dtor’ is not valid for C
cc1: warning: command-line option ‘-Wsign-promo’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-Wno-delete-non-virtual-dtor’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-fvisibility-inlines-hidden’ is valid for C++/ObjC++ but not for C
cc1: warning: ‘-Werror=’ argument ‘-Werror=non-virtual-dtor’ is not valid for C
cc1: warning: command-line option ‘-Wsign-promo’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-Wno-delete-non-virtual-dtor’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-fvisibility-inlines-hidden’ is valid for C++/ObjC++ but not for C
[  2%] Building CXX object modules/core/CMakeFiles/opencv_core_pch_dephelp.dir/opencv_core_pch_dephelp.cxx.o
[  2%] Building CXX object modules/photo/CMakeFiles/opencv_photo_pch_dephelp.dir/opencv_photo_pch_dephelp.cxx.o
[  2%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jcapimin.c.o
cc1: warning: ‘-Werror=’ argument ‘-Werror=non-virtual-dtor’ is not valid for C
cc1: warning: command-line option ‘-Wsign-promo’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-Wno-delete-non-virtual-dtor’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-fvisibility-inlines-hidden’ is valid for C++/ObjC++ but not for C
cc1plus: warning: command-line option ‘-Wmissing-prototypes’ is valid for C/ObjC but not for C++
cc1plus: warning: command-line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
[  2%] Building C object 3rdparty/libjasper/CMakeFiles/libjasper.dir/jas_cm.c.o
Scanning dependencies of target libprotobuf
[  2%] Building C object 3rdparty/libjpeg-turbo/CMakeFiles/libjpeg-turbo.dir/src/jccoefct.c.o
cc1: warning: ‘-Werror=’ argument ‘-Werror=non-virtual-dtor’ is not valid for C
cc1: warning: command-line option ‘-Wsign-promo’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-Wno-delete-non-virtual-dtor’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-fvisibility-inlines-hidden’ is valid for C++/ObjC++ but not for C
[  2%] Building C object 3rdparty/libwebp/CMakeFiles/libwebp.dir/src/dec/alpha_dec.c.o
[  2%] Building CXX object modules/flann/CMakeFiles/opencv_flann_pch_dephelp.dir/opencv_flann_pch_dephelp.cxx.o
cc1plus: warning: command-line option ‘-Wmissing-prototypes’ is valid for C/ObjC but not for C++
cc1plus: warning: command-line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
cc1: warning: ‘-Werror=’ argument ‘-Werror=non-virtual-dtor’ is not valid for C
cc1: warning: command-line option ‘-Wsign-promo’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-Wno-delete-non-virtual-dtor’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-fvisibility-inlines-hidden’ is valid for C++/ObjC++ but not for C
[  2%] Built target gen-pkgconfig
cc1: warning: ‘-Werror=’ argument ‘-Werror=non-virtual-dtor’ is not valid for C
cc1: warning: command-line option ‘-Wsign-promo’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-Wno-delete-non-virtual-dtor’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-fvisibility-inlines-hidden’ is valid for C++/ObjC++ but not for C
cc1: warning: ‘-Werror=’ argument ‘-Werror=non-virtual-dtor’ is not valid for C
cc1: warning: command-line option ‘-Wsign-promo’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-Wno-delete-non-virtual-dtor’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-fvisibility-inlines-hidden’ is valid for C++/ObjC++ but not for C
cc1plus: warning: command-line option ‘-Wmissing-prototypes’ is valid for C/ObjC but not for C++
cc1plus: warning: command-line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
cc1: warning: ‘-Werror=’ argument ‘-Werror=non-virtual-dtor’ is not valid for C
cc1: warning: command-line option ‘-Wsign-promo’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-Wno-delete-non-virtual-dtor’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-fvisibility-inlines-hidden’ is valid for C++/ObjC++ but not for C
cc1: warning: ‘-Werror=’ argument ‘-Werror=non-virtual-dtor’ is not valid for C
cc1: warning: command-line option ‘-Wsign-promo’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-Wno-delete-non-virtual-dtor’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-fvisibility-inlines-hidden’ is valid for C++/ObjC++ but not for C
cc1: warning: ‘-Werror=’ argument ‘-Werror=non-virtual-dtor’ is not valid for C
cc1: warning: command-line option ‘-Wsign-promo’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-Wno-delete-non-virtual-dtor’ is valid for C++/ObjC++ but not for C
cc1: warning: command-line option ‘-fvisibility-inlines-hidden’ is valid for C++/ObjC++ but not for C
cc1plus: warning: command-line option ‘-Wmissing-prototypes’ is valid for C/ObjC but not for C++
cc1plus: warning: command-line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
cc1plus: warning: command-line option ‘-Wmissing-prototypes’ is valid for C/ObjC but not for C++
cc1plus: warning: command-line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
.................

What am I doing wrong?

Here is my dockerfile configuration

#
FROM openjdk:11

ADD /cmmop-device-camstatus-0.0.1.jar /app.jar

ADD /opencv-3.4.4.zip /home/

ADD /capdetect.so /home/LibCamStatus/capdetect.so

EXPOSE 8686

ENTRYPOINT ["/bin/sh", "-c","java  -jar /app.jar"]

# 
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# 
RUN echo 'Asia/Shanghai' >/etc/timezone

# 
RUN unzip -d /home/ /home/opencv-3.4.4.zip 
# 
RUN mkdir /home/opencv-3.4.4/build
# 
ENV ANT_HOME /usr/local/ant
ENV PATH $PATH:${ANT_HOME}

# 
RUN apt-get update \
    && apt-get install build-essential -y \
    && apt-get install libsasl2-dev -y\
    && apt-get install apt-utils -y \
    && apt-get install pkg-config -y \
    && apt-get install cmake -y \
    && apt-get install ant -y
# cd 
WORKDIR /home/opencv-3.4.4/build
# 
RUN cmake -D WITH_TBB=ON -D WITH_EIGEN=ON  .. \
    cmake -D BUILD_DOCS=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF .. cmake -D WITH_OPENCL=OFF -D WITH_CUDA=OFF -D BUILD_opencv_gpu=OFF -D BUILD_opencv_gpuarithm=OFF -D BUILD_opencv_gpubgsegm=OFF -D BUILD_opencv_gpucodec=OFF -D BUILD_opencv_gpufeatures2d=OFF -D BUILD_opencv_gpufilters=OFF -D BUILD_opencv_gpuimgproc=OFF -D BUILD_opencv_gpulegacy=OFF -D BUILD_opencv_gpuoptflow=OFF -D BUILD_opencv_gpustereo=OFF -D BUILD_opencv_gpuwarping=OFF ..  \
    cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..\
    && make -j20 && make install

RUN echo "/usr/local/lib64" > /etc/ld.so.conf.d/opencv.conf

ENV PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:$PKG_CONFIG_PATH
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64
alalek commented 3 years ago

3.4.4

You have outdated version. You need to upgrade as requested by issue's template.


switch from openjdk8 to openjdk11

This also switches C++ compiler version.

HughWick commented 3 years ago

3.4.4

You have outdated version. You need to upgrade as requested by issue's template.

switch from openjdk8 to openjdk11

This also switches C++ compiler version.

Ok, I see, which version or above is supported above gcc10 please?

alalek commented 3 years ago

16483 released with 3.4.10