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

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

Related

What's the difference between two kernel version shown by ‘uname -a’?

I am using debian 9.4, the kernel version shown by uname -a is different, what's the actual kernel version? What does '4.9.82-1+deb9u3' mean?
Linux debian 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 GNU/Linux
apt-get source linux can get the source code of current kernel, then I can get original kernel tar file and debian patch.
$ls
linux-4.9.82 linux_4.9.82-1+deb9u3.dsc
linux_4.9.82-1+deb9u3.debian.tar.xz linux_4.9.82.orig.tar.xz
linux_4.9.82-1+deb9u3.debian.tar.xz contains many files, what are them used for? how to patch the it to linux_4.9.82.orig.tar.xz ?
linux-4.9.82 is the kernel source folder outputted by apt-get source command, which can be compiled to vmlinux. However, I usually can't debug the crash dump files with the vmlinux, as 'crash' command gives the error message: mismatch version. Should I download kernel 4.9.0 from kernel.org instead of linux-4.9.82 to debug my current running kernel ?
You have the package version. The name is made by:
4.9.82: the upstream version
-1: separator and Debian version of 4.9.82 upstream package. Note: if Debian is also upstream of a package, this field is skipped.
+deb9u3: this is a sort of micro-version. The +deb is used for security advisories, so minimal changes compared with 4.9.82-1. The 9 is the Debian version, and u3 is the third security version.
But kernels are different (compared with most of other packages): one could install many in parallel (but it will use only one). So in the package name you may have linux-image-4.9.0-3-amd64. In my system this package has version 4.9.30-2+deb9u1. So 4.9 is the kernel version. -amd64 is the architecture, this is the third major Debian version (-3) of 4.9(.0) series, which is based on 4.9.30.
the command uname will give you the kernel (as package name, so near the capability) in the field kernel-release and the package version (so exact reference to source) in the field kernel-version).
For the main question: I would use original kernel, and compile with upstream method (if I think the bug is kernel related, so it is easier to discuss with kernel maintainers), or I would use Debian sources (e.v. with patch), and build the kernel with Debian tools (and install the package to install the kernel), if I think the problem is in Debian, or just on old kernel versions.

GLIBCXX_3.4.21 at execution

I have a c++ code that is written and compile on my PC and executed on a remote server.
I changed recently my pc ans so set up everything uptodate on it. But now execution of my code on the unchanged server failed with this error:
./ReactionThermo: relocation error: ./ReactionThermo: symbol _ZTINSt8ios_base7failureB5cxx11E, version GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference
I look a bit on the web and it appears to be gcc fault. And indeed it's on my pc 5.4 and 4.8 on my server. I tried to upgrade it but got following error:
sudo apt-get install gcc-4.9
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
gcc-4.9 : Depends: cpp-4.9 (= 4.9.4-2ubuntu1~14.04.1) but it is not going to be installed
Depends: libgcc-4.9-dev (= 4.9.4-2ubuntu1~14.04.1) but it is not going to be installed
munge : Depends: libmunge2 (= 0.5.11-1ubuntu1) but 0.5.11-1ubuntu1.1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
I tried the apt-get -f install comand but it's not improving thinks.
Any ideas.
Thanks
PS: I knoz it's look like GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference but I don't want tu downgrade cpp, rather to upgrade it
In general, you need to build C/C++ binaries on the oldest operating system version you want to support, using the system compiler (or other vendor-supported compilers such as the Toolchain Module for SUSE Linux Enterprise Server or Developer Toolset for Red Hat Enterprise Linux). You cannot compile your program on a newer system and copy it to a different environment with an older (or different) operating system release. In simple cases, it might work, but in other cases, you will get dynamic linker failures at run time (like you did), or even silent data corruption.
Furthermore, you should look at build tools such as pbuilder and mock to automate building your software in a well-defined build environment.

RedHawk building from source --- locate the code installing uhd3.5.3

I am trying to build from source for RedHawk installation and trying to replace uhd3.5.3 with a higher version of uhd for USRP_UHD module. I saw USRP_UHD source code, but found nowhere for uhd3.5.3 source code. I am guessing it might simply use "yum install ..." to download and install uhd host code and suporting libraries. Does anybody know where this code is located in redhawk_src_2.0 package? Or is there an efficient way in linux to search for this among all the files in redhawk_src_2.0 package?
Thanks in advance!
UHD is the USRP Harware driver softwware from Ettus Research. The UHD is distributed from:
http://files.ettus.com/binaries/uhd_stable/
Version 3.5.3 is here:
http://files.ettus.com/binaries/uhd_stable/uhd_003.005.003-release/
The current release is 3.9.2:
http://files.ettus.com/binaries/uhd_stable/uhd_003.009.002-release/
Hopefully this helps. I wasn't 100% sure what you are asking for.
First, clone the uhd library:
git clone git://github.com/EttusResearch/uhd.git
Then checkout the 3.9.2 tag:
git checkout release_003_009_002
Using the instructions from Ettus (http://files.ettus.com/manual/page_build_guide.html), install the dependencies listed under the Fedora section:
sudo yum -y install boost-devel libusb1-devel python-mako doxygen python-docutils cmake make gcc gcc-c++
Next, generate the Makefiles with CMake:
cd <uhd-repo-path>/host
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/uhd ../
I recommend using an alternate install prefix at first to preserve the 3.5.3 version, just in case, but if you don't want to, just run:
cmake ../
instead of the longer command with the -DCMAKE_INSTALL_PREFIX flag. (Note: I couldn't get cmake to find the installed boost version, so you may have to do some other research on that since it is probably a whole different stackoverflow post in and of itself)
Now build and install the uhd library:
make
make test
sudo make install
Now that the library is installed, you should edit the USRP_UHD/cpp/configure.ac so that the PKG_CONFIG_PATH points to your install prefix (either the one specified in the flag above, or if you did the default, just leave it, as it should already be pointing to /usr/local/lib/pkgconfig). Also in the configure.ac file, make sure to change the uhd version number to 3.9.2.
Now you should be able to rebuild the USRP_UHD Device:
./reconf && ./configure && make install
I don't guarantee that the Device will build against the new version of the uhd library, that will depend on what (if anything) has been deprecated an removed from the library between the supported version and the newest one.
Finally, if you get through all of those steps successfully and if you specified a non-standard install prefix, you will have to add this prefix to either the LD_LIBRARY_PATH or an /etc/ld.so.conf.d/ script in order for the Device to correctly execute.
Clarification - you can follow the Redhawk manual appendix B for building Redhawk from source AFTER installing UHD v3.9.3 from source as per pwolframs instructions. The UHD v3.5.3 is not packaged with the Redhawk source code, only the Redhawk RPM, disregard all those RPMs when building UHD and Redhawk from source.

The tools required to build C++ code for R were 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
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.

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')