2013-06-10 18 views
5

Sto cercando di installare il pacchetto R ncdf su un server di Ubuntu 10.04:installazione del pacchetto NCDF fallisce a causa di collegamento interno mancante anche se è lì

install.packages("ncdf", type = "source") 
Installing package into ‘/home/me/R/x86_64-pc-linux-gnu-library/3.0’ 
(as ‘lib’ is unspecified) 
trying URL 'http://cran.rstudio.com/src/contrib/ncdf_1.6.6.tar.gz' 
Content type 'application/x-gzip' length 79403 bytes (77 Kb) 
opened URL 
================================================== 
downloaded 77 Kb 

* installing *source* package ‘ncdf’ ... 
** package ‘ncdf’ successfully unpacked and MD5 sums checked 
checking for nc-config... no 
checking for gcc... gcc -std=gnu99 
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 gcc -std=gnu99 accepts -g... yes 
checking for gcc -std=gnu99 option to accept ISO C89... none needed 
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... no 
checking for sys/types.h... no 
checking for sys/stat.h... no 
checking for stdlib.h... no 
checking for string.h... no 
checking for memory.h... no 
checking for strings.h... no 
checking for inttypes.h... no 
checking for stdint.h... no 
checking for unistd.h... no 
checking netcdf.h usability... no 
checking netcdf.h presence... no 
checking for netcdf.h... no 
configure: error: netcdf header netcdf.h not found 
ERROR: configuration failed for package ‘ncdf’ 
* removing ‘/home/me/R/x86_64-pc-linux-gnu-library/3.0/ncdf’ 
Warning in install.packages : 
    installation of package ‘ncdf’ had non-zero exit status 

ho scaricato anche il pacchetto sorgente e provato ad installare nel shell, ma ha ottenuto lo stesso risultato.

wget http://cran.r-project.org/src/contrib/ncdf_1.6.6.tar.gz 
R CMD INSTALL ncdf_1.6.6.tar.gz 

Ovviamente, il programma di installazione non trova il file di intestazione corretto. Così ho cercato il file manualmente e l'ho trovato:

[email protected]:/usr/include# ls -ahl netcdf.h 
-rw-r--r-- 1 root root 30K 2009-12-22 04:47 netcdf.h 

Pacchetti netcdf-bin, netcdf-dbg, netcdf-doc, libnetcdf-dev e libnetcdf4 sono installati tutti correttamente. apt-get è aggiornato. Questo è il mio informazioni di sessione:

R version 3.0.1 (2013-05-16) 
Platform: x86_64-pc-linux-gnu (64-bit) 

locale: 
[1] C 

attached base packages: 
[1] stats  graphics grDevices utils  datasets methods base  

loaded via a namespace (and not attached): 
[1] tools_3.0.1 

Come posso convincere il programma di installazione R per utilizzare il file di intestazione si trova sotto /usr/include?

risposta

7

È necessario esaminare lo script configure.in per vedere esattamente cosa prova. Forse si aspetta netcdf.h in una sottodirectory piuttosto che direttamente in /usr/include.

Penso di averlo costruito in passato. Potrei dare un'altra occhiata in seguito.

+7

Grazie mille! C'è un file 'configure.ac' nel pacchetto ncdf. Non sono quello di {linux, C,/bin/make/sense} -ninja ma ho trovato l'argomento '--with-netcdf-include' in esso. Quindi 'install.packages (" ncdf ", type =" source ", configure.args =" - with-netcdf-include =/usr/include ")" ha reso tutto funzionante. – Beasterfield

+0

Sì, 'configure --help' dovrebbe sempre essere il tuo primo passo e te lo avrebbe detto. Strano, però, che non guardano lì per impostazione predefinita. –

1

Senza scaricare l'origine, è sufficiente impostare alcune variabili di ambiente. Per me, questo è stato

export NETCDF_INCLUDE=/usr/include 

Dopo aver fatto questo, install.packages("ncdf") lavorato.

Questo è descritto nel file INSTALL.

+0

La lettura di 5 minuti a volte può farti risparmiare 5 ore di tentativi. Grazie. – Beasterfield

+0

Questo one-liner batch potrebbe farti risparmiare qualche secondo in più: 'NETCDF_INCLUDE =/usr/include Rscript -e 'install.packages (" ncdf ")'' – Jealie

Problemi correlati