RStan installation problem Ubuntu

Operating System: Linux 4.10.0-35-generic (Ubuntu 17.04)
Interface Version: RStan 2.16.2 (3 july 2017)
Compiler/Toolkit: gcc 6.3.0

When trying to install RStan i get the following error

/usr/lib/R/etc/Makeconf:141: recipe for target 'lang__grammars__expression_grammar_inst.o' failed 
make: *** [lang__grammars__expression_grammar_inst.o] Error 1
   ERROR: compilation failed for package ‘rstan’
  * removing ‘/home/helton/R/x86_64-pc-linux-gnu-library/3.3/rstan’
  Warning in install.packages :
  installation of package ‘rstan’ had non-zero exit status

Any thoughts?

I don’t know if it’s the same problem I had both on my main system and on a virtual machine, but I was able to work around it by using clang and disabling the lfto flag (there’s a weird linker problem with clang using this flag):

Example of Makevars file:

CXXFLAGS=-O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function
#CXXFLAGS+=-flto
CXXFLAGS+=-ffat-lto-objects
CXXFLAGS+=-Wno-unused-local-typedefs
CXXFLAGS+=-Wno-ignored-attributes -Wno-deprecated-declarations
CC=clang
CXX=clang++

Obs.: luckly, I didn’t need to recompile Rcpp using Clang, GCC and Clang worked along file.

It worked perfectly.

Thanks!!!

I use the gcc and I am always using this guide [Home · stan-dev/rstan Wiki · GitHub] to install Rstan.
I add one more CXXFLAGS += -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION
and it works (for me)