The tools required to build C++ code for R were not found - c++

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
Today I apt-get dist-upgrade my system, and the g++ was also been upgraded.
Then when I am trying to use "Rcpp" package in R, the code is the simplest test code >>evalCpp("1+1") . An error as follows 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 have did google for it. The following links are all about Mac OSX:
Error when with Xcode 5.0 and Rcpp (Command Line Tools ARE installed)
g++ errors when trying to compile c++11 with Rcpp
From the answers and comments, I can not tell what is the real problem.
Appreciate your help!
UPDATE: I finally solved this problem by reinstalling all the R related deb packages. And one thing we should keep in mind is that I also did what #Dirk suggested first apt-get build-dep r-base-dev. I can not confirm which one is the key step.

You need
sudo apt-get build-dep r-base
to install the all the build dependencies for R itself.
But we even built an explicitly helper package r-base-dev so in most cases (and in your use case of Rcpp) you just need
sudo apt-get install r-base-dev

There is something wrong/missing in your system configuration. First of all, I doubt that you are really running Ubuntu 14.04 (after the dist-upgrade) because the the other versions that you listed wouldn't be available (unless you have pulled them in from a non-default repository). You might also consider running a full-upgrade to try to straighten out your configuration.
You might gain some insights by running with showOutput=1...
library(Rcpp)
evalCpp("1+1",showOutput=1,rebuild=1)
...but actually, it looks like the problem is related specifically to a parameter called env (Error in frameTypes(env) : not a proper evaluation environment) which is likely evaluated prior-to attempting to compile.
For what it is worth, I was able to run this without r-base-dev installed, but maybe installing r-base-dev will pull in the correct, and updated, versions of what you need. I would be inclined to just reinstall all R-related packages.

Related

error while installing gmp (frama-c prerequisite) on mac os catalina using opam on terminal

I ran these commands to install Frama-C as said on http://frama-c.com/install-sulfur-20171101.html#installing-frama-c-on-mac-os-x:
brew install autoconf opam
Do not forget to opam init and eval $(opam config env) for a proper OPAM installation (if not already done before on your machine).
brew install gmp gtk+ gtksourceview libgnomecanvas
brew install graphviz
opam install altgr-ergo why3
I encountered an error after the 3rd command (of course there are 2 more commands to install frama-c completely, but the same error is showing up after the last command too).
ERROR while compiling conf-gmp.1
test.c:7:2: error: implicit declaration of function '__gmp_init' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
__gmp_init();
Your issue is related to opam and the conf-gmp (version 1) package in particular, which is used by Frama-C, but not caused by it.
If you do opam update and then opam install conf-gmp.2, you should be able to install the package without errors.
Otherwise, if you have control over whatever is adding -Werror to your CFLAGS environment variable, you can try removing it and reinstalling the packages.
Long explanation
It is likely that your CFLAGS environment variable contains -Werror or some similar setting which is causing the warning emitted by conf-gmp during its compilation to become an error.
The conf-gmp.1 package indeed does emit a warning when compiled, but in standard settings, the warning is simply ignored by opam and everything works. In your system, the warning became an error, and prevented the other packages from being installed.
A new version of conf-gmp was posted after the issue was noticed due to this question. Running opam update and then opam install conf-gmp.2 should get this new version and hopefully avoid any warnings. Note that having -Werrors in CFLAGS may trigger some issues in other packages, however. For instance, in my configuration, it is impossible to install lablgtk with -Werror, since its compilation inevitably raises several warnings. It might be necessary to add CFLAGS=-Wno-error or similar to ensure lablgtk will be compiled. Otherwise, you may have to compile Frama-C from source (lablgtk is optional in this case).

unable to install R package "nloptr" (R3.6.2 on Ubuntu 16.04) - C++ compiler issue

I'm having trouble installing the "car" package after upgrading R to 3.6.2 (from 3.4) on Ubuntu 16.04 due to (at least one) dependency (nloptr) that cannot be installed either. It seems to be a problem of the C++ compiler (it is using some deprecated "config" settings, however I'm lost trying to fix this).
I called the following command in R (from the terminal):
install.packages("nloptr")
Error Information:
Installing package into ‘/home/heike/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL 'https://ftp.fau.de/cran/src/contrib/nloptr_1.2.1.tar.gz'
Content type 'application/x-gzip' length 2448313 bytes (2.3 MB)
==================================================
downloaded 2.3 MB
* installing source package ‘nloptr’ ...
** package ‘nloptr’ successfully unpacked and MD5 sums checked
** using staged installation
'config' variable 'CPP' is deprecated
'config' variable 'CXXCPP' is deprecated
checking whether the C++ compiler works... no
configure: error: in /tmp/RtmpPLaJFA/R.INSTALL5e5ed06eeac/nloptr': configure: error: C++ compiler cannot create executables See config.log' for more details
ERROR: configuration failed for package ‘nloptr’
Steps taken so far
changed CRAN mirror and source.list entry
uninstalled and reinstalled R 3.6.2 (also on different machine), same issue remained
System Information
OS Version: Ubuntu 16.04 (x86_64-pc-linux-gnu (64-bit))
R Version: 3.6.2 (2019-12-12)
We have done a lot of work to make nloptr installation better. In essence, you have several choices:
if the system version of the nlopt library is present, use it -- that is the easiest so try installing it via sudo apt-get install libnlopt-dev and then reinstall
if it is not found, then a download of the source and build happens, and this seems to fail on your almost four year old Ubuntu system as it is hard to support all flavours --- but this works swimmingly on newer ones (I run Ubuntu too, but currently 19.10)
there are binaries for you as, see the Ubuntu packages page -- however these may not match your current R version which is mismatches to your distro R version
dependening on where you got R from (did you install a .deb?) you could use the Michael Rutter PPAs to get a current r-cran-nloptr
All this can also be discussed in detail on the r-sig-debian list for R on Debian and Ubuntu.
Edit: In response to the comment below:
To see what package apt knows about, do apt-cache policy r-cran-nloptr. Per the link I gave above we know Ubuntu has a r-cran-nloptr for your (very old) Xenial installation. However it will clash with the very new and current R you have running. Such as the costs of mixing and matching.
To access the Rutter PPAs and its over four thousand current binaries see the fourth paragraph at the top of the Ubuntu at CRAN README
Edit 2: I may have been too pessimistic. The Rutter PPA for the current R binaries has trusty, xenial and bionic. See https://launchpad.net/~marutter/+archive/ubuntu/c2d4u3.5

upgrading protobuf tensorflow on jetson tx2

To give as much background as possible -
I have a machine learning model trained using keras i'm trying to embed on an nvidia jetson tx2.
I have set up tensorflow on there (a bit of a pain in itself) however when i run my script i'm hitting an error with protobuf.
Using TensorFlow backend.
[libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires version 3.1.0 of the Protocol Buffer runtime library, but the installed version is 2.6.1. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "external/protobuf/src/google/protobuf/any.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): This program requires version 3.1.0 of the Protocol Buffer runtime library, but the installed version is 2.6.1. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "external/protobuf/src/google/protobuf/any.pb.cc".)
Aborted (core dumped)
So - i upgraded protobuf using pip at first but i thought the clash is because c++ version is taking priority and the version in linux was still stating 2.6.1 however after building in c++ the version is now shown as 3.1.0 however i am still getting the same error.
From the nvidia dev forums i received some feedback
"/usr/lib/aarch64-linux-gnu/libprotobuf.so.9.0.1
This means that C/C++ code will find version 2.6.
pip install protobuf-3.1.0-py2.py3-none-any.whl
This means that Python code will find version 3.1.
You need to upgrade the C++ (system) library to match version 3.1.
I don't think there's a default package on Ubuntu that does this, so you will have to either hack it by building your own and installing it on top of the system package, or you will have to find a deb package that has a newer version that will still install on your current system."
Ive really been struggling with this as i cant find a way to upgrade the system files. Any help would be much appreciated
Thanks
edit: i'm also wondering could this be a clash with GTK (i am also using openCV here so thats worth a mention!)
Please check your version of libprotobuf-dev.
Please try to uninstall your existing one on your PC with following commands:
apt-get remove --purge libprotobuf-dev
Then, build new version of libprotobuf-dev:
apt-get install autoconf automake libtool curl make g++ unzip
wget https://github.com/google/protobuf/releases/download/v3.5.0/protobuf-cpp-3.5.0.tar.gz
tar -xvf protobuf-cpp-3.5.0.tar.gz
cd protobuf-3.5.0
./autogen.sh
./configure
make
make check
sudo make install
sudo ldconfig
Good luck.
References:
https://github.com/BVLC/caffe/issues/5711
https://github.com/google/protobuf/issues/2979
step 1:
first, uninstall with purge protobuf
sudo apt-get remove --purge libprotobuf
step 2:
start a fresh one
$ wget https://raw.githubusercontent.com/jkjungavt/jetson_nano/master/install_protobuf-3.6.1.sh
sudo chmod +x install_protobuf-3.6.1.sh
./install_protobuf-3.6.1.sh #this time will take 30 min on my board.

What environment or package should be setup before building the pnacl toolchain

[11/05 update]
The problem is solved hours after i posted it by myself. If you are looking for the answer, hope the following information helps.
------------------Original message--------------------
This question is going to be two parts:
What OS system should be used?
there are many choice for developing pnacl, but what is the best or stable one.
What package should be installed?
this question is referenced to the question I asked before, see this
Until now, I'm not able to build it successfully.
From my experience, I don't think this compilation error is come from pnacl it's self, since every compilation error I solved is by installing some package that I don't installed. And at least, there is a person who successfully installed it
ex : texinfo, clang, bison...
Here is the package I installed from the beginning(after ubuntu installed) till now :
g++
gcc-multilib
g++-multilib
libsdl1.2-dev
texinfo
libcrypto++-dev
libssl-dev
lib32ncurses5-dev m4
libelf-dev
bison
git
gitk
git-core
bision
clang
cmake
subversion
I solved this problem by installing
byacc
flex
gyp
then it starts to build successfully

Installing Rcpp in R 2.10 on Ubuntu

I'm trying to install Rcpp on Ubuntu 10.04 and getting this error (which implies that it doesn't exist):
> install.packages("Rcpp")
Warning in install.packages("Rcpp") :
argument 'lib' is missing: using '/home/vadmin/R/i486-pc-linux-gnu-library/2.10'
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
package ‘Rcpp’ is not available
I have a working R instance and have installed many other packages.
Edit
Now I'm getting this error when running R CMD build Rcpp on the source code off svn:
** building package indices ... Error : running Stangle on vignette
'/home/vadmin/src/R/rcpp/pkg/Rcpp/inst/doc/Rcpp-modules.Rnw'
failed with message: invalid value for
'lang' : cpp ERROR: installing package
indices failed
* removing ‘/tmp/Rinst3041838816/Rcpp’ ERROR Installation failed.
A few things:
thanks for your interest in Rcpp :-)
it has been on CRAN as Rcpp for years; if you get a Rcpp not available error then you are looking at a bad CRAN mirror and I suggest using a different one
Ubuntu also has their Rcpp version of the Rcpp Debian package so you could just do 'sudo apt-get install r-cran-rcpp' (but that may be a dated version, alas)
In general, Romain and I suggest for Rcpp questions to come to the rcpp-devel list.
I'm J.I.Perotti from Argentina. First, sorry for my english. I had the same problem as stated here. But I solve it and may be useful to others. I have Ubuntu 9.10 Karmic Koala on a Pentium Dual Core T4200 (x86_64), successfully upgraded R to the 2.12.1 version, and then successfully installed Rcpp version 0.9.0
I make a kind of logbook with the process which I wrote in my blog:
http://deliriosderayohauno.blogspot.com/2011/01/r-installation.html
I don't know so much about this page, so I hope not write this where I should not (sorry if it is the case).
Best regards
I was helped by uninstalling R, and reinstalling the developer version:
sudo apt-get install r-base-dev
Then installing Rcpp in R:
install.packages('Rcpp')