Tools needed to build C ++ code for R not found

OS: Ubuntu 14.04
g++: g++ (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
R version: 3.2.0 (2015-04-16) -- "Full of Ingredients"
Rcpp: 0.11.6

      

I am apt-get dist-upgrade

my system today and g ++ has been updated as well. Then when I try to use the Rcpp package in R the code is the simplest test code >>evalCpp("1+1")

. The following error occurred:

Error in frameTypes(env) : not a proper evaluation environment
Calls: ::: ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted

Error in sourceCpp(code = code, env = env, rebuild = rebuild,showOutput = showOutput,  : 
Error 1 occurred building shared library.

WARNING: The tools required to build C++ code for R were not found.

Please install GNU development tools including a C++ compiler.

      

I did google for this. The following links are for Mac OSX:

Error when using Xcode 5.0 and Rcpp (Command line tools installed)

g ++ errors when trying to compile C ++ 11 with Rcpp

From the answers and comments, I cannot tell what the problem is. Appreciate your help!

UPDATE: I finally solved this problem by reinstalling all related packages R

. And keep in mind that I also did what @Dirk suggested at first apt-get build-dep r-base-dev

. I cannot confirm which one is the key step.

+3


source to share


2 answers


You need

 sudo apt-get build-dep r-base

      

to install all build dependencies for R. itself.



But we even built an explicit helper package r-base-dev

, so in most cases (and in your case of using Rcpp ) you just need to

 sudo apt-get install r-base-dev

      

+3


source


There is something wrong / not in your system configuration. First of all, I doubt that you are actually using Ubuntu 14.04 (after dist-upgrade), because the other versions you have specified will not be available (unless you pulled them from the non-default repository). You might also consider running a full update to try to flatten the configuration.

You can get some ideas by doing showOutput=1

...

library(Rcpp)
evalCpp("1+1",showOutput=1,rebuild=1)

      



... but in fact, it looks like the problem is with the env

( Error in frameTypes(env) : not a proper evaluation environment

) parameter , which is most likely evaluated before attempting compilation.

For what I succeeded in doing this, I was able to run this without r-base-dev

, but perhaps the installation r-base-dev

will result in correct and updated versions of what you need. I would tend to just reinstall all R related packages.

+1


source







All Articles