Hi John, You should only need gfortran. llvm-gcc "should" work. If you don't have Apple's gcc, then you want the "other" gfortran from the developer website:
http://r.research.att.com/gfortran-4.2.3.dmg The link seems to be down (at least I cannot access it, check with Simon Urbanek). That gfortran is fully independent. You may be able to find the binary from other repositories (including Python and Julia repos). I think this particular binary is used by a lot of folks across these languages. I would not expect that installing gfortran would have any impact on the rest of your development. I have not seen any issues due to any library from the developer website. Simon is an excellent steward and I tend to blindly trust his judgment. Best, Anirban On Thu, Jun 27, 2013 at 6:31 PM, John Swan <johns...@spamcop.net> wrote: > Hi Anirban, > > Thank you for your help. I believe you're right, I was coming to the same > conclusion myself. > > One thing however, I have Mountain Lion with Xcode 4.6 installed for iOS > development. As far as I understand it, gcc 4.2 is not included with that > version of Xcode. > > Don't I have to install > gcc-42-5666.3-darwin11.pkg<http://r.research.att.com/tools/gcc-42-5666.3-darwin11.pkg> > to > get gcc 4.2 and gfortran? http://r.research.att.com/tools/ states that > gfortran-lion-5666-3.pkg<http://r.research.att.com/gfortran-lion-5666-3.pkg> > is > for those who already have gcc 4.2 installed, but you seem to have it > working ? > > Additionally, can you tell me if installing these packages has any adverse > effect on your Xcode development environment (llvm-clang, iOS development > etc)? > > Best regards > John > > On 27 Jun 2013, at 04:20, Anirban Mukherjee <anirban.mukher...@gmail.com> > wrote: > > inline + RcppArmadillo work on Mac. I tested the code in a Mac (Mountain > Lion 10.8.4) before posting. Install gfortran from: > http://r.research.att.com/gfortran-lion-5666-3.pkg. You can look here for > more information: http://r.research.att.com/tools/. If that does not > work, post in R-SIG-Mac. > > > On Wed, Jun 26, 2013 at 7:04 PM, Anirban Mukherjee < > anirban.mukher...@gmail.com> wrote: > >> library(inline); library(RcppArmadillo) >> >> rowSumsRA <- cxxfunction(signature(x = "numeric"), >> plugin="RcppArmadillo", body='return Rcpp::wrap(arma::sum(as<arma::mat> >> (x),0));') >> >> colSumsRA <- cxxfunction(signature(x = "numeric"), >> plugin="RcppArmadillo", body='return Rcpp::wrap(arma::sum(as<arma::mat> >> (x),1));') >> >> Anirban >> >>> Date: Wed, 26 Jun 2013 11:11:04 +0200 >>> From: John Swan <johns...@spamcop.net> >>> To: rcpp-devel@lists.r-forge.r-project.org >>> Subject: [Rcpp-devel] Seamless Rcpp gives errors with RcppArmadillo >>> Message-ID: <99384497-d7c4-4bc6-859e-c3fa1ab5f...@spamcop.net> >>> Content-Type: text/plain; charset="windows-1252" >>> >>> Hi, >>> >>> I just purchased Dirk's book on Seamless Rcpp and I'm finding it very >>> useful. >>> >>> However, I'm having a strange error running RcppArmadillo inline, where >>> the book examples seem to manage it effortlessly. >>> I've been stuck on this for hours. Any help is most appreciated. >>> >>> I am using R 3.0 on Mac OS X Mountain Lion 10.8.4, sessionInfo output: >>> > sessionInfo() >>> R version 3.0.1 (2013-05-16) >>> Platform: x86_64-apple-darwin10.8.0 (64-bit) >>> >>> locale: >>> [1] en_GB.UTF-8/C/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 >>> >>> attached base packages: >>> [1] stats graphics grDevices utils datasets methods base >>> >>> other attached packages: >>> [1] inline_0.3.12 RcppArmadillo_0.3.900.0 Rcpp_0.10.3 >>> BDgraph_2.6 huge_1.2.4 MASS_7.3-26 >>> igraph_0.6.5-2 >>> [8] Matrix_1.0-12 lattice_0.20-15 >>> >>> loaded via a namespace (and not attached): >>> [1] grid_3.0.1 tools_3.0.1 >>> >>> >>> I have the following in a source file (somefile.R): >>> library(Rcpp) >>> library(inline) >>> library(RcppArmadillo) >>> >>> rowSumsRcppArmadilloFunction <- ' >>> arma::rowvec rowSumsRcppArmadillo(NumericMatrix x){ >>> arma::mat X = arma::mat(x.begin(), x.nrow(), x.ncol(), false); >>> return arma::sum(X, 1); >>> }' >>> >>> rowSumsRcppArmadillo <- cxxfunction(signature(), >>> plugin="Rcpp", >>> incl=rowSumsRcppArmadilloFunction, >>> body=' >>> return Rcpp::wrap(rowSumsRcppArmadillo()); >>> ') >>> >>> >>> If I try to execute this in R console with the source command, I get: >>> >>> > source("/Users/me/Desktop/R/somefile.R") >>> file29967eb06d23.cpp:20: error: ?arma? has not been declared >>> file29967eb06d23.cpp:20: error: expected constructor, destructor, or >>> type conversion before ?rowSumsRcppArmadillo? >>> file29967eb06d23.cpp: In function ?SEXPREC* file29967eb06d23()?: >>> file29967eb06d23.cpp:35: error: ?rowSumsRcppArmadillo? was not declared >>> in this scope >>> make: *** [file29967eb06d23.o] Error 1 >>> >>> ERROR(s) during compilation: source code errors or compiler >>> configuration errors! >>> >>> Program source: >>> 1: >>> 2: // includes from the plugin >>> 3: >>> 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: arma::rowvec rowSumsRcppArmadillo(NumericMatrix x){ >>> 21: arma::mat X = arma::mat(x.begin(), x.nrow(), x.ncol(), false); >>> 22: return arma::sum(X, 1); >>> 23: } >>> 24: >>> 25: // declarations >>> 26: extern "C" { >>> 27: SEXP file29967eb06d23( ) ; >>> 28: } >>> 29: >>> 30: // definition >>> 31: >>> 32: SEXP file29967eb06d23( ){ >>> 33: BEGIN_RCPP >>> 34: >>> 35: return Rcpp::wrap(rowSumsRcppArmadillo()); >>> 36: >>> 37: END_RCPP >>> 38: } >>> 39: >>> 40: >>> Error in compileCode(f, code, language = language, verbose = verbose) : >>> Compilation ERROR, function(s)/method(s) not created! >>> file29967eb06d23.cpp:20: error: ?arma? has not been declared >>> file29967eb06d23.cpp:20: error: expected constructor, destructor, or >>> type conversion before ?rowSumsRcppArmadillo? >>> file29967eb06d23.cpp: In function ?SEXPREC* file29967eb06d23()?: >>> file29967eb06d23.cpp:35: error: ?rowSumsRcppArmadillo? was not declared >>> in this scope >>> make: *** [file29967eb06d23.o] Error 1 >>> In addition: Warning message: >>> running command '/Library/Frameworks/R.framework/Resources/bin/R CMD >>> SHLIB file29967eb06d23.cpp 2> file29967eb06d23.cpp.err.txt' had status 1 >>> >>> I added these: >>> 20: #include <RcppArmadillo.h> >>> 21: // [[Rcpp::depends(RcppArmadillo)]] >>> 22: >>> 23: // [[Rcpp::export]] >>> 24: >>> 25: arma::rowvec rowSumsRcppArmadillo(NumericMatrix x){ >>> 26: arma::mat X = arma::mat(x.begin(), x.nrow(), x.ncol(), false); >>> 27: return arma::sum(X, 1); >>> 28: } >>> >>> But then I just get this error: >>> Error in compileCode(f, code, language = language, verbose = verbose) : >>> Compilation ERROR, function(s)/method(s) not created! >>> file77e03dcff275.cpp:20:27: error: RcppArmadillo.h: No such file or >>> directory >>> file77e03dcff275.cpp:25: error: ?arma? has not been declared >>> file77e03dcff275.cpp:25: error: expected constructor, destructor, or >>> type conversion before ?rowSumsRcppArmadillo? >>> file77e03dcff275.cpp: In function ?SEXPREC* file77e03dcff275()?: >>> file77e03dcff275.cpp:40: error: ?rowSumsRcppArmadillo? was not declared >>> in this scope >>> make: *** [file77e03dcff275.o] Error 1 >>> In addition: Warning message: >>> running command '/Library/Frameworks/R.framework/Resources/bin/R CMD >>> SHLIB file77e03dcff275.cpp 2> file77e03dcff275.cpp.err.txt' had status 1 >>> >>> >>> >>> So, I thought I'd try compilng it as a package, but when I try to call >>> the package in R, I get errors like: >>> Error in sourceCpp("./R/somefile.R") : >>> 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). >>> >>> 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 >>> collect2: ld returned 1 exit status >>> make: *** [sourceCpp_13326.so] Error 1 >>> >>> >>> The XCode command line tools *are* installed - I'm an iOS developer so I >>> always make sure that they are there: >>> >>> John-MBPR:BDGraphSource johnswan$ which llvm-g++ >>> /usr/bin/llvm-g++ >>> John-MBPR:BDGraphSource johnswan$ llvm-g++ --version >>> i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build >>> 5658) (LLVM build 2336.11.00) >>> Copyright (C) 2007 Free Software Foundation, Inc. >>> This is free software; see the source for copying conditions. There is >>> NO >>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR >>> PURPOSE. >>> >>> >>> Can anyone help? >>> >>> Thanks >>> John >>> -------------- next part -------------- >>> An HTML attachment was scrubbed... >>> URL: < >>> http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130626/f34959cc/attachment-0001.html >>> > >>> >>> ------------------------------ >>> >> > _______________________________________________ > Rcpp-devel mailing list > Rcpp-devel@lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel > > >
_______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel