我无法安装多个R软件包,因为它们总是在第一个include语句中失败。这是我为Rcpp得到的错误:
install.packages("/Users/nacho/Downloads/Rcpp_0.10.3.tar.gz", repos=NULL, type="source")
Installing package(s) into ‘/Users/nacho/Library/R/2.15/library’
(as ‘lib’ is unspecified)
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** libs
c++ -I/usr/local/Cellar/r/2.15.2/R.framework/Resources/include -DNDEBUG -fopenmp -I/usr/local/include -fopenmp -fPIC -g -O2 -c Date.cpp -o Date.o
clang: warning: argument unused during compilation: '-fopenmp'
clang: warning: argument unused during compilation: '-fopenmp'
Date.cpp:29:10: fatal error: 'Rcpp/Datetime.h' file not found
#include <Rcpp/Datetime.h>
^
1 error generated.
make: *** [Date.o] Error 1
ERROR: compilation failed for package ‘Rcpp’
* removing ‘/Users/nacho/Library/R/2.15/library/Rcpp’
Warning message:
In install.packages("/Users/nacho/Downloads/Rcpp_0.10.3.tar.gz", :
installation of package ‘/Users/nacho/Downloads/Rcpp_0.10.3.tar.gz’ had non-zero exit status
我对RJSONIO
有同样的错误install.packages("/Users/nacho/Downloads/RJSONIO_1.0-3.tar.gz", repos=NULL, type="source")
Installing package(s) into ‘/Users/nacho/Library/R/2.15/library’
(as ‘lib’ is unspecified)
* installing *source* package ‘RJSONIO’ ...
** package ‘RJSONIO’ successfully unpacked and MD5 sums checked
Trying to find libjson.h header file
checking for gcc... gcc
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 accepts -g... yes
checking for gcc option to accept ISO C89... none needed
USE_LOCAL = ""
Minor Version: 6
Using local libjson code. Copying files from src/libjson/Source
/private/var/folders/tl/_8_djcq15pl01ht8z6hy9tww0000gn/T/RtmpMKCuPF/R.INSTALL116ed562675dc/RJSONIO
JSONAllocator.cpp
JSONChildren.cpp
JSONDebug.cpp
JSONIterators.cpp
JSONMemory.cpp
JSONNode.cpp
JSONNode_Mutex.cpp
JSONPreparse.cpp
JSONStream.cpp
JSONValidator.cpp
JSONWorker.cpp
JSONWriter.cpp
internalJSONNode.cpp
libjson.cpp
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating cleanup
** libs
cc -I/usr/local/Cellar/r/2.15.2/R.framework/Resources/include -DNDEBUG -fopenmp -I/usr/local/include -fopenmp -fPIC -g -O2 -c ConvertUTF.c -o ConvertUTF.o
clang: warning: argument unused during compilation: '-fopenmp'
clang: warning: argument unused during compilation: '-fopenmp'
c++ -I/usr/local/Cellar/r/2.15.2/R.framework/Resources/include -DNDEBUG -fopenmp -I/usr/local/include -fopenmp -fPIC -g -O2 -c JSONAllocator.cpp -o JSONAllocator.o
clang: warning: argument unused during compilation: '-fopenmp'
clang: warning: argument unused during compilation: '-fopenmp'
JSONAllocator.cpp:1:10: fatal error: 'JSONAllocator.h' file not found
#include "JSONAllocator.h"
^
1 error generated.
make: *** [JSONAllocator.o] Error 1
ERROR: compilation failed for package ‘RJSONIO’
* removing ‘/Users/nacho/Library/R/2.15/library/RJSONIO’
Warning message:
In install.packages("/Users/nacho/Downloads/RJSONIO_1.0-3.tar.gz", :
installation of package ‘/Users/nacho/Downloads/RJSONIO_1.0-3.tar.gz’ had non-zero exit status
我的sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-apple-darwin11.4.2 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] graphics grDevices utils datasets stats grid methods base
other attached packages:
[1] clickme_0.0.3 ggplot2_0.9.3.1 testthat_0.7.1 devtools_1.1
loaded via a namespace (and not attached):
[1] colorspace_1.2-1 dichromat_2.0-0 digest_0.6.3 evaluate_0.4.3 formatR_0.7 gtable_0.1.2
[7] httr_0.2 knitr_1.1 labeling_0.1 MASS_7.3-23 memoise_0.1 munsell_0.4
[13] parallel_2.15.2 plyr_1.8 proto_0.3-10 RColorBrewer_1.0-5 RCurl_1.95-4.1 reshape2_1.2.2
[19] scales_0.2.3 stringr_0.6.2 tools_2.15.2 whisker_0.1 yaml_2.1.7
答案 0 :(得分:2)
尝试
时会发生什么 R CMD INSTALL Rcpp_0.10.3.tar.gz
代替?从您显示的日志中显示:
c++ -I/usr/local/Cellar/r/2.15.2/R.framework/Resources/include -DNDEBUG \
-fopenmp -I/usr/local/include -fopenmp -fPIC -g -O2 -c Date.cpp -o Date.o
很明显你错过了什么。在我的Linux机器上(你可以忽略它
事实上,我使用当前的SVN版本)
edd@max:~/svn/rcpp/pkg$ R CMD INSTALL Rcpp_0.10.3.1.tar.gz
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘Rcpp’ ...
** libs
ccache g++-4.7 -I/usr/share/R/include -DNDEBUG -I../inst/include/ \
-fpic -g0 -O3 -Wall -pipe -Wno-variadic-macros -pedantic -c Date.cpp -o Date.o
注意-I../inst/include
在这里?也许你覆盖了CXXFLAGS
或其他东西......