Dockerfile Centos7+Opencv4.0.1+Opencv_contrib-4.0.1,解决boostdesc_bgm.i,test_descriptors_regression.impl.hpp,common.h问题

分享一个以centos7为基础镜像的,包含Cmake,GCC,Opencv4.0.1和Opencv_contrib-4.0.1编译的Dockerfile。

之前做过opencv_contrib的都知道,编译的时候会缺少相关文件,需要提前把这些文件准备好。尤其需要注意的是,如果缺test_descriptors_regression.impl.hpp等文件,缺什么就补什么,前往不要把其它不必要的文件都拷贝过来,从而引起common.h找不到的问题。

FROM centos:centos7.9.2009
LABEL maintainer="zzw"
RUN yum -y update && \
yum install -y autoconf automake gcc-c++ gcc make openssl-devel

ENV CMAKE=/home/dev/CMake-master
ADD ./CMake-master $CMAKE
WORKDIR $CMAKE
RUN ./bootstrap
RUN make && make install

RUN yum install -y epel-release && \
yum clean all && \
yum makecache
RUN yum install -y centos-release-scl && \
yum install -y \
devtoolset-8 && \
yum clean all 

ENV dev=/home/dev

ENV OPENCV=/home/dev/opencv-4.0.1
ENV OPENCV_BUILD=/home/dev/opencv-4.0.1/build
ENV OPENCV_CON=/home/dev/opencv_contrib-4.0.1
ADD ./opencv-4.0.1 $OPENCV
ADD ./opencv_contrib-4.0.1 $OPENCV_CON
WORKDIR $OPENCV_BUILD
RUN source /opt/rh/devtoolset-8/enable && cmake -D CMAKE_BUILD_TYPE=RELEASE -D OPENCV_GENERATE_PKGCONFIG=ON -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=/home/dev/opencv_contrib-4.0.1/modules ..
RUN source /opt/rh/devtoolset-8/enable && make -j8
RUN source /opt/rh/devtoolset-8/enable && make install

 

posted @ 2021-08-23 14:18  郑某  阅读(231)  评论(0编辑  收藏  举报