Search code examples
rstudiogfortranapple-m1rscript

Rstudio gfortran flag -m64 doesn't work, but it does work on the than command line


I am trying to run https://github.com/LAPKB/Pmetrics on an M1 chip mac. One of the functions makes use of gfortran. When I run this function in Rstudio, I get the error

gfortran: error: unrecognized command-line option '-m64'

When I run the function from the command line with Rscript it runs correctly.

How can I get Rstudio to work with gfortran option -m64?


Solution

  • -m64 is an option valid for the i386/x86_64 architecture. See the manual.

    It is not valid for other architectures, like the M1 CPU. You have to adjust the build scripts for the new architecture. Try just removing the option. More similar problems may appear.

    The lists of machine-dependent options is available at https://gcc.gnu.org/onlinedocs/gcc/Submodel-Options.html#Submodel-Options I believe you need the ARM options for your M1, but please do check.