[英]Compile error with RcppArmadillo and R 3.1.3 and Mac Yosemite
I have recently installed R 3.1.3. 我最近安装了R 3.1.3。 I am using a Mac with Yosemite system and my Xcode is of version 6.2.
我正在使用带有Yosemite系统的Mac,而我的Xcode是6.2版本。
After I source the CPP file using sourceCpp("try.cpp"), I get the following error. 在使用sourceCpp(“try.cpp”)获取CPP文件后,出现以下错误。 My try.cpp file has
我的try.cpp文件有
#include <RcppArmadillo.h>
#include <math.h>
The error is below in R R中的错误如下
ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
ld: library not found for -lquadmath
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sourceCpp_15736.so] Error 1
clang++ -arch x86_64 -ftemplate-depth-256 -I/Library/Frameworks/R.framework/Resources/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -mtune=core2 -O3 -c CAR.cpp -o CAR.o
clang++ -arch x86_64 -ftemplate-depth-256 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module - multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib - L/usr/local/lib -o sourceCpp_15736.so CAR.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
Error in sourceCpp("~/RA2015/Code/BYMCAR/CAR.cpp") :
Error 1 occurred building shared library.
WARNING: The tools required to build C++ code for R were not found.
Please install Command Line Tools for XCode (or equivalent).
I have installed the command line tools for Xcode, my gfortran version is 4.9.0 But when I type 我已经为Xcode安装了命令行工具,我的gfortran版本是4.9.0但是当我输入时
gfortran --version
It has the following error: 它有以下错误:
gfortran: warning: couldn’t understand kern.osversion ‘14.1.0
When I use R 3.1.2, I did not encounter this problem before! 当我使用R 3.1.2时,我之前没遇到过这个问题!
Any help is appreciated! 任何帮助表示赞赏!
After some finding I find a solution online. 经过一番发现,我在网上找到了解决方案
If you have same problem with me, just type 如果您遇到同样的问题,请输入
curl -O http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2
sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 -C /
on the terminal and sourceCpp can run smoothly. 在终端和sourceCpp上可以顺利运行。
A detailed explanation can be found at [ http://www.thecoatlessprofessor.com/programming/rcpp-rcpparmadillo-and-os-x-mavericks-lgfortran-and-lquadmath-error] 详细解释可以在[ http://www.thecoatlessprofessor.com/programming/rcpp-rcpparmadillo-and-os-x-mavericks-lgfortran-and-lquadmath-error]找到。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.