Skip to content

Problem installing Rcmdr on version 4.1.2...

4 messages · Ivan Krylov, Brian Lunergan, David Winsemius

#
Hi folks:

Running R 4.1.2 on Linux Mint 19.3. Tried to install Rcmdr, but when it
tried to install nloptr I got the following as it seemed to trip over
Cmake. Bit lengthy but here's what was spit out.

* installing *source* package ?nloptr? ...
** package ?nloptr? successfully unpacked and MD5 sums checked
** using staged installation
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ -std=gnu++14 accepts -g... yes
checking how to run the C++ preprocessor... g++ -std=gnu++14 -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ -std=gnu++14 accepts -g... (cached) yes
checking for pkg-config... /usr/bin/pkg-config
checking if pkg-config knows NLopt... no
using NLopt via local cmake build on x86_64
set CMAKE_BIN=/usr/bin/cmake
set CC=gcc -std=gnu99 -std=gnu11
set CFLAGS= -fpic -g -O2
-fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g
set CXX=g++
set CXXFLAGS=-std=gnu++11 -fpic -g -O2
-fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g
set LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro
CMake Error: The source directory
"/tmp/RtmpP4rvt0/R.INSTALL360c3be2694c/nloptr/src/nlopt-build" does not
exist.
Specify --help for usage, or press the help button on the CMake GUI.
Unknown argument -j
Unknown argument 2
Usage: cmake --build <dir> [options] [-- [native-options]]
Options:
  <dir>          = Project binary directory to be built.
  --target <tgt> = Build <tgt> instead of default targets.
                   May only be specified once.
  --config <cfg> = For multi-configuration tools, choose <cfg>.
  --clean-first  = Build target 'clean' first, then build.
                   (To clean only, use --target 'clean'.)
  --use-stderr   = Ignored.  Behavior is default in CMake >= 3.0.
  --             = Pass remaining options to the native tool.
CMake Error: The source directory
"/tmp/RtmpP4rvt0/R.INSTALL360c3be2694c/nloptr/src/nlopt" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
cp: cannot stat 'nlopt/include/*': No such file or directory
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG
-I../inst/include
-I'/home/brian/R/x86_64-pc-linux-gnu-library/4.1/testthat/include'
-fpic  -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c init_nloptr.c -o init_nloptr.o
gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG
-I../inst/include
-I'/home/brian/R/x86_64-pc-linux-gnu-library/4.1/testthat/include'
-fpic  -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c nloptr.c -o nloptr.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I../inst/include
-I'/home/brian/R/x86_64-pc-linux-gnu-library/4.1/testthat/include'
-fpic  -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c test-C-API.cpp -o test-C-API.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I../inst/include
-I'/home/brian/R/x86_64-pc-linux-gnu-library/4.1/testthat/include'
-fpic  -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c test-runner.cpp -o test-runner.o
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions
-Wl,-z,relro -o nloptr.so init_nloptr.o nloptr.o test-C-API.o
test-runner.o -llapack -lblas -lgfortran -lm -lquadmath -Lnlopt/lib
-lnlopt -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -lnlopt
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:10: recipe for target 'nloptr.so' failed
make: *** [nloptr.so] Error 1
ERROR: compilation failed for package ?nloptr?
* removing ?/home/brian/R/x86_64-pc-linux-gnu-library/4.1/nloptr?

I have cmake on mint in the current edition, but when I try to install
it in R it fires as not available for 4.1.2. Is there a version out
there that will work with 4.1.2? Where would I find it and how would I
install it? Any help/advice would be greatly appreciated.

Regards...
#
On Fri, 4 Mar 2022 08:23:43 -0500
Brian Lunergan <ff809 at ncf.ca> wrote:

            
Typically, when an R package wraps a third-party library, you need a
development version of it installed in order to install that package
from source.

If you're running R from the Linux Mint repos, try to install
r-cran-nloptr from Linux Mint repositories. If you don't, or have some
trouble installing the package, install the libnlopt-dev Linux Mint
package before trying to install the nloptr R package.
#
On 2022-03-04 8:34 a.m., Ivan Krylov wrote:

            
libnlopt-dev installed okay, but when I tried pulling in the r-cran
package I got this:

brian at brian-Aspire-ES1-511:~$ sudo apt-get install r-cran-nloptr
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help resolve the situation:

The following packages have unmet dependencies:
 r-cran-nloptr : Depends: r-api-3.4
E: Unable to correct problems, you have held broken packages.

I'll try the R site, but I'm open to other ideas.:-(
#
On 3/4/22 06:59, Brian Lunergan wrote:
That's not the typical way to install an R package from source.
Is there anything in your setup that would explain why nloptr is looking 
for an ancient version of R? I'm wondering if that binary package was 
created years ago and hasn't been replaced since nloptr was reconfigured 
to do the work of installing nlopt?

I'm also failing to install nloptr 2.0.0 using R 4.1.2 in an Ubuntu 
18.04 machine. The first reported error was not having Cmake, but 
installing Cmake then leads to failure both from the R console and from 
a terminal session with:

R CMD INSTALL ~/Downloads/nloptr_2.0.0.tar.gz

It fails at:

checking for pkg-config... /usr/bin/pkg-config
checking if pkg-config knows NLopt... no
using NLopt via local cmake build on x86_64
set CMAKE_BIN=/usr/bin/cmake
set CC=gcc -std=gnu99 -std=gnu11
set CFLAGS= -fpic -g -O2 
-fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=. 
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time 
-D_FORTIFY_SOURCE=2 -g
set CXX=g++
set CXXFLAGS=-std=gnu++11 -fpic -g -O2 
-fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=. 
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time 
-D_FORTIFY_SOURCE=2 -g -Wno-ignored-attributes
set LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro
CMake Error: The source directory 
"/tmp/RtmpzB1FjU/R.INSTALL289c4748c404/nloptr/src/nlopt-build" does not 
exist.

 ?My understanding is that the right place to post such difficulties is 
on R-SIG-debian, or at the Issues page: 
https://github.com/astamm/nloptr/issues/85