I have a project here
that uses c++17. I’ve specified c++17 everywhere in the package I can think of but travis does not pick it up. It of course builds fine locally.
I have a project here
that uses c++17. I’ve specified c++17 everywhere in the package I can think of but travis does not pick it up. It of course builds fine locally.
(For the record, a sample affected build is https://travis-ci.org/thk686/kdtools/builds/633605593)
Judging by https://github.com/stan-dev/rstan/issues/569, https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Using-C_002b_002b17-code and https://svn.r-project.org/R/trunk/src/scripts/config, CXX17
should be set in ~/.R/Makevars
to an appropriate compiler.
@jeroen @jimhester Perhaps the stock configuration created by the addon should include that.
For c++17 support you will need to install a appropriate version of gcc (at least 7) and then set CXX17
, CXX17STD
etc. in your personal ~/.R/Makevars
file to point to the appropriate compiler. The default values for this macro is set when R is installed, and the compilers in the default travis image for ubuntu 16.04 do not have support for c++17.
According to https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test?field.series_filter=xenial, GCC 7 can be installed in Xenial with:
addons:
apt:
sources:
- sourceline: 'ppa:ubuntu-toolchain-r/test'
packages:
- gcc-7
The compiler will be available as gcc-7
.
OK Finally figured it out. Thanks for your help.
# R for travis: see documentation at https://docs.travis-ci.com/user/languages/r
language: R
cache: packages
before_install:
- mkdir -p ~/.R
- echo 'CXX17 = g++-7 -std=gnu++17 -fPIC' > ~/.R/Makevars
addons:
apt:
sources:
- sourceline: 'ppa:ubuntu-toolchain-r/test'
packages:
- g++-7
after_success:
- Rscript -e 'covr::codecov()'