I have an R package which I am trying to install on a MAC OS (yosemite), and I am getting a linker problem. This is the error that I am getting
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’
My Makevars
file contain:
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
In DESCRIPTION
, I have:
Depends:
R (>= 3.2.0),
Rcpp,
RcppArmadillo
LinkingTo: Rcpp, RcppArmadillo
and in R/help.R
, I have:
#' @importFrom Rcpp evalCpp
#' @import RcppArmadillo
#' @useDynLib mypackage
NULL
This is not the same issue as this question because I already included the Armadillo dependencies in the header file that is being indluced by the other .cpp
files:
#include <iostream>
#include <algorithm>
#include <cmath>
#include <Rmath.h>
#include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]
Am I missing something? Should the makefile be modified?