[Rcpp-devel] Running RcppArmadillo on Mac OS X 10.7
Chris Jefferson
chris at bubblescope.net
Wed Jun 13 18:39:12 CEST 2012
I have been successfully using Rcpp for a while, and recently started
trying to use RcppArmadillo. I found it worked fine on linux, but on
Mac OS X 10.7, it fails.
Even the trivial example below fails, with the errors shown at the bottom.
library(inline)
f = cxxfunction(signature(x="numeric"), ";", ,plugin = "RcppArmadillo")
The udnerlying error seems to be that I do not have 'libgfortran'.
This is indeed true, as fortran is not provided in mac os x any more.
I can download and build armadillo examples independantly and they
work fine. They use the command line:
g++ -I /usr/local/include -O1 -o example1 example1.cpp
-larmadillo -framework Accelerate
I'm not sure how R / Rcpp / RcppArmadillo decide how to build, so I'm
not sure where I should be looking to (I assume) change -lgfortran for
-framework Accelerate ?
Full R log follows:
> f = cxxfunction(signature(x="numeric"), ";", ,plugin = "RcppArmadillo")
ld: library not found for -lgfortran
collect2: ld returned 1 exit status
make: *** [file486cee9a.so] Error 1
ERROR(s) during compilation: source code errors or compiler
configuration errors!
Program source:
1:
2: // includes from the plugin
3: #include <RcppArmadillo.h>
4: #include <Rcpp.h>
5:
6:
7: #ifndef BEGIN_RCPP
8: #define BEGIN_RCPP
9: #endif
10:
11: #ifndef END_RCPP
12: #define END_RCPP
13: #endif
14:
15: using namespace Rcpp;
16:
17:
18: // user includes
19:
20:
21: // declarations
22: extern "C" {
23: SEXP file486cee9a( SEXP x) ;
24: }
25:
26: // definition
27:
28: SEXP file486cee9a( SEXP x ){
29: BEGIN_RCPP
30: ;
31: END_RCPP
32: }
33:
34:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! ld: library
not found for -lgfortran
collect2: ld returned 1 exit status
make: *** [file486cee9a.so] Error 1
In addition: Warning message:
running command '/Library/Frameworks/R.framework/Resources/bin/R CMD
SHLIB file486cee9a.cpp 2> file486cee9a.cpp.err.txt' had status 1
More information about the Rcpp-devel
mailing list