我尝试使用Travis CI为使用OpenCV 4.0的程序构建并运行测试。
我在install
.travis.yml
文件部分中尝试了此操作:
install:
- sudo apt-get install -qq g++-7
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 90
# OpenCV dependencies - Details available at: http://docs.opencv.org/trunk/doc/tutorials/introduction/linux_install/linux_install.html
- sudo apt-get install -y build-essential
- sudo apt-get install -y cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
- sudo apt-get install -y python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
- git clone https://github.com/opencv/opencv.git
- git clone https://github.com/opencv/opencv_contrib.git
- cd opencv
# Create a new 'build' folder.
- mkdir build
- cd build
# Set build instructions for Ubuntu distro.
- cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
# Run 'make' with four threads.
- make -j4
# Install to OS.
- sudo make install
# Add configuration to OpenCV to tell it where the library files are located on the file system (/usr/local/lib)
- sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
- sudo ldconfig
- echo "OpenCV installed."
但这给了我make
中68%的超时错误:The job exceeded the maximum time limit for jobs, and has been terminated.
是否有更好的方法在Travis CI上安装OpenCV?
也许是一些内置机制?
或者是否有某种方法可以禁用此超时保护?
答案 0 :(得分:1)
禁用BUILD_EXAMPLES,BUILD_TESTS和BUILD_PERF_TESTS
答案 1 :(得分:0)
最后,我使用此命令在没有超时的情况下在Travis CI上构建OpenCV:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D BUILD_EXAMPLES=OFF -D BUILD_opencv_apps=OFF -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D CMAKE_INSTALL_PREFIX=/usr/local ..