使用RcppArmadillo和R 3.1.3以及Mac Yosemite编译错误
Compile error with RcppArmadillo and R 3.1.3 and Mac Yosemite
我最近安装了R 3.1.3。我使用的是Yosemite系统的Mac,我的Xcode是6.2版本。
在我使用sourceCpp("try.CPP")获取CPP文件的源代码后,我得到以下错误。我的try.cpp文件有
#include <RcppArmadillo.h>
#include <math.h>
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).
我已经安装了Xcode的命令行工具,我的gfortran版本是4.9.0但是当我输入时
gfortran --version
它有以下错误:
gfortran: warning: couldn’t understand kern.osversion ‘14.1.0
当我使用R 3.1.2时,我以前没有遇到过这个问题!
感谢您的帮助!
经过一番查找,我在网上找到了一个解决方案。
如果你对我有同样的问题,只需键入
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 /
在终端上,源Cpp可以顺利运行。
有关详细说明,请访问[http://www.thecoatlessprofessor.com/programming/rcpp-rcpparmadillo-and-os-x-mavericks-lgfortran-and-lquadmath-error]
相关文章:
- 在没有Xcode的情况下在Mac捆绑包中嵌入框架
- c++17文件系统::recursive_directory迭代器()在mac上没有给出这样的目录,但在windows上
- 如何使用CLion在Mac上创建一个新的.txt文件
- 如何使用Clang/GCC在Mac上为C/C++设置VSCode
- 在 Mac 上使用 CMAKE 将 FFTW 和 FFTWPP 链接到项目中时未定义的符号
- 有人安装"IITB Simplecpp in mac"吗?
- libprotobuf 检查在 Mac OS 上执行程序时失败
- 如何在 Mac 上使用 c++17 并行标准库算法?
- 在 Mac 上的 python 上提升
- 我可以在 iOS 或 mac 应用程序中使用C++代码吗?
- 如何在 Mac 上正确编译C++,当它在 Linux 上编译没有问题时?
- C++读取用户输入而不按回车键(Mac OS X),与Turbo Pascal中的读取键相同
- Mac Os Yosemite上的FTDI芯片ID
- 使用RcppArmadillo和R 3.1.3以及Mac Yosemite编译错误
- Qt错误:在Mac OS X Yosemite上找不到体系结构x86_64的符号
- QFileDialog::getOpenFileName 在 MAC 10.10.5 Yosemite 上不起作用
- SDL 无法在 2.1 Mac OSX Yosemite 上加载 OpenGL 上下文
- 尝试调试c++程序在Eclipse Mars上的MAC Pro视网膜与OS X Yosemite版本10.10.5
- 在Mac OSX Yosemite上,编译器无法识别父类成员变量(Apple LLVM 7.0)
- Mac OS X 10.10 yosemite 上的 Dionysus Build/make 出现问题