0

I bought an M1 Silicon with Monterey back in January and --- after a three+ month pause -- am trying again to get Rcpp running so I can install RStan. Following these instructions in response to (I'd like to just comment on this other issue, but being new to posting on Stack Overflow it tells me that I cannot and what I am about to post is certainly NOT an answer):

Configuring compilers on Mac M1 (Big Sur, Monterey) for Rcpp and other tools

While step 3 (installing gfortran) looks to go well, when I ask about gfortran things seem less hopeful:

-bash: gfortran: command not found

Or maybe this is not how to ask if all went well with the installation?

No matter, I charge on to step 4 installing from openmp-13.0.0-darwin21-Release.tar.gz based on:

Apple clang version 13.1.6 (clang-1316.0.21.2.3)
Target: arm64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

I confirm that I have the files where expected, then create the .R directory and the Makevars file (in nano) then try to run the R and get ....

+ #endif
+ }
+ ')
/Users/lizzie/.R/Makevars:6: *** missing separator.  Stop.

Error in Rcpp::sourceCpp(code = "\n#include <RcppArmadillo.h>\n#ifdef _OPENMP\n# include <omp.h>\n#endif\n\n// [[Rcpp::depends(RcppArmadillo)]]\n// [[Rcpp::export]]\nvoid omp_test()\n{\n#ifdef _OPENMP\n    Rprintf(\"OpenMP threads available: %d\\n\", omp_get_max_threads());\n#else\n    Rprintf(\"OpenMP not supported\\n\");\n#endif\n}\n") : 
  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).

Any thoughts or ideas much appreciated. Again, I am new to posting to StackOverflow so apologize as I am sure I am doing this wrong.

  • 1
    Step 3 very clearly asks you to install `gfortran`. You have a typo. – Roland Apr 28 '22 at 06:40
  • I suggest to remove the `rcpp` tag as this has nothing to do with package `Rcpp` which works if your R setup is correct. This is purely an M1 issue. Maybe the r-sig-mac list may help? – Dirk Eddelbuettel Apr 28 '22 at 14:07
  • Thanks for catching the typo in the main text (not title) ... I fixed it; and the error remains. – user18967339 Apr 28 '22 at 17:04
  • The error message suggests that you don't have Command Line Tools for Xcode installed. Is it possible that you have not completed Step 2 correctly? – Mikael Jagan May 31 '22 at 01:04
  • BTW: Running `gfortran` at your Bash prompt will not work until you add `gfortran` to your `PATH`. My instructions don't require modifications to your `PATH`, so it isn't _too_ surprising that Bash has indicated "command not found". You can check that the installation succeeded by running `/opt/R/arm64/gfortran/bin/gfortran --version`, supplying the full path to the compiler. – Mikael Jagan May 31 '22 at 02:12

0 Answers0