我有一个装有 antiX 的盒子,它是 Debian 的克隆版。我编译并安装了 nlopt 并且仍然:
> install.packages("nloptr")
Installing package into ‘/home/stephen/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://utstat.toronto.edu/cran/src/contrib/nloptr_1.2.2.2.tar.gz'
Content type 'application/x-gzip' length 2450931 bytes (2.3 MB)
==================================================
downloaded 2.3 MB
* installing *source* package ‘nloptr’ ...
** package ‘nloptr’ successfully unpacked and MD5 sums checked
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++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking for pkg-config... yes
configure: Now testing for NLopt header file.
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking nlopt.h usability... yes
checking nlopt.h presence... yes
checking for nlopt.h... yes
configure: Now testing for NLopt version 2.4.0 or greater.
configure: Suitable NLopt library found.
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating R/Pkgflags.R
** libs
g++ -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c dummy.cpp -o dummy.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.5.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 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c nloptr.c -o nloptr.o
g++ -shared -L/usr/lib/R/lib -Wl,-z,relro -o nloptr.so dummy.o init_nloptr.o nloptr.o -L/usr/local/lib -lnlopt -L/usr/lib/R/lib -lR
installing to /home/stephen/R/x86_64-pc-linux-gnu-library/3.5/nloptr/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error: package or namespace load failed for ‘nloptr’ in dyn.load(file,DLLpath = DLLpath,...):
unable to load shared object '/home/stephen/R/x86_64-pc-linux-gnu-library/3.5/nloptr/libs/nloptr.so':
libnlopt.so.0: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/stephen/R/x86_64-pc-linux-gnu-library/3.5/nloptr’
The downloaded source packages are in
‘/tmp/RtmpEtHKlT/downloaded_packages’
Warning message:
In install.packages("nloptr") :
installation of package ‘nloptr’ had non-zero exit status
我进入 nloptr 文件夹并运行 ./configure 和我在输出中看到的编译语句,我在 src 文件夹中有 nloptr.so。有没有办法手动继续安装并复制需要复制的内容?或者我可以检查一下。所以它是否有效?
$ ldd nloptr.so
linux-vdso.so.1 (0x00007ffdb6dc1000)
libnlopt.so.0 => not found
libR.so => /lib/libR.so (0x00007f0e9e6b4000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f0e9e530000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f0e9e3ad000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f0e9e393000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0e9e1d2000)
libblas.so.3 => /lib/x86_64-linux-gnu/libblas.so.3 (0x00007f0e9e163000)
libgfortran.so.5 => /lib/x86_64-linux-gnu/libgfortran.so.5 (0x00007f0e9def5000)
libquadmath.so.0 => /lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007f0e9deb3000)
libreadline.so.7 => /lib/x86_64-linux-gnu/libreadline.so.7 (0x00007f0e9dc66000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f0e9dbf2000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f0e9dbca000)
libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f0e9dbb5000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f0e9d997000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f0e9d98d000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0e9d988000)
libicuuc.so.63 => /lib/x86_64-linux-gnu/libicuuc.so.63 (0x00007f0e9d7b9000)
libicui18n.so.63 => /lib/x86_64-linux-gnu/libicui18n.so.63 (0x00007f0e9d4de000)
libgomp.so.1 => /lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f0e9d4ab000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f0e9d48a000)
/lib64/ld-linux-x86-64.so.2 (0x00007f0e9eb5b000)
libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f0e9d45c000)
libicudata.so.63 => /lib/x86_64-linux-gnu/libicudata.so.63 (0x00007f0e9ba6c000)
$ ls /usr/local/lib/libnl*
/usr/local/lib/libnlopt.so /usr/local/lib/libnlopt.so.0 /usr/local/lib/libnlopt.so.0.10.0
干杯
斯蒂芬