Rstan - solve travis error

I set up travis for a rstan package however I get this clang error

Worker information
system_info

Build system information

docker_mtu
resolvconf

R for Travis-CI is not officially supported, but is community maintained.

Please file any issues at https://travis-ci.community/c/languages/r

and mention @jeroen and @jimhester in the issue
R-install

Installing R
apt

Adding APT Sources

git.checkout

3.66s$ git clone --depth=50 --branch=try-fix-old-release-5 https://github.com/stemangiola/ppcSeq.git stemangiola/ppcSeq

Setting environment variables from .travis.yml

$ export CXX_OLEVEL=2

$ export CXX=clang++

cache.1

Setting up build cache

package

Setting up package cache
R-session-info

R session information
before_install.1

1.61s$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
before_install.2

8.46s$ sudo apt-get update -q
before_install.3

0.00s$ mkdir -p ~/.R/
before_install.4

0.03s$ echo "CXX = `R CMD config CXX`" >> ~/.R/Makevars
before_install.5

0.03s$ echo "CXXFLAGS = `R CMD config CXXFLAGS` -pedantic -g0 -flto -stdlib=libc++" >> ~/.R/Makevars
before_install.6

0.00s$ echo "LDFLAGS += -flto -stdlib=libc++" >> ~/.R/Makevars
before_install.7

0.00s$ export CLANG_EXTRA_ARG=""
before_install.8

0.00s$ if [[ $CXX = "clang++" ]] ;  then export CLANG_EXTRA_ARG=" -Qunused-arguments -fcolor-diagnostics " ; fi
before_install.9

0.00s$ sed -i.bak "s/ g++/ ${CXX}${CLANG_EXTRA_ARG}/" ~/.R/Makevars
before_install.10

0.00s$ sed -i.bak "s/O[0-3]/O$CXX_OLEVEL/" ~/.R/Makevars

Installing package dependencies

Installing R packages: remotes

4.00s$ Rscript -e 'install.packages(c("remotes"));if (!all(c("remotes") %in% installed.packages())) { q(status = 1, save = "no")}'

Installing package into ‘/home/travis/R/Library’

(as ‘lib’ is unspecified)

trying URL 'http://cloud.r-project.org/src/contrib/remotes_2.1.0.tar.gz'

Content type 'application/x-gzip' length 131622 bytes (128 KB)

==================================================

downloaded 128 KB

* installing *source* package ‘remotes’ ...

** package ‘remotes’ successfully unpacked and MD5 sums checked

** using staged installation

** R

** inst

** byte-compile and prepare package for lazy loading

** help

*** installing help indices

** building package indices

** installing vignettes

** testing if installed package can be loaded from temporary location

** testing if installed package can be loaded from final location

** testing if installed package keeps a record of temporary installation path

* DONE (remotes)

The downloaded source packages are in

	‘/tmp/Rtmpdljxpz/downloaded_packages’

34.10s$ Rscript -e 'deps <- remotes::dev_package_deps(dependencies = NA);remotes::install_deps(dependencies = TRUE);if (!all(deps$package %in% installed.packages())) { message("missing: ", paste(setdiff(deps$package, installed.packages()), collapse=", ")); q(status = 1, save = "no")}'

Rcpp         (NA -> 1.0.2    ) [CRAN]

rstan        (NA -> 2.19.2   ) [CRAN]

rstantools   (NA -> 1.5.1    ) [CRAN]

tibble       (NA -> 2.1.3    ) [CRAN]

dplyr        (NA -> 0.8.3    ) [CRAN]

magrittr     (NA -> 1.5      ) [CRAN]

purrr        (NA -> 0.3.2    ) [CRAN]

tidyr        (NA -> 0.8.3    ) [CRAN]

ggplot2      (NA -> 3.2.1    ) [CRAN]

foreach      (NA -> 1.4.7    ) [CRAN]

BH           (NA -> 1.69.0-1 ) [CRAN]

RcppEigen    (NA -> 0.3.3.5.0) [CRAN]

StanHeaders  (NA -> 2.18.1-10) [CRAN]

inline       (NA -> 0.3.15   ) [CRAN]

gridExtra    (NA -> 2.3      ) [CRAN]

loo          (NA -> 2.1.0    ) [CRAN]

pkgbuild     (NA -> 1.0.5    ) [CRAN]

cli          (NA -> 1.1.0    ) [CRAN]

crayon       (NA -> 1.3.4    ) [CRAN]

fansi        (NA -> 0.4.0    ) [CRAN]

pillar       (NA -> 1.4.2    ) [CRAN]

pkgconfig    (NA -> 2.0.2    ) [CRAN]

rlang        (NA -> 0.4.0    ) [CRAN]

assertthat   (NA -> 0.2.1    ) [CRAN]

glue         (NA -> 1.3.1    ) [CRAN]

R6           (NA -> 2.4.0    ) [CRAN]

tidyselect   (NA -> 0.2.5    ) [CRAN]

plogr        (NA -> 0.2.0    ) [CRAN]

stringi      (NA -> 1.4.3    ) [CRAN]

digest       (NA -> 0.6.20   ) [CRAN]

gtable       (NA -> 0.3.0    ) [CRAN]

lazyeval     (NA -> 0.2.2    ) [CRAN]

reshape2     (NA -> 1.4.3    ) [CRAN]

scales       (NA -> 1.0.0    ) [CRAN]

viridisLite  (NA -> 0.3.0    ) [CRAN]

withr        (NA -> 2.1.2    ) [CRAN]

iterators    (NA -> 1.0.12   ) [CRAN]

plyr         (NA -> 1.8.4    ) [CRAN]

stringr      (NA -> 1.4.0    ) [CRAN]

labeling     (NA -> 0.3      ) [CRAN]

munsell      (NA -> 0.5.0    ) [CRAN]

RColorBrewer (NA -> 1.1-2    ) [CRAN]

colorspace   (NA -> 1.4-1    ) [CRAN]

utf8         (NA -> 1.1.4    ) [CRAN]

vctrs        (NA -> 0.2.0    ) [CRAN]

backports    (NA -> 1.1.4    ) [CRAN]

ellipsis     (NA -> 0.2.0.1  ) [CRAN]

zeallot      (NA -> 0.1.0    ) [CRAN]

matrixStats  (NA -> 0.54.0   ) [CRAN]

checkmate    (NA -> 1.9.4    ) [CRAN]

callr        (NA -> 3.3.1    ) [CRAN]

desc         (NA -> 1.2.0    ) [CRAN]

prettyunits  (NA -> 1.0.2    ) [CRAN]

rprojroot    (NA -> 1.3-2    ) [CRAN]

processx     (NA -> 3.4.1    ) [CRAN]

ps           (NA -> 1.3.0    ) [CRAN]

Installing 56 packages: Rcpp, rstan, rstantools, tibble, dplyr, magrittr, purrr, tidyr, ggplot2, foreach, BH, RcppEigen, StanHeaders, inline, gridExtra, loo, pkgbuild, cli, crayon, fansi, pillar, pkgconfig, rlang, assertthat, glue, R6, tidyselect, plogr, stringi, digest, gtable, lazyeval, reshape2, scales, viridisLite, withr, iterators, plyr, stringr, labeling, munsell, RColorBrewer, colorspace, utf8, vctrs, backports, ellipsis, zeallot, matrixStats, checkmate, callr, desc, prettyunits, rprojroot, processx, ps

Installing packages into ‘/home/travis/R/Library’

(as ‘lib’ is unspecified)

trying URL 'http://cloud.r-project.org/src/contrib/Rcpp_1.0.2.tar.gz'

Content type 'application/x-gzip' length 3699570 bytes (3.5 MB)

==================================================

downloaded 3.5 MB

trying URL 'http://cloud.r-project.org/src/contrib/rstan_2.19.2.tar.gz'

Content type 'application/x-gzip' length 909934 bytes (888 KB)

==================================================

downloaded 888 KB

trying URL 'http://cloud.r-project.org/src/contrib/rstantools_1.5.1.tar.gz'

Content type 'application/x-gzip' length 63203 bytes (61 KB)

==================================================

downloaded 61 KB

trying URL 'http://cloud.r-project.org/src/contrib/tibble_2.1.3.tar.gz'

Content type 'application/x-gzip' length 310774 bytes (303 KB)

==================================================

downloaded 303 KB

trying URL 'http://cloud.r-project.org/src/contrib/dplyr_0.8.3.tar.gz'

Content type 'application/x-gzip' length 1173098 bytes (1.1 MB)

==================================================

downloaded 1.1 MB

trying URL 'http://cloud.r-project.org/src/contrib/magrittr_1.5.tar.gz'

Content type 'application/x-gzip' length 200504 bytes (195 KB)

==================================================

downloaded 195 KB

trying URL 'http://cloud.r-project.org/src/contrib/purrr_0.3.2.tar.gz'

Content type 'application/x-gzip' length 373701 bytes (364 KB)

==================================================

downloaded 364 KB

trying URL 'http://cloud.r-project.org/src/contrib/tidyr_0.8.3.tar.gz'

Content type 'application/x-gzip' length 383932 bytes (374 KB)

==================================================

downloaded 374 KB

trying URL 'http://cloud.r-project.org/src/contrib/ggplot2_3.2.1.tar.gz'

Content type 'application/x-gzip' length 3204655 bytes (3.1 MB)

==================================================

downloaded 3.1 MB

trying URL 'http://cloud.r-project.org/src/contrib/foreach_1.4.7.tar.gz'

Content type 'application/x-gzip' length 359074 bytes (350 KB)

==================================================

downloaded 350 KB

trying URL 'http://cloud.r-project.org/src/contrib/BH_1.69.0-1.tar.gz'

Content type 'application/x-gzip' length 12378154 bytes (11.8 MB)

==================================================

downloaded 11.8 MB

trying URL 'http://cloud.r-project.org/src/contrib/RcppEigen_0.3.3.5.0.tar.gz'

Content type 'application/x-gzip' length 1633859 bytes (1.6 MB)

==================================================

downloaded 1.6 MB

trying URL 'http://cloud.r-project.org/src/contrib/StanHeaders_2.18.1-10.tar.gz'

Content type 'application/x-gzip' length 1278878 bytes (1.2 MB)

==================================================

downloaded 1.2 MB

trying URL 'http://cloud.r-project.org/src/contrib/inline_0.3.15.tar.gz'

Content type 'application/x-gzip' length 21455 bytes (20 KB)

==================================================

downloaded 20 KB

trying URL 'http://cloud.r-project.org/src/contrib/gridExtra_2.3.tar.gz'

Content type 'application/x-gzip' length 1062844 bytes (1.0 MB)

==================================================

downloaded 1.0 MB

trying URL 'http://cloud.r-project.org/src/contrib/loo_2.1.0.tar.gz'

Content type 'application/x-gzip' length 2055775 bytes (2.0 MB)

==================================================

downloaded 2.0 MB

trying URL 'http://cloud.r-project.org/src/contrib/pkgbuild_1.0.5.tar.gz'

Content type 'application/x-gzip' length 29022 bytes (28 KB)

==================================================

downloaded 28 KB

trying URL 'http://cloud.r-project.org/src/contrib/cli_1.1.0.tar.gz'

Content type 'application/x-gzip' length 40232 bytes (39 KB)

==================================================

downloaded 39 KB

trying URL 'http://cloud.r-project.org/src/contrib/crayon_1.3.4.tar.gz'

Content type 'application/x-gzip' length 658694 bytes (643 KB)

==================================================

downloaded 643 KB

trying URL 'http://cloud.r-project.org/src/contrib/fansi_0.4.0.tar.gz'

Content type 'application/x-gzip' length 266123 bytes (259 KB)

==================================================

downloaded 259 KB

trying URL 'http://cloud.r-project.org/src/contrib/pillar_1.4.2.tar.gz'

Content type 'application/x-gzip' length 228815 bytes (223 KB)

==================================================

downloaded 223 KB

trying URL 'http://cloud.r-project.org/src/contrib/pkgconfig_2.0.2.tar.gz'

Content type 'application/x-gzip' length 6024 bytes

==================================================

downloaded 6024 bytes

trying URL 'http://cloud.r-project.org/src/contrib/rlang_0.4.0.tar.gz'

Content type 'application/x-gzip' length 859737 bytes (839 KB)

==================================================

downloaded 839 KB

trying URL 'http://cloud.r-project.org/src/contrib/assertthat_0.2.1.tar.gz'

Content type 'application/x-gzip' length 12742 bytes (12 KB)

==================================================

downloaded 12 KB

trying URL 'http://cloud.r-project.org/src/contrib/glue_1.3.1.tar.gz'

Content type 'application/x-gzip' length 122950 bytes (120 KB)

==================================================

downloaded 120 KB

trying URL 'http://cloud.r-project.org/src/contrib/R6_2.4.0.tar.gz'

Content type 'application/x-gzip' length 31545 bytes (30 KB)

==================================================

downloaded 30 KB

trying URL 'http://cloud.r-project.org/src/contrib/tidyselect_0.2.5.tar.gz'

Content type 'application/x-gzip' length 21883 bytes (21 KB)

==================================================

downloaded 21 KB

trying URL 'http://cloud.r-project.org/src/contrib/plogr_0.2.0.tar.gz'

Content type 'application/x-gzip' length 7795 bytes

==================================================

downloaded 7795 bytes

trying URL 'http://cloud.r-project.org/src/contrib/stringi_1.4.3.tar.gz'

Content type 'application/x-gzip' length 7290890 bytes (7.0 MB)

==================================================

downloaded 7.0 MB

trying URL 'http://cloud.r-project.org/src/contrib/digest_0.6.20.tar.gz'

Content type 'application/x-gzip' length 135997 bytes (132 KB)

==================================================

downloaded 132 KB

trying URL 'http://cloud.r-project.org/src/contrib/gtable_0.3.0.tar.gz'

Content type 'application/x-gzip' length 368081 bytes (359 KB)

==================================================

downloaded 359 KB

trying URL 'http://cloud.r-project.org/src/contrib/lazyeval_0.2.2.tar.gz'

Content type 'application/x-gzip' length 83482 bytes (81 KB)

==================================================

downloaded 81 KB

trying URL 'http://cloud.r-project.org/src/contrib/reshape2_1.4.3.tar.gz'

Content type 'application/x-gzip' length 36405 bytes (35 KB)

==================================================

downloaded 35 KB

trying URL 'http://cloud.r-project.org/src/contrib/scales_1.0.0.tar.gz'

Content type 'application/x-gzip' length 299262 bytes (292 KB)

==================================================

downloaded 292 KB

trying URL 'http://cloud.r-project.org/src/contrib/viridisLite_0.3.0.tar.gz'

Content type 'application/x-gzip' length 44019 bytes (42 KB)

==================================================

downloaded 42 KB

trying URL 'http://cloud.r-project.org/src/contrib/withr_2.1.2.tar.gz'

Content type 'application/x-gzip' length 53578 bytes (52 KB)

==================================================

downloaded 52 KB

trying URL 'http://cloud.r-project.org/src/contrib/iterators_1.0.12.tar.gz'

Content type 'application/x-gzip' length 289201 bytes (282 KB)

==================================================

downloaded 282 KB

trying URL 'http://cloud.r-project.org/src/contrib/plyr_1.8.4.tar.gz'

Content type 'application/x-gzip' length 392451 bytes (383 KB)

==================================================

downloaded 383 KB

trying URL 'http://cloud.r-project.org/src/contrib/stringr_1.4.0.tar.gz'

Content type 'application/x-gzip' length 135777 bytes (132 KB)

==================================================

downloaded 132 KB

trying URL 'http://cloud.r-project.org/src/contrib/labeling_0.3.tar.gz'

Content type 'application/x-gzip' length 10722 bytes (10 KB)

==================================================

downloaded 10 KB

trying URL 'http://cloud.r-project.org/src/contrib/munsell_0.5.0.tar.gz'

Content type 'application/x-gzip' length 182653 bytes (178 KB)

==================================================

downloaded 178 KB

trying URL 'http://cloud.r-project.org/src/contrib/RColorBrewer_1.1-2.tar.gz'

Content type 'application/x-gzip' length 11532 bytes (11 KB)

==================================================

downloaded 11 KB

trying URL 'http://cloud.r-project.org/src/contrib/colorspace_1.4-1.tar.gz'

Content type 'application/x-gzip' length 2152594 bytes (2.1 MB)

==================================================

downloaded 2.1 MB

trying URL 'http://cloud.r-project.org/src/contrib/utf8_1.1.4.tar.gz'

Content type 'application/x-gzip' length 218882 bytes (213 KB)

==================================================

downloaded 213 KB

trying URL 'http://cloud.r-project.org/src/contrib/vctrs_0.2.0.tar.gz'

Content type 'application/x-gzip' length 668258 bytes (652 KB)

==================================================

downloaded 652 KB

trying URL 'http://cloud.r-project.org/src/contrib/backports_1.1.4.tar.gz'

Content type 'application/x-gzip' length 13859 bytes (13 KB)

==================================================

downloaded 13 KB

trying URL 'http://cloud.r-project.org/src/contrib/ellipsis_0.2.0.1.tar.gz'

Content type 'application/x-gzip' length 7045 bytes

==================================================

downloaded 7045 bytes

trying URL 'http://cloud.r-project.org/src/contrib/zeallot_0.1.0.tar.gz'

Content type 'application/x-gzip' length 32549 bytes (31 KB)

==================================================

downloaded 31 KB

trying URL 'http://cloud.r-project.org/src/contrib/matrixStats_0.54.0.tar.gz'

Content type 'application/x-gzip' length 183731 bytes (179 KB)

==================================================

downloaded 179 KB

trying URL 'http://cloud.r-project.org/src/contrib/checkmate_1.9.4.tar.gz'

Content type 'application/x-gzip' length 214038 bytes (209 KB)

==================================================

downloaded 209 KB

trying URL 'http://cloud.r-project.org/src/contrib/callr_3.3.1.tar.gz'

Content type 'application/x-gzip' length 94264 bytes (92 KB)

==================================================

downloaded 92 KB

trying URL 'http://cloud.r-project.org/src/contrib/desc_1.2.0.tar.gz'

Content type 'application/x-gzip' length 65612 bytes (64 KB)

==================================================

downloaded 64 KB

trying URL 'http://cloud.r-project.org/src/contrib/prettyunits_1.0.2.tar.gz'

Content type 'application/x-gzip' length 8262 bytes

==================================================

downloaded 8262 bytes

trying URL 'http://cloud.r-project.org/src/contrib/rprojroot_1.3-2.tar.gz'

Content type 'application/x-gzip' length 50414 bytes (49 KB)

==================================================

downloaded 49 KB

trying URL 'http://cloud.r-project.org/src/contrib/processx_3.4.1.tar.gz'

Content type 'application/x-gzip' length 123430 bytes (120 KB)

==================================================

downloaded 120 KB

trying URL 'http://cloud.r-project.org/src/contrib/ps_1.3.0.tar.gz'

Content type 'application/x-gzip' length 261887 bytes (255 KB)

==================================================

downloaded 255 KB

* installing *source* package ‘Rcpp’ ...

** package ‘Rcpp’ successfully unpacked and MD5 sums checked

** using staged installation

** libs

clang++ -Qunused-arguments -fcolor-diagnostics  -std=gnu++11 -I"/home/travis/R-bin/lib/R/include" -DNDEBUG -I../inst/include/  -I/home/travis/R-bin/include   -fpic  -g -O2 -pedantic -g0 -flto -stdlib=libc++ -c api.cpp -o api.o

clang++ -Qunused-arguments -fcolor-diagnostics  -std=gnu++11 -I"/home/travis/R-bin/lib/R/include" -DNDEBUG -I../inst/include/  -I/home/travis/R-bin/include   -fpic  -g -O2 -pedantic -g0 -flto -stdlib=libc++ -c attributes.cpp -o attributes.o

clang++ -Qunused-arguments -fcolor-diagnostics  -std=gnu++11 -I"/home/travis/R-bin/lib/R/include" -DNDEBUG -I../inst/include/  -I/home/travis/R-bin/include   -fpic  -g -O2 -pedantic -g0 -flto -stdlib=libc++ -c barrier.cpp -o barrier.o

clang++ -Qunused-arguments -fcolor-diagnostics  -std=gnu++11 -I"/home/travis/R-bin/lib/R/include" -DNDEBUG -I../inst/include/  -I/home/travis/R-bin/include   -fpic  -g -O2 -pedantic -g0 -flto -stdlib=libc++ -c date.cpp -o date.o

clang++ -Qunused-arguments -fcolor-diagnostics  -std=gnu++11 -I"/home/travis/R-bin/lib/R/include" -DNDEBUG -I../inst/include/  -I/home/travis/R-bin/include   -fpic  -g -O2 -pedantic -g0 -flto -stdlib=libc++ -c module.cpp -o module.o

clang++ -Qunused-arguments -fcolor-diagnostics  -std=gnu++11 -I"/home/travis/R-bin/lib/R/include" -DNDEBUG -I../inst/include/  -I/home/travis/R-bin/include   -fpic  -g -O2 -pedantic -g0 -flto -stdlib=libc++ -c rcpp_init.cpp -o rcpp_init.o

clang++ -Qunused-arguments -fcolor-diagnostics -std=gnu++11 -shared -L/home/travis/R-bin/lib/R/lib -L/home/travis/R-bin/lib -flto -stdlib=libc++ -o Rcpp.so api.o attributes.o barrier.o date.o module.o rcpp_init.o -L/home/travis/R-bin/lib/R/lib -lR

/usr/bin/ld: /usr/local/clang-7.0.0/bin/../lib/LLVMgold.so: error loading plugin: /usr/local/clang-7.0.0/bin/../lib/LLVMgold.so: cannot open shared object file: No such file or directory

clang-7: error: linker command failed with exit code 1 (use -v to see invocation)

/home/travis/R-bin/lib/R/share/make/shlib.mk:6: recipe for target 'Rcpp.so' failed

make: *** [Rcpp.so] Error 1

ERROR: compilation failed for package ‘Rcpp’

* removing ‘/home/travis/R/Library/Rcpp’

Error in i.p(...) : 

  (converted from warning) installation of package ‘Rcpp’ had non-zero exit status

Calls: <Anonymous> ... with_rprofile_user -> with_envvar -> force -> force -> i.p

Execution halted

The command "Rscript -e 'deps <- remotes::dev_package_deps(dependencies = NA);remotes::install_deps(dependencies = TRUE);if (!all(deps$package %in% installed.packages())) { message("missing: ", paste(setdiff(deps$package, installed.packages()), collapse=", ")); q(status = 1, save = "no")}'" failed and exited with 1 during .

Your build has been stopped.

This is my travis file (automatically generated by the last version of rstantools)

language: r
sudo: false
r: devel
cache: packages

latex: true


env:
  matrix: 
    - CXX_OLEVEL=2 CXX=clang++

matrix:
  include:
    - os: linux
      compiler: clang
      addons:
        apt:
          sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-precise-5.0' ]        
          packages:
            - llvm-5.0-dev
      env:
        - CXX_OLEVEL=2 CXX=clang++


before_install:
  - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
  - sudo apt-get update -q
  - mkdir -p ~/.R/
  - echo "CXX = `R CMD config CXX`" >> ~/.R/Makevars
  - echo "CXXFLAGS = `R CMD config CXXFLAGS` -pedantic -g0 -flto -stdlib=libc++" >> ~/.R/Makevars
  - echo "LDFLAGS += -flto -stdlib=libc++" >> ~/.R/Makevars
  - export CLANG_EXTRA_ARG=""
  - if [[ $CXX = "clang++" ]] ;  then export CLANG_EXTRA_ARG=" -Qunused-arguments -fcolor-diagnostics " ; fi
  - sed -i.bak "s/ g++/ ${CXX}${CLANG_EXTRA_ARG}/" ~/.R/Makevars
  - sed -i.bak "s/O[0-3]/O$CXX_OLEVEL/" ~/.R/Makevars

script: 
  - |
    travis_wait 42 R CMD build .
    travis_wait 59 R CMD check ppcSeq*tar.gz

after_script:
  - tar -ztvf ppcSeq_*.tar.gz
  - echo ${NOT_CRAN}

after_success:
  - travis_wait 40 tar -C .. -xf $PKG_TARBALL

after_failure:
- cat ppcSeq.Rcheck/00*

Thanks!

You need to either get LLVMgold installed to the right place or take the LTO stuff out of your compiler / linker flags.

1 Like