3

My package builds on Linux are failing with the following compilation error for rstan package:

lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
/usr/bin/ld: lto-wrapper failed
collect2: error: ld returned 1 exit status
make: *** [rstan.so] Error 1
ERROR: compilation failed for package ‘rstan’

How can I modify my travis.yaml to successfully install rstan on Travis?

Build log: https://travis-ci.org/IndrajeetPatil/statsExpressions/builds/638404778?utm_source=github_status&utm_medium=notification

Travis yaml: https://github.com/IndrajeetPatil/statsExpressions/blob/master/.travis.yml

Indrajeet Patil
  • 4,673
  • 2
  • 20
  • 51
  • I would try with the `-flto=2` flag in travis.yaml . – Ben Goodrich Jan 17 '20 at 06:00
  • @BenGoodrich How can I add multiple flags? `MAKEFLAGS="-j 2 && -flto 2"`? – Indrajeet Patil Jan 17 '20 at 09:25
  • There is a line that says `echo "CXX14 = g++-7 -fPIC -flto=2" >> ~/.R/Makevars`, which you can change to whatever you want, but I would suggest removing the `-flto=2` if that is causing problems. You can set the `MAKEVARS` environmental variable elsewhere. – Ben Goodrich Jan 17 '20 at 17:05
  • I tried after removing `-flto=2`, but the same issue persists. – Indrajeet Patil Jan 18 '20 at 09:55
  • You still have `/usr/bin/ld: lto-wrapper failed` without using LTO? – Ben Goodrich Jan 19 '20 at 16:33
  • No, it's a different error now: `make: *** [chains.o] Error 1` (log: https://travis-ci.org/IndrajeetPatil/statsExpressions/jobs/638635866?utm_medium=notification&utm_source=github_status) – Indrajeet Patil Jan 19 '20 at 21:34
  • OK. That syntax should work and I believe does work outside of Travis. But I have not been able to get much value out of Travis for Stan-related packages. – Ben Goodrich Jan 20 '20 at 14:12
  • Thanks for your suggestion anyway. I can also confirm that other packages that rely on `rstan` are also facing the same issue: https://travis-ci.org/danheck/metaBMA/builds/612303943 – Indrajeet Patil Jan 20 '20 at 20:51

1 Answers1

3

After trying out many many different permutations and combinations, I finally got Travis builds to succeed, not only by compiling rstan properly but also installing other packages that need compilation so that the log doesn't exceed maximum limit or time out.

Here is the new yaml file for anyone who may run into a similar issue in the future: https://github.com/IndrajeetPatil/statsExpressions/blob/master/.travis.yml

Indrajeet Patil
  • 4,673
  • 2
  • 20
  • 51