> install.packages('nloptr')
Installing package into '/home/rstudio/R/x86_64-pc-linux-gnu-library/4.1'
(as 'lib' is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/nloptr_2.0.0.tar.gz'
Content type 'application/x-gzip' length 2219414 bytes (2.1 MB)
==================================================
downloaded 2.1 MB
* 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
------------------ CMAKE NOT FOUND --------------------
CMake was not found on the PATH. Please install CMake:
- yum install cmake (Fedora/CentOS; inside a terminal)
- apt install cmake (Debian/Ubuntu; inside a terminal).
- pacman -S cmake (Arch Linux; inside a terminal).
- brew install cmake (MacOS; inside a terminal with Homebrew)
- port install cmake (MacOS; inside a terminal with MacPorts)
Alternatively install CMake from: <https://cmake.org/>
-------------------------------------------------------
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -I'/home/rstudio/R/x86_64-pc-linux-gnu-library/4.1/testthat/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -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 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -I'/home/rstudio/R/x86_64-pc-linux-gnu-library/4.1/testthat/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -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/rstudio/R/x86_64-pc-linux-gnu-library/4.1/testthat/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -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/rstudio/R/x86_64-pc-linux-gnu-library/4.1/testthat/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -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
make: *** [/usr/share/R/share/make/shlib.mk:10: nloptr.so] Error 1
ERROR: compilation failed for package 'nloptr'
* removing '/home/rstudio/R/x86_64-pc-linux-gnu-library/4.1/nloptr'
Warning in install.packages :
installation of package 'nloptr' had non-zero exit status
The downloaded source packages are in
'/tmp/RtmpqOB5Ww/downloaded_packages'
切换到Linux
su – 转root权限
密码
- apt install cmake
Exit
> install.packages('nloptr')
Installing package into '/home/rstudio/R/x86_64-pc-linux-gnu-library/4.1'
(as 'lib' is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/nloptr_2.0.0.tar.gz'
Content type 'application/x-gzip' length 2219414 bytes (2.1 MB)
==================================================
downloaded 2.1 MB
* 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
set CFLAGS= -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -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-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g
set LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.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/Rtmpol3oZD/R.INSTALLaa3fa7be96de9/nloptr/src/nlopt-build
Scanning dependencies of target generate-cpp
Scanning dependencies of target generate-fortran
[ 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
[ 72%] Building C object CMakeFiles/nlopt.dir/src/util/redblack.c.o
[ 72%] Building C object CMakeFiles/nlopt.dir/src/util/stop.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
-- Install configuration: "Release"
-- Installing: /tmp/Rtmpol3oZD/R.INSTALLaa3fa7be96de9/nloptr/src/nlopt/lib/pkgconfig/nlopt.pc
-- Installing: /tmp/Rtmpol3oZD/R.INSTALLaa3fa7be96de9/nloptr/src/nlopt/include/nlopt.h
-- Installing: /tmp/Rtmpol3oZD/R.INSTALLaa3fa7be96de9/nloptr/src/nlopt/include/nlopt.hpp
-- Installing: /tmp/Rtmpol3oZD/R.INSTALLaa3fa7be96de9/nloptr/src/nlopt/include/nlopt.f
-- Installing: /tmp/Rtmpol3oZD/R.INSTALLaa3fa7be96de9/nloptr/src/nlopt/lib/libnlopt.a
-- Installing: /tmp/Rtmpol3oZD/R.INSTALLaa3fa7be96de9/nloptr/src/nlopt/lib/cmake/nlopt/NLoptLibraryDepends.cmake
-- Installing: /tmp/Rtmpol3oZD/R.INSTALLaa3fa7be96de9/nloptr/src/nlopt/lib/cmake/nlopt/NLoptLibraryDepends-release.cmake
-- Installing: /tmp/Rtmpol3oZD/R.INSTALLaa3fa7be96de9/nloptr/src/nlopt/lib/cmake/nlopt/NLoptConfig.cmake
-- Installing: /tmp/Rtmpol3oZD/R.INSTALLaa3fa7be96de9/nloptr/src/nlopt/lib/cmake/nlopt/NLoptConfigVersion.cmake
-- Installing: /tmp/Rtmpol3oZD/R.INSTALLaa3fa7be96de9/nloptr/src/nlopt/share/man/man3/nlopt.3
-- Installing: /tmp/Rtmpol3oZD/R.INSTALLaa3fa7be96de9/nloptr/src/nlopt/share/man/man3/nlopt_minimize.3
-- Installing: /tmp/Rtmpol3oZD/R.INSTALLaa3fa7be96de9/nloptr/src/nlopt/share/man/man3/nlopt_minimize_constrained.3
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -I'/home/rstudio/R/x86_64-pc-linux-gnu-library/4.1/testthat/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -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 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -I'/home/rstudio/R/x86_64-pc-linux-gnu-library/4.1/testthat/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -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/rstudio/R/x86_64-pc-linux-gnu-library/4.1/testthat/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -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/rstudio/R/x86_64-pc-linux-gnu-library/4.1/testthat/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -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
installing to /home/rstudio/R/x86_64-pc-linux-gnu-library/4.1/00LOCK-nloptr/00new/nloptr/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (nloptr)
The downloaded source packages are in
'/tmp/RtmpqOB5Ww/downloaded_packages'