Comments (44)
I posted updated edited cmake_call.sh and nlopt_install.sh here
I think that maybe this should work and would be simpler:
mkdir nlopt-build
mkdir nlopt
cd nlopt-build
${CMAKE_BIN} \
-D BUILD_SHARED_LIBS=OFF \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=../nlopt \
-D NLOPT_CXX=ON \
-D NLOPT_GUILE=OFF \
-D NLOPT_MATLAB=OFF \
-D NLOPT_OCTAVE=OFF \
-D NLOPT_PYTHON=OFF \
-D NLOPT_SWIG=OFF \
-D NLOPT_TESTS=OFF \
${CMAKE_ADD_AR} ${CMAKE_ADD_RANLIB} ../nlopt-src
make -j${NCORES}
make install
cd ..
avoiding at all the nlopt_install.sh
script.
from nloptr.
Maybe just 'Installation on older Linux releases with older cmake' ? That is to me where the issue comes from.
from nloptr.
@astamm and @eddelbuettel , thank you for your patience.
I was also able to install nloptr using the updated branch on debian 10.12 container with cmake 3.13.4 and R-3.5.2.
from nloptr.
Might be worthwhile to toss this in the direction of Vienna as a 2.0.3, maybe in a few days to see if anything else comes up?
from nloptr.
I totally agree. I think we are saying the same thing -- it makes sense to me to support or not support a fallback to an older version of the library. At some point, any project has to move on. What that point is up to the development team.
And yes, users on Buster etc. can simply install from the archives -- I am so familiar with this strategy that was exactly the first thing I tried. :-)
from nloptr.
Well, I got my code working for the moment, so I thought I'd share in case it helps others.
The code already had this line:
available_packages <- available.packages(repos = CRAN_repo)
So, after that, I added a check to update nloptr's version:
### Deal with nloptr (needs to install v 2.0.1):
nloptr_row = which(available_packages == "nloptr")[1]
if (!is.na(nloptr_row) && available_packages[nloptr_row, 2] >= "2.0.2") {
available_packages[nloptr_row, 2] = "2.0.1"
}
At least for the moment that's working.
Full code is here: https://github.com/USEPA/cflinuxfs3-CRAN/blob/master/gitCRAN/R/package-request.R
Thanks!
from nloptr.
There's the possibility the answer to that is that I don't know the cleanest way to do things in R - I haven't worked with it a lot since grad school but have found a niche helping people deploy their R code to our cloud environment. We wind up needing to precompile things to make it work, which seems more about understanding Linux than R.
I wanted to minimize how much I changed the overall code, and I didn't know of a way to get update.packages to not try and immediately update the packages. Editing a matrix seemed like an easier task.
from nloptr.
Speaking of pre-compile, I did some related work recently I need to promote a bit to get the word out: 19,000 binaries (all of CRAN and a little over 200 from BioConductor) for Ubuntu 20,04 and 22.04. Intro tweets (with "demos") were https://twitter.com/eddelbuettel/status/1522220397357244416 and
https://twitter.com/eddelbuettel/status/1523376755548979201, more at https://eddelbuettel.github.io/r2u/
Anyway, glad you have a workaround!
from nloptr.
As always, thanks for all the work. The project looks great!
from nloptr.
Oops! Line 11 was contaminated when and copied and pasted codes to gists.
I removed the line and updated ot already.
from nloptr.
We should ensure though that it does properly work with cmake 3.2.0.
I just ran a quick test of your updated branch on Ubuntu 20.04 with cmake
version 3.16.3. No issues.
from nloptr.
Thanks a lot @eddelbuettel.
from nloptr.
I am pretty sure it should work as I recall using cmake
in this exact manner when they started v3
. Unless my memory proves wrong (which might happen).
from nloptr.
I will close this issue then. Don't hesitate to reach out if the fix is not sufficient.
from nloptr.
Which version of nloptr
did you use? Which Debian release?
Note that you sidestep
- the local compilation failure by installing nlopt:
sudo apt install libnlopt-dev
- the need for a package build by installing the package:
sudo apt install r-cran-nloptr
Of course, depending on which Debian release you use these may be older. A new version of nloptr
just went to CRAN (which involves inter alia a test build on Debian) and it already built on Fedora (see https://cran.r-project.org/web/checks/check_results_nloptr.html which will add more 2.0.2 builds) so I am not sure how general your issue is but we should of course any (reproducible) issues. Your report is however not yet reproducible as you omitted some important details of the build log.
from nloptr.
Thanks for the immediate reply:
cat /etc/issue
Debian GNU/Linux 10 \n \l
I followed the suggestion to use apt.
but it fails with:
The following packages have unmet dependencies:
r-cran-nloptr : Depends: r-api-3.5
and r-api-3.5 install did also fail (see below).
root@fgcz-r-033:/export/data02/PROLFQUA# sudo apt install libnlopt-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libnlopt-dev is already the newest version (2.4.2+dfsg-8+b1).
The following package was automatically installed and is no longer required:
distro-info-data
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 269 not upgraded.
root@fgcz-r-033:/export/data02/PROLFQUA# sudo apt 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 to resolve the situation:
The following packages have unmet dependencies:
r-cran-nloptr : Depends: r-api-3.5
E: Unable to correct problems, you have held broken packages.
Running does also error.
root@fgcz-r-033:/export/data02/PROLFQUA# sudo apt install r-api-3.5
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package r-api-3.5 is a virtual package provided by:
r-base-core 3.5.2-1 [Not candidate version]
E: Package 'r-api-3.5' has no installation candidate
from nloptr.
Ok, now we know you have Debian 10. Good.
What you didn't say is that you also switched to a newer R (likely via the Debian backport) so that r-api-3.5
is not provided. That precludes use of the package in the (old) distro due to your use of a new R. (You can see r-api-$VERSION
when you do apt-cache show r-base-core
, you will likely see r-api-4.0
from your use of a newer R.)
In that case you can still try installing libnlopt-dev
but the CRAN source package nloptr
may still want to build it again from source to have a newer one. For that you need to install cmake
, and it also tests for a recent enough version. That may be a stumbling block on Debian 10 but we can't tell -- all that information is actually logged to the console above the partial log you included in your first post but you did not show it so we have to now pull it out piece by piece.
from nloptr.
On a "fresh install" (to be more precise, on a new instance using a Google deep learning image), I get a similar (same) error.
- Also Debian Buster. I switched to R 4.2.
- I am able to install
libnlopt-dev
. - As above, I cannot install
r-cran-nloptr
. I seer-api-4.0
. - The following is the sessionInfo:
R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 10 (buster)
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.3.5.so
locale:
[1] LC_CTYPE=C LC_NUMERIC=C LC_TIME=C.UTF-8
[4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
[7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.2.0
- Cmake on Debian 10 is 3.13.4-1.
- The following is the console output:
Installing package into '/usr/local/lib/R/site-library'
(as 'lib' is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/nloptr_2.0.2.tar.gz'
Content type 'application/x-gzip' length 2219995 bytes (2.1 MB)
==================================================
downloaded 2.1 MB
During startup - Warning message:
Setting LC_CTYPE failed, using "C"
* 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 the compiler supports GNU C++... yes
checking whether g++ -std=gnu++14 accepts -g... yes
checking for g++ -std=gnu++14 option to enable C++11 features... none needed
checking how to run the C++ preprocessor... g++ -std=gnu++14 -E
checking whether the compiler supports GNU C++... (cached) yes
checking whether g++ -std=gnu++14 accepts -g... (cached) yes
checking for g++ -std=gnu++14 option to enable C++11 features... (cached) none needed
checking for pkg-config... /usr/bin/pkg-config
checking if pkg-config knows NLopt... yes
checking for pkg-config checking NLopt version... insufficient: NLopt 2.7.0 or later is preferred.
checking for cmake... /usr/bin/cmake
using NLopt via local cmake build on x86_64
set CMAKE_BIN=/usr/bin/cmake
set CC=gcc
set CFLAGS= -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/buster/r-base-4.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2
set CXX=g++
set CXXFLAGS=-std=gnu++11 -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/buster/r-base-4.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2
set LDFLAGS=-Wl,-z,relro
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- NLopt version 2.7.1
-- Looking for getopt.h
-- Looking for getopt.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for time.h
-- Looking for time.h - found
-- Looking for sys/time.h
-- Looking for sys/time.h - found
-- Looking for getpid
-- Looking for getpid - found
-- Looking for syscall
-- Looking for syscall - found
-- Looking for isinf
-- Looking for isinf - found
-- Looking for isnan
-- Looking for isnan - found
-- Looking for gettimeofday
-- Looking for gettimeofday - found
-- Looking for qsort_r
-- Looking for qsort_r - found
-- Looking for time
-- Looking for time - found
-- Looking for copysign
-- Looking for copysign - found
-- Looking for getopt
-- Looking for getopt - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of uint32_t
-- Check size of uint32_t - done
-- Check size of unsigned int
-- Check size of unsigned int - done
-- Check size of unsigned long
-- Check size of unsigned long - done
-- Looking for sqrt in m
-- Looking for sqrt in m - found
-- Looking for fpclassify
-- Looking for fpclassify - TRUE
-- Performing Test HAVE_THREAD_LOCAL_STORAGE
-- Performing Test HAVE_THREAD_LOCAL_STORAGE - Success
-- Performing Test HAVE_THREAD_LOCAL_STORAGE
-- Performing Test HAVE_THREAD_LOCAL_STORAGE - Failed
-- Looking for __cplusplus
-- Looking for __cplusplus - found
-- Performing Test SUPPORTS_STDCXX11
-- Performing Test SUPPORTS_STDCXX11 - Success
-- Performing Test HAS_FPIC
-- Performing Test HAS_FPIC - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/Rtmp1moXXs/R.INSTALL430a1a83d026/nloptr/src/nlopt-build
Scanning dependencies of target generate-fortran
Scanning dependencies of target generate-cpp
[ 1%] Generating nlopt.f
[ 3%] Generating nlopt.hpp
[ 3%] Built target generate-fortran
[ 3%] Built target generate-cpp
Scanning dependencies of target nlopt
[ 5%] Building C object CMakeFiles/nlopt.dir/src/algs/direct/DIRect.c.o
[ 7%] Building C object CMakeFiles/nlopt.dir/src/algs/direct/direct_wrap.c.o
[ 9%] Building C object CMakeFiles/nlopt.dir/src/algs/direct/DIRserial.c.o
[ 11%] Building C object CMakeFiles/nlopt.dir/src/algs/direct/DIRsubrout.c.o
[ 13%] Building C object CMakeFiles/nlopt.dir/src/algs/cdirect/cdirect.c.o
[ 15%] Building C object CMakeFiles/nlopt.dir/src/algs/cdirect/hybrid.c.o
[ 17%] Building C object CMakeFiles/nlopt.dir/src/algs/praxis/praxis.c.o
[ 19%] Building C object CMakeFiles/nlopt.dir/src/algs/luksan/plis.c.o
[ 21%] Building C object CMakeFiles/nlopt.dir/src/algs/luksan/plip.c.o
[ 23%] Building C object CMakeFiles/nlopt.dir/src/algs/luksan/pnet.c.o
[ 25%] Building C object CMakeFiles/nlopt.dir/src/algs/luksan/mssubs.c.o
[ 27%] Building C object CMakeFiles/nlopt.dir/src/algs/luksan/pssubs.c.o
[ 29%] Building C object CMakeFiles/nlopt.dir/src/algs/crs/crs.c.o
[ 31%] Building C object CMakeFiles/nlopt.dir/src/algs/mlsl/mlsl.c.o
[ 33%] Building C object CMakeFiles/nlopt.dir/src/algs/mma/mma.c.o
[ 35%] Building C object CMakeFiles/nlopt.dir/src/algs/mma/ccsa_quadratic.c.o
[ 37%] Building C object CMakeFiles/nlopt.dir/src/algs/cobyla/cobyla.c.o
[ 39%] Building C object CMakeFiles/nlopt.dir/src/algs/newuoa/newuoa.c.o
[ 41%] Building C object CMakeFiles/nlopt.dir/src/algs/neldermead/nldrmd.c.o
[ 43%] Building C object CMakeFiles/nlopt.dir/src/algs/neldermead/sbplx.c.o
[ 45%] Building C object CMakeFiles/nlopt.dir/src/algs/auglag/auglag.c.o
[ 47%] Building C object CMakeFiles/nlopt.dir/src/algs/bobyqa/bobyqa.c.o
[ 49%] Building C object CMakeFiles/nlopt.dir/src/algs/isres/isres.c.o
[ 50%] Building C object CMakeFiles/nlopt.dir/src/algs/slsqp/slsqp.c.o
[ 52%] Building C object CMakeFiles/nlopt.dir/src/algs/esch/esch.c.o
[ 54%] Building C object CMakeFiles/nlopt.dir/src/api/general.c.o
[ 56%] Building C object CMakeFiles/nlopt.dir/src/api/options.c.o
[ 58%] Building C object CMakeFiles/nlopt.dir/src/api/optimize.c.o
[ 60%] Building C object CMakeFiles/nlopt.dir/src/api/deprecated.c.o
[ 62%] Building C object CMakeFiles/nlopt.dir/src/api/f77api.c.o
[ 64%] Building C object CMakeFiles/nlopt.dir/src/util/mt19937ar.c.o
[ 66%] Building C object CMakeFiles/nlopt.dir/src/util/sobolseq.c.o
[ 68%] Building C object CMakeFiles/nlopt.dir/src/util/timer.c.o
[ 70%] Building C object CMakeFiles/nlopt.dir/src/util/stop.c.o
[ 72%] Building C object CMakeFiles/nlopt.dir/src/util/redblack.c.o
[ 74%] Building C object CMakeFiles/nlopt.dir/src/util/qsort_r.c.o
[ 76%] Building C object CMakeFiles/nlopt.dir/src/util/rescale.c.o
[ 78%] Building CXX object CMakeFiles/nlopt.dir/src/algs/stogo/global.cc.o
[ 80%] Building CXX object CMakeFiles/nlopt.dir/src/algs/stogo/linalg.cc.o
[ 82%] Building CXX object CMakeFiles/nlopt.dir/src/algs/stogo/local.cc.o
[ 84%] Building CXX object CMakeFiles/nlopt.dir/src/algs/stogo/stogo.cc.o
[ 86%] Building CXX object CMakeFiles/nlopt.dir/src/algs/stogo/tools.cc.o
[ 88%] Building CXX object CMakeFiles/nlopt.dir/src/algs/ags/evolvent.cc.o
[ 90%] Building CXX object CMakeFiles/nlopt.dir/src/algs/ags/solver.cc.o
[ 92%] Building CXX object CMakeFiles/nlopt.dir/src/algs/ags/local_optimizer.cc.o
[ 94%] Building CXX object CMakeFiles/nlopt.dir/src/algs/ags/ags.cc.o
[ 96%] Linking CXX static library libnlopt.a
[100%] Built target nlopt
CMake Error: The source directory "/tmp/Rtmp1moXXs/R.INSTALL430a1a83d026/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 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -I'/usr/local/lib/R/site-library/testthat/include' -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/buster/r-base-4.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c init_nloptr.c -o init_nloptr.o
gcc -I"/usr/share/R/include" -DNDEBUG -I../inst/include -I'/usr/local/lib/R/site-library/testthat/include' -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/buster/r-base-4.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c nloptr.c -o nloptr.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -I'/usr/local/lib/R/site-library/testthat/include' -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/buster/r-base-4.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c test-C-API.cpp -o test-C-API.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -I'/usr/local/lib/R/site-library/testthat/include' -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/buster/r-base-4.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c test-runner.cpp -o test-runner.o
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-z,relro -o nloptr.so init_nloptr.o nloptr.o test-C-API.o test-runner.o -llapack -lblas -lgfortran -lm -lquadmath nlopt/lib/libnlopt.a -L/usr/lib/R/lib -lR
g++: error: nlopt/lib/libnlopt.a: No such file or directory
make: *** [/usr/share/R/share/make/shlib.mk:10: nloptr.so] Error 1
ERROR: compilation failed for package 'nloptr'
* removing '/usr/local/lib/R/site-library/nloptr'
The downloaded source packages are in
'/tmp/Rtmpa5TVOl/downloaded_packages'
devtools::install_version("nloptr", version = "2.0.1", repos = "http://cran.us.r-project.org")
succeeds after trying to build nlopt from sources and failing. The point of failure in installing the library seems to be linking nlopt library via nlopt/lib/libnlopt.a as even in this case nlopt does not build (perhaps due to the old cmake?) but nloptr is now able to find nlopt through the apt installation whereas in 2.0.2 it searches forlibnlopt.a
.
Downloading package from url: http://cran.us.r-project.org/src/contrib/Archive/nloptr/nloptr_2.0.1.tar.gz
Installing package into '/usr/local/lib/R/site-library'
(as 'lib' is unspecified)
During startup - Warning message:
Setting LC_CTYPE failed, using "C"
* 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 the compiler supports GNU C++... yes
checking whether g++ -std=gnu++14 accepts -g... yes
checking for g++ -std=gnu++14 option to enable C++11 features... none needed
checking how to run the C++ preprocessor... g++ -std=gnu++14 -E
checking whether the compiler supports GNU C++... (cached) yes
checking whether g++ -std=gnu++14 accepts -g... (cached) yes
checking for g++ -std=gnu++14 option to enable C++11 features... (cached) none needed
checking for pkg-config... /usr/bin/pkg-config
checking if pkg-config knows NLopt... yes
checking for pkg-config checking NLopt version... insufficient: NLopt 2.7.0 or later is preferred.
checking for cmake... /usr/bin/cmake
using NLopt via local cmake build on x86_64
set CMAKE_BIN=/usr/bin/cmake
set CC=gcc
set CFLAGS= -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/buster/r-base-4.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2
set CXX=g++
set CXXFLAGS=-std=gnu++11 -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/buster/r-base-4.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2
set LDFLAGS=-Wl,-z,relro
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- NLopt version 2.7.1
-- Looking for getopt.h
-- Looking for getopt.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for time.h
-- Looking for time.h - found
-- Looking for sys/time.h
-- Looking for sys/time.h - found
-- Looking for getpid
-- Looking for getpid - found
-- Looking for syscall
-- Looking for syscall - found
-- Looking for isinf
-- Looking for isinf - found
-- Looking for isnan
-- Looking for isnan - found
-- Looking for gettimeofday
-- Looking for gettimeofday - found
-- Looking for qsort_r
-- Looking for qsort_r - found
-- Looking for time
-- Looking for time - found
-- Looking for copysign
-- Looking for copysign - found
-- Looking for getopt
-- Looking for getopt - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of uint32_t
-- Check size of uint32_t - done
-- Check size of unsigned int
-- Check size of unsigned int - done
-- Check size of unsigned long
-- Check size of unsigned long - done
-- Looking for sqrt in m
-- Looking for sqrt in m - found
-- Looking for fpclassify
-- Looking for fpclassify - TRUE
-- Performing Test HAVE_THREAD_LOCAL_STORAGE
-- Performing Test HAVE_THREAD_LOCAL_STORAGE - Success
-- Performing Test HAVE_THREAD_LOCAL_STORAGE
-- Performing Test HAVE_THREAD_LOCAL_STORAGE - Failed
-- Looking for __cplusplus
-- Looking for __cplusplus - found
-- Performing Test SUPPORTS_STDCXX11
-- Performing Test SUPPORTS_STDCXX11 - Success
-- Performing Test HAS_FPIC
-- Performing Test HAS_FPIC - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/RtmpdsIsFn/remotes55633896a32f/nloptr/src/nlopt-build
Scanning dependencies of target generate-fortran
Scanning dependencies of target generate-cpp
[ 1%] Generating nlopt.f
[ 3%] Generating nlopt.hpp
[ 3%] Built target generate-fortran
[ 3%] Built target generate-cpp
Scanning dependencies of target nlopt
[ 5%] Building C object CMakeFiles/nlopt.dir/src/algs/direct/DIRect.c.o
[ 7%] Building C object CMakeFiles/nlopt.dir/src/algs/direct/direct_wrap.c.o
[ 9%] Building C object CMakeFiles/nlopt.dir/src/algs/direct/DIRserial.c.o
[ 11%] Building C object CMakeFiles/nlopt.dir/src/algs/direct/DIRsubrout.c.o
[ 13%] Building C object CMakeFiles/nlopt.dir/src/algs/cdirect/cdirect.c.o
[ 15%] Building C object CMakeFiles/nlopt.dir/src/algs/cdirect/hybrid.c.o
[ 17%] Building C object CMakeFiles/nlopt.dir/src/algs/praxis/praxis.c.o
[ 19%] Building C object CMakeFiles/nlopt.dir/src/algs/luksan/plis.c.o
[ 21%] Building C object CMakeFiles/nlopt.dir/src/algs/luksan/plip.c.o
[ 23%] Building C object CMakeFiles/nlopt.dir/src/algs/luksan/pnet.c.o
[ 25%] Building C object CMakeFiles/nlopt.dir/src/algs/luksan/mssubs.c.o
[ 27%] Building C object CMakeFiles/nlopt.dir/src/algs/luksan/pssubs.c.o
[ 29%] Building C object CMakeFiles/nlopt.dir/src/algs/crs/crs.c.o
[ 31%] Building C object CMakeFiles/nlopt.dir/src/algs/mlsl/mlsl.c.o
[ 33%] Building C object CMakeFiles/nlopt.dir/src/algs/mma/mma.c.o
[ 35%] Building C object CMakeFiles/nlopt.dir/src/algs/mma/ccsa_quadratic.c.o
[ 37%] Building C object CMakeFiles/nlopt.dir/src/algs/cobyla/cobyla.c.o
[ 39%] Building C object CMakeFiles/nlopt.dir/src/algs/newuoa/newuoa.c.o
[ 41%] Building C object CMakeFiles/nlopt.dir/src/algs/neldermead/nldrmd.c.o
[ 43%] Building C object CMakeFiles/nlopt.dir/src/algs/neldermead/sbplx.c.o
[ 45%] Building C object CMakeFiles/nlopt.dir/src/algs/auglag/auglag.c.o
[ 47%] Building C object CMakeFiles/nlopt.dir/src/algs/bobyqa/bobyqa.c.o
[ 49%] Building C object CMakeFiles/nlopt.dir/src/algs/isres/isres.c.o
[ 50%] Building C object CMakeFiles/nlopt.dir/src/algs/slsqp/slsqp.c.o
[ 52%] Building C object CMakeFiles/nlopt.dir/src/algs/esch/esch.c.o
[ 54%] Building C object CMakeFiles/nlopt.dir/src/api/general.c.o
[ 56%] Building C object CMakeFiles/nlopt.dir/src/api/options.c.o
[ 58%] Building C object CMakeFiles/nlopt.dir/src/api/optimize.c.o
[ 60%] Building C object CMakeFiles/nlopt.dir/src/api/deprecated.c.o
[ 62%] Building C object CMakeFiles/nlopt.dir/src/api/f77api.c.o
[ 64%] Building C object CMakeFiles/nlopt.dir/src/util/mt19937ar.c.o
[ 66%] Building C object CMakeFiles/nlopt.dir/src/util/sobolseq.c.o
[ 68%] Building C object CMakeFiles/nlopt.dir/src/util/timer.c.o
[ 70%] Building C object CMakeFiles/nlopt.dir/src/util/stop.c.o
[ 72%] Building C object CMakeFiles/nlopt.dir/src/util/redblack.c.o
[ 74%] Building C object CMakeFiles/nlopt.dir/src/util/qsort_r.c.o
[ 76%] Building C object CMakeFiles/nlopt.dir/src/util/rescale.c.o
[ 78%] Building CXX object CMakeFiles/nlopt.dir/src/algs/stogo/global.cc.o
[ 80%] Building CXX object CMakeFiles/nlopt.dir/src/algs/stogo/linalg.cc.o
[ 82%] Building CXX object CMakeFiles/nlopt.dir/src/algs/stogo/local.cc.o
[ 84%] Building CXX object CMakeFiles/nlopt.dir/src/algs/stogo/stogo.cc.o
[ 86%] Building CXX object CMakeFiles/nlopt.dir/src/algs/stogo/tools.cc.o
[ 88%] Building CXX object CMakeFiles/nlopt.dir/src/algs/ags/evolvent.cc.o
[ 90%] Building CXX object CMakeFiles/nlopt.dir/src/algs/ags/solver.cc.o
[ 92%] Building CXX object CMakeFiles/nlopt.dir/src/algs/ags/local_optimizer.cc.o
[ 94%] Building CXX object CMakeFiles/nlopt.dir/src/algs/ags/ags.cc.o
[ 96%] Linking CXX static library libnlopt.a
[100%] Built target nlopt
CMake Error: The source directory "/tmp/RtmpdsIsFn/remotes55633896a32f/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 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -I'/usr/local/lib/R/site-library/testthat/include' -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/buster/r-base-4.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c init_nloptr.c -o init_nloptr.o
gcc -I"/usr/share/R/include" -DNDEBUG -I../inst/include -I'/usr/local/lib/R/site-library/testthat/include' -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/buster/r-base-4.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c nloptr.c -o nloptr.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -I'/usr/local/lib/R/site-library/testthat/include' -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/buster/r-base-4.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c test-C-API.cpp -o test-C-API.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -I'/usr/local/lib/R/site-library/testthat/include' -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/buster/r-base-4.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c test-runner.cpp -o test-runner.o
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -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
installing to /usr/local/lib/R/site-library/00LOCK-nloptr/00new/nloptr/libs
** R
** inst
** byte-compile and prepare package for lazy loading
During startup - Warning message:
Setting LC_CTYPE failed, using "C"
** help
*** installing help indices
*** copying figures
** building package indices
During startup - Warning message:
Setting LC_CTYPE failed, using "C"
** installing vignettes
** testing if installed package can be loaded from temporary location
During startup - Warning message:
Setting LC_CTYPE failed, using "C"
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
During startup - Warning message:
Setting LC_CTYPE failed, using "C"
** testing if installed package keeps a record of temporary installation path
* DONE (nloptr)
from nloptr.
There was a recent change made by @astamm, namely 9f42e4d, which aimed to restore something on macOS, it seems like it creates problems on Linux. You could try to revert it. But as demonstrated below, it works for me in both settings so I do not see how / where it is wrong now.
One other key issue is that your buster
release contains an libnlopt-dev
that is too old. We need 2.7.0 or later. Note the line
checking for pkg-config checking NLopt version... insufficient: NLopt 2.7.0 or later is preferred.
which leads us down the road of having to build NLopt from source.
I just tried in a current Debian via the r-base
container I maintain. installation works both ways:
- with
libnlopt-dev
present, it uses it and installnlpoptr
from source just fine - without
livnlopt-dev
, it also works fine with locallu builtlibnlopt.a
In the first case of a system libnlopt
the link line is
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-z,relro -o nloptr.so init_nloptr.o nloptr.o test-C-API.o test-runner.o -llapack -lblas -lgfortran -lm -lquadmath -lnlopt -L/usr/lib/R/lib -lR
make[1]: Leaving directory '/tmp/RtmpZiWaxT/R.INSTALL135b5cb8c95/nloptr/src'
installing to /usr/local/lib/R/site-library/00LOCK-nloptr/00new/nloptr/libs
In the second case with a local libnlopt.a
the final link line is
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-z,relro -o nloptr.so init_nloptr.o nloptr.o test-C-API.o test-runner.o -llapack -lblas -lgfortran -lm -lquadmath nlopt/lib/libnlopt.a -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/00LOCK-nloptr/00new/nloptr/libs
So I cannot reproduce this for you. Sorry.
from nloptr.
Yes,libnlopt-dev
is old on Buster.
Package: libnlopt-dev
Source: nlopt (2.4.2+dfsg-8)
Version: 2.4.2+dfsg-8+b1
In fact, everything is old on Buster because Buster is old! But as is so often true in the software industry, being stuck on an ancient distro is just the way it is because there are a million dependencies and so many considerations. /rant.
Perhaps an option is to, after attempting to build nlopt
locally, test if nlopt/lib/libnlopt.a
exists and to use it if it does and to otherwise link to system libnlopt
as a fallback even if libnlopt
is old? Understood there may be downstream issues from the use of an older and non-supported version of the library so I will leave that decision to the development team on whether or not to support a fallback to an older system library.
from nloptr.
But as is so often true in the software industry, being stuck on an ancient distro is just the way it is because there are a million dependencies and so many considerations. /rant.
Sure. But then please also contend yourself with the working version of nloptr
from CRAN's archive section that corresponds to the vintage age of your working environment. And please note that I am not blaming you or anyone, I also had workplaces that insisted on versions of CentOS made during the French revolution and whatnot. Luckily that is now in the past and I have better control over these things (and the opposite problem with colleagues pushing for C++20 😉 ).
Around CRAM we are all (generally) volunteer package maintainers who work rather hard at keeping everything working and well-oiled according to CRAN tests so if you need current packages it simply works better on current resources. The most recent change was needed to address a macOS issue blocking (AFAIK) all users on macOS (by no longer having binaries).
So your best bet is to locally hack this. Get your the nlopt
library. It will need a recent-ish cmake
at most. Install it in /usr/local/
. The mod our package as needed. It is really not that much work.
from nloptr.
Sorry for the dumb question, but I'm having the same problem in Ubuntu 18. I'm successfully installing nloptr v 2.0.1, but then when I try to install something with a dependency on nloptr it tries to install 2.0.2 and fails. Is my only option to use dependencies as False, or do you know of some better way to handle it?
from nloptr.
From context it sounds you are using an installer that defaults to updating related packages? I don't -- I content myself with install.packages()
(which default touches one, named, package once dependencies are satisfied) and update.packages()
(which we know you cannot run).
Or maybe you tried to install a package with a versioned dependency on nloptr
? Possibly, though unlikely, as that version is not even two days old. In any event I cannot give more precise recommendations as your question simply lacked pertinent details and reproducibility. You didn't say much besides 'Ubuntu 18' (and I assume you meant 18.04) and 'trouble'.
from nloptr.
OK, thanks; yes, I was using install.packages for something else. Just wondering if I was missing something obvious.
from nloptr.
The R package manager does not have a 'hold' or 'pin' feature. That is the way it is. But sometimes we want (or must) stick with an older version. One solution I have deployed once is to keep a "hidden" or "cache" library directory somewhere where the scripts or code that need it know to access it, but the "normal" R use does not. That way you can continue to enjoy update.packages()
for the rest of your sytem yet enjoy the use one (or more) held back packages.
A simple implementation of that scheme is in my helper script roxy.r
which allows me to use the (ancient but lighter-weight) roxygen2
version 6.0.1 which I happen to prefer for some use cases over the current one (and the why is immaterial to our discussion, the mechanics still work). It is a script because I happen to work a lot on the command-line with short, dedicated helper scripts. You could try something like that, or encapsulate the same in helper functions that explicitly load via library()
with a lib.loc
argument. Just a thought...
from nloptr.
You re-invented update.packages()
. Why? (Just naturally curious, I mucked about with helpers too. Do you need to control what is / isn't available at CRAN?)
from nloptr.
configure
tries to build nloptr
(Version 2.7.0) in directory src
from the tar nlopt-src.tar.gz
which fails (don't know why).
Building and installing nloptr
from the tar manually works and afterwards configure
finds it and uses it.
from nloptr.
You are not giving enough details for us to reproduce your problem.
from nloptr.
I also failed to upgrade to nloptr 2.0.2 recently on Ubuntu 18.04 with R-4.2.0 , which has libnlopt-dev 2.4.2.
The version of cmake installed by system is 3.10.2.
When I tried upgrading to 2.0.2, compilation of embedded nlopt was attempted because the version of nlopt installed is older (<2.7.0) but failed.
In the case of 2.0.0 and 2.0.1, compilation of embedded nlopt also failed but then older nlopt installed by the system was linked and instllation of nloptr finished without error. This difference was caused due to the recent changes made as suggested by @eddelbuettel .
As for the failure to compile embedded nlopt. I found scripts used to compile and install embedded nlopt tools/cmake_call.sh and src/scripts/nlopt_install.sh use cmake's command line options (at least -B, -S and --install) that are not available for the older (3.10.2) cmake installed on Ubuntu 18.04.
I am not an expert of cmake so that I do not have any proposal for use of older version of cmake.
I am very sorry for only reporting the situation.
from nloptr.
I edited tools/cmake_call.sh and src/scripts/nlopt_install.sh to make cmake command options compatible with cmake 3.10.2 which is the version Ubuntu 18.04 installed. They are posted here. They worked for me, though edited scripts are not clean as compared with the originals.
from nloptr.
That is a good idea, and a good initiative. We may need a bit more generalization though.
Line 11 looks off, there is a dangling }
: MAKE_ADD_AR} ${CMAKE_ADD_RANLIB}
This also seems to conflate the use of AR
and RANLIB
(a change from R 4.0.0 ?) that are not related per se to cmake
but more to older systems.
from nloptr.
@astamm Might be a good idea to retitle this one too to, say, 'Problem installing in Debian 10 or Ubuntu 18.04' as the use of an unqualified 'Problem' is not correct.
from nloptr.
I posted updated edited cmake_call.sh and nlopt_install.sh here
They should be cleaner than what I posted on gist yesterday.
I made sure that they work on an Ubuntu 18.04 container with cmake 3.10.2
I understand that the requirement of cmake (>=3.15) is stated in readme.md.
Nevertheless, because CMakeLists.txt of nlopt itself stated the requirement of cmake (>=3.2)
cmake_minimum_required (VERSION 3.2)
I would like to ask to consider to revise above two scripts to allow nloptr to install onto older linux dist with older cmake.
from nloptr.
The current Debian release still under support:
- Debian 10 Buster: cmake 3.13.4
- Debian 11 Bullseye: cmake 3.18.4
from nloptr.
All of you are making a good point. We will consider this in the next release.
As for the linking to nlopt/lib/libblopt.a
failing on Linux, it would be good to find the source of that problem to provide a fix as well.
I am mainly running under macOS so if anyone here has more insight into this, I would be glad.
from nloptr.
The error to link nlopt/lib/libblopt.a by calling following commands
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-z,relro -o nloptr.so init_nloptr.o nloptr.o test-C-API.o test-runner.o -llapack -lblas -lgfortran -lm -lquadmath nlopt/lib/libnlopt.a -L/usr/lib/R/lib -lR
g++: error: nlopt/lib/libnlopt.a: No such file or directory
is probably because g++ searched nlopt/lib/libnlopt.a
on nloptr/src/.
In the case of debian 10.12 with cmake 3.13, compilation of nlopt finished but the command
cmake --install nlopt --prefix nlopt
failed because nloptr/src/nlopt was not found.
In the case of Ubuntu 18.04 with cmake 3.10.2, cmake failed to create build scripts because -S option did not exist for cmake 3.10.2.
In bose cases although cmake did not finish properly and failed to write (nloptr/src/)nlopt/lib/libnlopt.a,
the next step of build process to build nlopt was executed so that g++ failed to find nlopt/lib/libnlopt.a
I guess, this error could be occur on macos, too, if the version of cmake installed is older enough.
from nloptr.
Ok. So if I am understanding you correctly, the linking issue would reflect a failure from cmake
that prevents the creation of the nlopr/include
and nlopt/lib
subdirectories, ultimately preventing g++
from finding nlopt/lib/libnlopt.a
. Am I right?
In this case, increasing backward compatibility with older cmake
versions should kill two birds with the same stone?
from nloptr.
Yes, My idea is that failure of cmake at different stages depending on the versions of cmake prevented from creation of include files and libnlopt.a to the proper location (more precisely search path for library files for libnlopt.a) of g++.
I have not yet checked precisely though for versions 2.0.0 and 2.0.1 of nlopt, on Ubuntu 18.04, cmake failed to create libnlopt.a
Then g++ linked older version of libnlopt which was provided by Ubuntu. 2.0.2 behaves differently.
As I mentioned, lack of some newly implemented options of cmake that are used in the two scripts should be the cause of the error reported in the 1st post of this issue as well as the error on Ubuntu 18.04. Those new options enable to write the scripts shorter. On the other hand, as I demonstrated, it is possible to modify those scripts to be able to run with older versions of cmake (at least newer than 3.10).
Speaking to nlopt, its CMakeLists.txt only requires cmake newer than 3.2 which is old enough. I do not think, increasing backward compatibility to the older versions of cmake cause further problem. The key challenge would be to control the location of includes and library created by nlopt to make them accessible from g++
from nloptr.
In addition, I was able to install nloptr 2.0.2 with replacing original cmake_call.sh and nlopt_install.sh with modified version I put on gist on macOS 12.5 with R4.20 (installed using the homebrew formula available at here and cmake 3.23.1 from homebrew.
I do think, older syntax of cmake is compatible with the latest version of cmake
from nloptr.
Yes, that looks good from a first glance.
from nloptr.
I just pushed a commit with this, adjusting various files including documentation which states minimal version requirement for cmake
is now 3.2.0
(same as the one required by the nlopt
library). We should ensure though that it does properly work with cmake 3.2.0
.
from nloptr.
Would it be ok if I renamed the issue into Required support for older cmake versions shipped with some popular unix systems or something like that?
from nloptr.
Changes in 9852921 pass all my checks and seem to fix this issue. Let me know if that works for you too.
from nloptr.
We should ensure though that it does properly work with cmake 3.2.0.
I just ran a second test of your updated branch on Ubuntu 18.04 with cmake
version 3.10.2. No issues either.
But I have no time for other releases where I cannot get the thirty (!!!) dependencies of testthat
as binaries so I leave that for someone else. Docker is quick, binaries help, and I know where to get them for Ubuntu LTS releases.
from nloptr.
Related Issues (20)
- Compiling error when installing due to abs ambiguous call HOT 4
- set_vector_storage LBFGS HOT 2
- Error installing `nloptr` from source on CentOS cluster HOT 16
- Python vs R Speed Differences HOT 2
- How to address CRAN request to remove C++11 when it is not needed? HOT 5
- The old implementation of COBYLA is buggy and challenging to maintain. Switch to the PRIMA implementation? HOT 2
- Equality constraint with COBYLA HOT 5
- Compilation fails R4.3.0 HOT 20
- Tests for directL fail HOT 3
- Make tinytest unit test files self-sufficient HOT 4
- Three test files assume `options(digits=7)` but do not set it HOT 3
- R installation error: cannot find libnlopt.so.0 HOT 15
- Add functions for setting parameter bounds HOT 2
- Update cmake installation instructions on Mac with brew HOT 1
- Inequality direction in wrapper functions HOT 5
- Output for two auglag() examples in package reference manual is not reproducible HOT 3
- Annotations in reference manual example code are incorrect HOT 3
- push a new version to CRAN? HOT 11
- Slow Convergence Times For Local Gradient Based Algos HOT 8
- Modification of test-C-API.cpp HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nloptr.