[R] Problem installing/updating nloptr...

Ivan Krylov
Fri, 20 May 2022 05:58:02 -0000

On Thu, 19 May 2022 19:50:56 -0400
Brian Lunergan <ff809 at ncf.ca> wrote:

> CMake Error: The source directory
>
"/tmp/RtmpCNCU3l/R.INSTALL21c510095118/nloptr/src/CMAKE_RANLIB=/usr/bin
> /ranlib" 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 [options] [-- [native-options]]

The package's ./configure script got confused in a pretty spectacular
way. Unfortunately, Linux Mint 19.3 is based on Ubuntu 18.04, which
only has NLopt 2.4.2, insufficient for the latest version of nloptr (it
wants 2.7.0 or newer), so in order to install the latest version of the
package, you do need this step to succeed.

> Uninstalled the package and tried reinstalling. Same stumble so I now
> no longer have it at all, and it's needed to load Rcmdr.

Do you need the new version? Installing one of the older versions from
https://cran.r-project.org/src/contrib/Archive/nloptr/ should be a safe
bet. You can also use `sudo apt install libnlopt-dev` to skip the NLopt
build step once you find an old enough version of nloptr that's okay
with NLopt 2.4.2.

I'm not sure how this error could have happened, but if you send the
full installation log to <https://github.com/astamm/nloptr/issues>, they
may be able to figure it out.

--
Best regards,
Ivan