xcode – RcppArmadillo在OS X Mavericks上编译错误

xcode – RcppArmadillo在OS X Mavericks上编译错误,第1张

概述这是 Element-Wise Matrix Multiplication in Rcpp问题的后续行动 自升级到小牛队以来,我一直在使用RcppArmadillo获得许多不同类型的错误.我安装了Xcode 5.0.2和命令行工具.另外,来自Homebrew的gfortran.但我一直遇到以下错误 – > cppFunction("arma::mat schur(arma::mat& a, arm 这是 Element-Wise Matrix Multiplication in Rcpp问题的后续行动

自升级到小牛队以来,我一直在使用RcppArmadillo获得许多不同类型的错误.我安装了Xcode 5.0.2和命令行工具.另外,来自Homebrew的gfortran.但我一直遇到以下错误 –

> cppFunction("arma::mat schur(arma::mat& a,arma::mat& b)                        { return(a % b); }",depends="RcppArmadillo")ld: library not found for -lgfortranclang: error: linker command Failed with exit code 1 (use -v to see invocation)make: *** [sourceCpp_18474.so] Error 1clang++  -I/library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include  -    I"/library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/include" -I"/library/Frameworks/R.framework/Versions/3.0/Resources/library/RcppArmadillo/include"    -fPIC  "-mtune=native -g -O2 -Wall -pedantic -Wconversion" -c fileaf992bfb8f84.cpp -o fileaf992bfb8f84.o clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -L/usr/local/lib -o sourceCpp_18474.so fileaf992bfb8f84.o -L/library/Frameworks/R.framework/Resources/lib -lRlapack -L/library/Frameworks/R.framework/Resources/lib -lRblas -lgfortran /library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/lib/libRcpp.a -F/library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation Error in sourceCpp(code = code,env = env,rebuild = rebuild,showOutput = showOutput,: 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).# Contents of Makevars$cat ~/.R/Makevars CC=clangCXX=clang++ CXXFLAGS="-mtune=native -g -O2 -Wall -pedantic -Wconversion"FliBS=-lgfortran

评论FliBS = -lgfortran没有帮助,导致更多错误消息 –

> cppFunction("arma::mat schur(arma::mat& a,arma::mat& b) { return(a % b); }",depends="RcppArmadillo")ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/x86_64'ld: warning: directory not found for option '-L/usr/local/lib/x86_64'ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3'ld: library not found for -lgfortranclang: error: linker command Failed with exit code 1 (use -v to see invocation)make: *** [sourceCpp_50381.so] Error 1

提前致谢.

更新

根据以下Kevin和Dirk的回复建议,我重新安装了Rcpp,RcppArmadillo并从源代码内联并更新了FliBS以指向实际目录.这解决了这个问题.

# Update FliBS in ~/.R/MakevarsFliBS=-L/usr/local/Cellar/gfortran/4.8.2/gfortran#Re-Install from sourceinstall.packages(c("Rcpp","RcppArmadillo","inline"),type="source")#Restart R
@R_404_6120@ 编辑:如果你是一个Homebrew用户,你现在需要使用brew install gcc(gfortran不再单独提供gcc),然后你可以按照 here的说明进行设置.

您必须手动将库符号链接到/usr/local / lib:

ln -s /usr/local/Cellar/gfortran/4.8.2/gfortran/lib/libgfortran.* /usr/local / lib /

我以为brew链接gfortran会处理这个,但显然它只是符号链接gfortran程序而不是实际的库.所以,不幸的是,你必须自己做.

(将4.8.2替换为您在自制软件中使用的任何版本的gfortran.)

或者,如果您想继续修改/usr/local / lib,则可以使用

FliBS=-L/usr/local/Cellar/gfortran/4.8.2/gfortran

在你的〜/ .R / Makevars文件中,所以R知道在哪里可以找到gfortran库.

总结

以上是内存溢出为你收集整理的xcode – RcppArmadillo在OS X Mavericks上编译错误全部内容,希望文章能够帮你解决xcode – RcppArmadillo在OS X Mavericks上编译错误所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1066860.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-26
下一篇2022-05-26

发表评论

登录后才能评论

评论列表(0条)

    保存