我有一个R软件包,我试图在MAC OS(yosemite)上安装,我收到链接器问题。这是我得到的错误
clang++ -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 File1.so File2.o File3.o File4.o RcppExports.o Utils.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
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 -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mypackage.so] Error 1
ERROR: compilation failed for package ‘mypackage’
我的Makevars
文件包含:
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
在DESCRIPTION
中,我有:
Depends:
R (>= 3.2.0),
Rcpp,
RcppArmadillo
LinkingTo: Rcpp, RcppArmadillo
在R/help.R
,我有:
#' @importFrom Rcpp evalCpp
#' @import RcppArmadillo
#' @useDynLib mypackage
NULL
这与此question不同,因为我已将Armadillo依赖项包含在其他.cpp
文件所隐藏的头文件中:
#include <iostream>
#include <algorithm>
#include <cmath>
#include <Rmath.h>
#include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]
我错过了什么吗?是否应该修改makefile?
答案 0 :(得分:7)
修正:
轻松修复
从Terminal
/Applications/Utilities/
在Terminal
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 /
耗时更多:
使用homebrew
或macports
抓取包含gcc
的{{1}}。更改gfortran
。 (有关使用~/.R/Makevars
的gfortran安装的更多详细信息,请参阅openmp帖子。)
请参阅: