This is a follow -up to the Rcpp Element-Wise Matrix Multiplication question .
I get a few different errors with RcppArmadillo since upgrading to Mavericks. I have Xcode 5.0.2 and command line tools installed. Also gfortran from Homebrew. But I continue to encounter the error below -
> cppFunction("arma::mat schur(arma::mat& a, arma::mat& b) { return(a % b); }", depends="RcppArmadillo") ld: library not found for -lgfortran clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [sourceCpp_18474.so] Error 1 clang++ -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).
Commenting out FLIBS=-lgfortran does not help and leads to even more error messages -
> 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 -lgfortran clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [sourceCpp_50381.so] Error 1
Thanks in advance.
Update
Following the recommendations from Kevin and Dirk below, I reinstalled Rcpp, RcppArmadillo and the inline source and updated FLIBS to point to the actual directory. This solved the problem.
# Update FLIBS in ~/.R/Makevars FLIBS=-L/usr/local/Cellar/gfortran/4.8.2/gfortran #Re-Install from source install.packages(c("Rcpp","RcppArmadillo","inline"),type="source") #Restart R
r xcode rcpp
xbsd
source share