Installing nloptr on Linux - fatal error: nlopt.h: No such file or directory
另一个在Linux(Ubuntu 14.04.4 LTS)上安装nloptr软件包方面寻求帮助的消息。我浏览了许多问题,但没有设法找到解决方案。
我无法在R(版本3.3.1 / Rstudio 0.99.902版)中安装lme4软件包,因为nloptr的安装具有非零退出状态。当我尝试
1 | install.package("nloptr") |
我得到以下信息:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | Installing package into a€?/home/rd14/R/x86_64-pc-linux-gnu-library/3.3a€? (as a€?liba€? is unspecified) trying URL 'https://cran.rstudio.com/src/contrib/nloptr_1.0.4.tar.gz' Content type 'unknown' length 353942 bytes (345 KB) ================================================== downloaded 345 KB * installing *source* package a€?nloptra€? ... ** package a€?nloptra€? successfully unpacked and MD5 sums checked checking for g++... g++ 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... /bin/grep checking for egrep... /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... no checking nlopt.h presence... no checking for nlopt.h... no configure: Need to download and build NLopt trying URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz' Content type 'application/x-gzip' length 2361992 bytes (2.3 MB) ================================================== downloaded 2.3 MB configure: Starting to install library to /tmp/Rtmp7A1ldT/R.INSTALL66fffc391ed/nloptr/nlopt-2.4.2 configure: Done installing library to /tmp/Rtmp7A1ldT/R.INSTALL66fffc391ed/nloptr/nlopt-2.4.2 configure: creating ./config.status config.status: creating src/Makevars ** libs g++ -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c dummy.cpp -o dummy.o gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/tmp/Rtmp7A1ldT/R.INSTALL66fffc391ed/nloptr/nlopt-2.4.2/include -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c nloptr.c -o nloptr.o nloptr.c:42:19: fatal error: nlopt.h: No such file or directory #include"nlopt.h" ^ compilation terminated. make: *** [nloptr.o] Error 1 ERROR: compilation failed for package a€?nloptra€? * removing a€?/home/rd14/R/x86_64-pc-linux-gnu-library/3.3/nloptra€? Warning in install.packages : installation of package a€?nloptra€? had non-zero exit status The downloaded source packages are in a€?/tmp/Rtmp4Y3TXJ/downloaded_packagesa€? |
您的帮助将不胜感激!
谢谢。
当Jelmer和我构建此设置时,它仅在我的Ubuntu计算机上工作,并且可以继续进行-通过下载和构建
在Ubuntu上,最简单的解决方法可能是安装系统
也是
1 | sudo apt-get install libnlopt-dev |
,然后尝试再次安装nlopt。
类似地,您应该能够从Michael Rutter的适当PPA中获取