I tried to install boost 1.64
in Travis CI environment in several way. But none of them was succeeded.
In my first naive attempt I just added following line in travis script:
install:
- sudo apt-get install libboost1.64-all-dev
The result was error message: cannot find package libboost1.64-all-dev
In second attempt I specified repository with necessary boost
version.
before_install:
- sudo add-apt-repository -y ppa:nschloe/boost-nightly
- sudo apt-get update -qq
install:
- sudo apt-get install libboost-all-dev
# - sudo apt-get install libboost1.64-all-dev (also tried)
In the first case default boost
version (1.54) was installed.
In second case result was same error message: cannot find package libboost1.64-all-dev
In third attempt I manually typed instructions to install boost
:
install:
- sudo wget -O boost_1_64_0.tar.gz http://sourceforge.net/projects/boost/files/boost/1.64.0/boost_1_64_0.tar.gz/download
- sudo tar xzvf boost_1_64_0.tar.gz
- cd boost_1_64_0/
- sudo ./bootstrap.sh --prefix=/usr/local
- sudo ./b2
- sudo ./b2 install
As result my script took more than 30 min then was terminated. Is any simple (or just working) way to install other than default boost version to Travis CI?
To look which all packages are available (esp. when you add the extra repository), you can run the "apt-cache search" command, e.g.:
sudo apt-cache search libboost
Then you can see the available versions.
When building manually, by default it builds "everything" (all static/shared debug/release libs), which then takes a lot of time and therefore it might timeout.
You can try to build only the libraries you actually need, for examle:
./bootstrap.sh --with-libraries=program_options,filesystem,system
./b2 link=shared threading=multi variant=release
(see here for details: http://www.boost.org/build/doc/html/bbv2/overview/invocation.html)
Precompiled Boost
Here are the steps I followed to get this to work:
Search on launchpad until I found a recent boost package build for the trusty
environment. That was non trivial, but there is a currently maintained ppa from mhier
called libboost-latest
I found configuring the .travis.yml
correctly to use the ppa nontrivial, so I present a working snippet below which I hope will help anyone else struggling with the same problem.
The following works for clang and gcc:
language: cpp
dist: trusty
sudo: false
os: linux
matrix:
include:
- env: COMPILER=g++-6 BUILD=Debug STANDARD=14
compiler: gcc
addons:
apt:
update: true
sources:
- sourceline: 'ppa:mhier/libboost-latest'
- ubuntu-toolchain-r-test
packages:
- g++-6
- boost1.67
- env: COMPILER=g++-6 BUILD=Release STANDARD=14
compiler: gcc
addons:
apt:
update: true
sources:
- sourceline: 'ppa:mhier/libboost-latest'
- ubuntu-toolchain-r-test
packages:
- g++-6
- boost1.67
# the rest of your yaml file...
Hopefully mhier will keep this ppa running for a while, otherwise you'll have to go through step 1, or provide your own ppa. As the boost version numbers progress the package number will change, so check the ppa page to keep the package name up to date.
A complete working example can be found at the monstar github project.
Compiling boost from source You can also compile boost from source within your travis build, although you run the risk of timing out. The instruction for this are found in item 12 of boost's best practice handbook
I've run into the same issue and limiting the informational output from the commands seemed to do the trick.
The three that flood the log:
- tar -xzf boost_1_64_0.tar.gz
- ./b2 -d0
- ./b2 install -d0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With