Hi, I received the following error message when attempting to build and install rstan from source under RHEL 7.2:
/usr/lib64/R/etc/Makeconf:166: 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/savitskyt/R/x86_64-redhat-linux-gnu-library/3.4/rstan’
Warning in install.packages :
installation of package ‘rstan’ had non-zero exit status
My system information is:
R version 3.4.0 (2017-04-21)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux
There are 2 lines with CXX14FLAGS, and I add “DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION” to both of them, but the error still persists. Could you explain more?
Thank you.
and then both “pkgbuild::has_build_tools(debug = TRUE)” and "fx ← inline::cxxfunction( signature(x = “integer”, y = “numeric” ) , ’
return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;
’ )
fx( 2L, 5 )" passed.
Then
install.packages(c(“Rcpp”, “rstan”), type = “source”)
which has a long output and I copy the final part which I think important. Please tell me if you wanna see more.
At global scope:
cc1plus: warning: unrecognized command line option “-Wno-ignored-attributes” [enabled by default]
make: *** [lang__ast_def.o] Error 1
ERROR: compilation failed for package ‘rstan’
removing ‘/home/changy/R/x86_64-redhat-linux-gnu-library/3.5/rstan’
Warning in install.packages :
installation of package ‘rstan’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpE6CZuG/downloaded_packages’
The total output has 90 “error:”.
I just copy the final 2 and the rest is attached.
Thank you.
/home/changy/R/x86_64-redhat-linux-gnu-library/3.5/StanHeaders/include/src/stan/lang/function_signatures.h:1365:24: error: range-based ‘for’ loops are not allowed in C++98 mode
for (const auto& u : all_vector_types) {
^
/home/changy/R/x86_64-redhat-linux-gnu-library/3.5/StanHeaders/include/src/stan/lang/function_signatures.h:1366:57: error: no matching function for call to ‘stan::lang::function_signatures::rng_return_type(const int&, const int&)’
add(“weibull_rng”, rng_return_type<double_type>(t, u), t, u);
In file included from /home/changy/R/x86_64-redhat-linux-gnu-library/3.5/StanHeaders/include/src/stan/lang/ast.hpp:65:0,
from /home/changy/R/x86_64-redhat-linux-gnu-library/3.5/StanHeaders/include/src/stan/lang/ast_def.cpp:7,
from lang__ast_def.cpp:18:
/home/changy/R/x86_64-redhat-linux-gnu-library/3.5/StanHeaders/include/src/stan/lang/ast/sigs/function_signatures.hpp:306:17: note: template stan::lang::expr_type stan::lang::function_signatures::rng_return_type(const stan::lang::expr_type&, const stan::lang::expr_type&, const stan::lang::expr_type&)
expr_type rng_return_type(const expr_type& t,
^
/home/changy/R/x86_64-redhat-linux-gnu-library/3.5/StanHeaders/include/src/stan/lang/ast/sigs/function_signatures.hpp:306:17: note: template argument deduction/substitution failed:
In file included from /home/changy/R/x86_64-redhat-linux-gnu-library/3.5/StanHeaders/include/src/stan/lang/ast/sigs/function_signatures_def.hpp:486:0,
from /home/changy/R/x86_64-redhat-linux-gnu-library/3.5/StanHeaders/include/src/stan/lang/ast_def.cpp:119,
from lang__ast_def.cpp:18:
/home/changy/R/x86_64-redhat-linux-gnu-library/3.5/StanHeaders/include/src/stan/lang/function_signatures.h:1366:57: note: cannot convert ‘t’ (type ‘const int’) to type ‘const stan::lang::expr_type&’
add(“weibull_rng”, rng_return_type<double_type>(t, u), t, u);
^
At global scope:
cc1plus: warning: unrecognized command line option “-Wno-ignored-attributes” [enabled by default]
make: *** [lang__ast_def.o] Error 1
ERROR: compilation failed for package ‘rstan’
removing ‘/home/changy/R/x86_64-redhat-linux-gnu-library/3.5/rstan’
Warning in install.packages :
installation of package ‘rstan’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpAmotUi/downloaded_packages’
Technically, g++-4.8 is not sufficient because it does not implement any of the C++14 standard, although it does accept the -std=c++1y flag. On the other hand, Stan 2.18 technically isn’t using any of the C++14 syntax. It will probably work if you set
CXX14 = g++ -std=c++11
but you should look into getting a newer version of g++ or clang++ from the RHEL repos.
One of the configured repositories failed (Unknown),
and yum doesn’t have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work “fix” this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=<repoid> ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable <repoid>
or
subscription-manager repos --disable=<repoid>
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
Cannot find a valid baseurl for repo: euca2ools/7/x86_64
I think you need to look into the Red Hat Developer Toolset https://access.redhat.com/documentation/en-us/red_hat_developer_toolset/8-beta/
but really if you have RHEL you usually have a system administrator who knows what additional repositories are out there and which are permitted under support constracts and so forth.
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from /usr/include/c++/4.8.2/thread:35:0,
from /usr/lib64/R/library/StanHeaders/include/stan/math/prim/mat/functor/map_rect_concurrent.hpp:10,
from /usr/lib64/R/library/StanHeaders/include/stan/math/prim/mat/functor/map_rect.hpp:13,
from /usr/lib64/R/library/StanHeaders/include/stan/math/prim/mat.hpp:262,
from /usr/lib64/R/library/StanHeaders/include/stan/math/rev/mat.hpp:12,
from /usr/lib64/R/library/StanHeaders/include/stan/math.hpp:4,
from /usr/lib64/R/library/StanHeaders/include/src/stan/model/model_header.hpp:4,
from file6202730a0d5.cpp:8:
/usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler op
In addition: Warning message:
In system(cmd, intern = !verbose) :
running command ‘/usr/lib64/R/bin/R CMD SHLIB file6202730a0d5.cpp 2> file6202730a0d5.cpp.err.txt’ had status 1
Try adding CXX14FLAGS+= -std=c++11 to your makefile. I am short on explanations, but our systems are very similar and specifying std fixes the same error for me.
As for where I got it, the error tells you to enable -std=c++11
It is not recognizing your newer C++ compiler. Check the step where you enable it to be the default compiler or perhaps specify g++-7 or whatever its version number is.