我試圖用命令RNetCDF無法打開共享對象文件
install.packages('RNetCDF',lib='/home/my_computer/RSCRIPTS/R_LIB/',configure.args="--with-netcdf-include='/home/my_computer/bin/libs4cdo-0.0.10/netcdf-4.2/include/' --with-netcdf-lib='/home/my_computer/local/bin' --with-hdf5-lib='/home/my_computer/local/lib/' --with-udunits-include='/usr/local/lib/' --with-udunits-lib='/usr/local/lib/'",repos='http://star-www.st-andrews.ac.uk/cran/')
我的筆記本電腦(Ubuntu的12.04)安裝RNetCDF包,但包不會安裝。請參閱下面的消息:
trying URL 'http://star-www.st-andrews.ac.uk/cran/src/contrib/RNetCDF_1.6.1-2.tar.gz'
Content type 'application/x-gzip' length 70301 bytes (68 Kb)
opened URL
==================================================
downloaded 68 Kb
* installing *source* package ‘RNetCDF’ ...
** package ‘RNetCDF’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking for nc_open in -lnetcdf... yes
checking for utInit in -ludunits2... no
checking for utScan in -ludunits2... yes
checking how to run the C preprocessor... gcc -std=gnu99 -E
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 netcdf.h usability... yes
checking netcdf.h presence... yes
checking for netcdf.h... yes
checking udunits.h usability... yes
checking udunits.h presence... yes
checking for udunits.h... yes
configure: creating ./config.status
config.status: creating R/load.R
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/usr/share/R/include -I/usr/local/lib/ -I/home/bauduinm/bin/libs4cdo-0.0.10/netcdf-4.2/include/ -fpic -O3 -pipe -g -c RNetCDF.c -o RNetCDF.o
gcc -std=gnu99 -shared -o RNetCDF.so RNetCDF.o -ludunits2 -lnetcdf -L/home/my_computer/local/lib/ -L/usr/local/lib/ -L/home/my_computer/local/bin -lexpat -L/usr/lib/R/lib -lR
installing to /home/my_computer/RSCRIPTS/R_LIB/RNetCDF/libs
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices ...
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/my_computer/RSCRIPTS/R_LIB/RNetCDF /libs/RNetCDF.so':
libexpat.so.0: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/my_computer/RSCRIPTS/R_LIB/RNetCDF’
The downloaded packages are in
‘/tmp/Rtmpl5MniY/downloaded_packages’
Warning message:
In install.packages("RNetCDF", lib = "/home/my_computer/RSCRIPTS/R_LIB/", :
installation of package ‘RNetCDF’ had non-zero exit status
當我試着使用
sudo R CMD INSTALL --libary='/home/my_computer/RSCRIPTS/R_LIB/' --configure-args="--with-netcdf-include='/home/my_computer/bin/libs4cdo-0.0.10/netcdf-4.2/include/' --with-netcdf-lib='/home/my_computer/local/lib/' --with-hdf5-lib='/home/my_computer/local/lib/' --with-udunits-include=/usr/local/lib/ --with-udunits-lib=/usr/local/lib/" /home/my_computer/Downloads/RNetCDF_1.6.1-2.tar.gz
錯誤信息被替換
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/usr/local/lib/R/site-library/RNetCDF/libs/RNetCDF.so':
libnetcdf.so.7: cannot open shared object file: No such file or directory
libnetcdf.so.7絕對是/home/my_computer/local/lib/
這也是我LD_LIBRARY_PATH
。無可否認,libexpat.so.0是第一個錯誤信息(與install.packages
)中的文件之一,位於intel相關文件夾中,看起來與netcdf庫無關。
任何人都可以啓發我嗎?
謝謝。
編輯:好吧,我永遠不會知道發生了什麼事,因爲當我在3天后再次嘗試使用完全相同的install.packages
命令行時,安裝的軟件包沒有任何問題......因此,對於可能擁有同樣的問題是註銷R並重新開始,以防萬一在會話中以前的錯誤留在日誌中。
在第一次嘗試中,當它無法加載庫時,它真的在這個路徑中有一個空格:'/ home/my_computer/RSCRIPTS/R_LIB/RNetCDF/libs/RNetCDF.so',還是格式化問題當你把它粘貼到SO? – nograpes 2013-05-13 17:26:36
此外,請閱讀[本文](http://ubuntuforums.org/showthread.php?t=1034715)關於鏈接'libexpat.so.0'。如果您安裝了較新的版本,您可能希望使用鏈接將軟件包指向正確的位置(如帖子所示),我懷疑您會這樣做。 – nograpes 2013-05-13 17:52:31
'@ nograpes'感謝您的評論。這迫使我查看空間問題(這是SO問題的格式化),重新運行命令行,並意識到我今天可以毫無問題地安裝軟件包。 – SnowFrog 2013-05-14 08:54:08