来自源日志限制错误的Travis CI安装提升

时间:2019-05-23 22:12:58

标签: c++ linux boost travis-ci

有一段时间,我正在从事一个项目,我想在travis ci上构建它。我的项目对boost-geometry有依赖性,因此我尝试了以下travis.yml

language: cpp
dist: Xenial
sudo: true
matrix:
  include:
  - os: linux
    env:
      - PYTHON=3.6
      - CXX=g++-5
      - CC=gcc-5
      - CXXFLAGS = "$CXXFLAGS -std=c++14"
#  - os: linux
#    env: CONDA=3.6 CXX=g++ CC=gcc CXXFLAGS = "$CXXFLAGS -std=c++14"
# Boost
addons:
  apt:
    update: true
    packages:
      - libboost-all-dev
      - g++-5

before_install:
  - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
  - sudo apt-get update -qq
  - sudo apt-get install gcc-5 -y
  - sudo apt-get install g++-5 -y
  - sudo apt-get install libboost-all-dev -y
  - sudo apt-get install python-pip python-dev build-essential
  - sudo apt-get install python3-setuptools
  - sudo apt-get install python3-pip
  - sudo pip install --user --upgrade pip virtualenv
  - sudo pip install --user setuptools
  - sudo virtualenv -p python3 venv
  - source venv/bin/activate
  - sudo pip install pybind11
  - sudo python3 -m pip install pybind11
  - sudo python3 -m pip install --upgrade pip
  - cd src
  - ls
  - cd ../

install:
    - ls $TRAVIS_BUILD_DIR
    - sudo python3 setup.py install
    - sudo python3 setup.py sdist
    - sudo pip install --verbose dist/*.tar.gz
script:
- python tests/test.py

在此文件中给我一个错误。表示此文件未作为boost几何库的一部分安装。

could not find boost/geometry/core/assert.hpp

因此,我决定从源头上建立动力。我使用了以下文件

language: cpp
dist: Xenial
sudo: true
matrix:
  include:
  - os: linux
    env:
      - PYTHON=3.6
      - CXX=g++-5
      - CC=gcc-5
      - CXXFLAGS = "$CXXFLAGS -std=c++14"
#  - os: linux
#    env: CONDA=3.6 CXX=g++ CC=gcc CXXFLAGS = "$CXXFLAGS -std=c++14"
# Boost
addons:
  apt:
    update: true
    sources:
      -boost-latest
    packages:
      - libboost-all-dev
      - g++-5

before_install:
  - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
  - sudo apt-get update -qq
  - sudo apt-get install gcc-5 -y
  - sudo apt-get install g++-5 -y
  - sudo apt-get install libboost-all-dev -y
  - sudo apt-get install python-pip python-dev build-essential
  - sudo apt-get install python3-setuptools
  - sudo apt-get install python3-pip
  - wget https://sourceforge.net/projects/boost/files/boost/1.70.0/boost_1_70_0.tar.gz
  - tar -xzvf boost_1_70_0.tar.gz
  - cd boost_1_70_0
  - sudo ./bootstrap.sh --prefix=/usr/local --with-libraries=all
  - sudo ./b2 install
  - sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/boost.conf'
  - sudo ldconfig
  - cd ../../
  - sudo pip install --user --upgrade pip virtualenv
  - sudo pip install --user setuptools
  - sudo virtualenv -p python3 venv
  - source venv/bin/activate
  - sudo pip install pybind11
  - sudo python3 -m pip install pybind11
  - sudo python3 -m pip install --upgrade pip
  - cd src
  - ls
  - cd ../


    # Inform user that Boost 1.55 was successfully installed
#    echo "Boost 1.55 was successfully installed."


install:
#- |
#  if [ -n "$PYTHON" ]; then
#    sudo apt-get install -qq g++-6
#    sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-6 90
    - ls $TRAVIS_BUILD_DIR
    - sudo python3 setup.py install
    - sudo python3 setup.py sdist
    - sudo pip install --verbose dist/*.tar.gz
#  elif [ -n "$CONDA" ]; then
#    conda build conda.recipe
#    conda install --use-local pydggrid
#  fi
script:
- python tests/test.py

它开始运行,但是当boost写入日志travis时会引发以下错误

The job exceeded the maximum log length, and has been terminated.

那么,我该怎么做才能解决此问题?我在寻找一个标志,以避免boost生成大量日志,但是找不到任何日志。我也试图找到为什么使用apt-get安装boost-geometry的原因,但是没有机会找到合适的软件包。有人可以帮我解决这个问题吗? 谢谢

1 个答案:

答案 0 :(得分:0)

好吧,我最终还是用了这种方法

  - wget https://sourceforge.net/projects/boost/files/boost/1.70.0/boost_1_70_0.tar.gz -P $HOME
  - cd $HOME
  - tar -xzvf boost_1_70_0.tar.gz >/dev/null

由于boost是仅标头的库,我没有对其进行编译,因此我只是在make脚本的include部分中添加了它的目录