Skip to content

Installation fails on macOS 13.2.1 with missing gfortran #4

@pieterprovoost

Description

@pieterprovoost

Installation fails on macOS 13.2.1 with the following error due to an incorrect gfortran path:

> devtools::install_github("EMODnet/Btrait", depend=TRUE, build_vignettes=TRUE)
Downloading GitHub repo EMODnet/Btrait@HEAD

── R CMD build ────────────────────────────────────────────────────────────────────────────────────────
✔  checking for file ‘/private/var/folders/gb/7ff56y1n0k5dg23rzcfylh7r0000gn/T/RtmpUTC7dC/remotes14cc1698aef6a/EMODnet-Btrait-a15f10e/DESCRIPTION’ ...
─  preparing ‘Btrait’:
✔  checking DESCRIPTION meta-information ...
─  cleaning src
─  installing the package to build vignettes
         -----------------------------------
─  installing *source* package ‘Btrait’ ...
   ** using staged installation
   ** libs
   clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -Wall -pedantic -fdiagnostics-color=always -c BtraitMethods.c -o BtraitMethods.o
   /opt/R/arm64/bin/gfortran -mtune=native -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c  extendTrait.f95 -o extendTrait.o
   make: /opt/R/arm64/bin/gfortran: No such file or directory
   make: *** [extendTrait.o] Error 1
   ERROR: compilation failed for package ‘Btrait’
─  removing ‘/private/var/folders/gb/7ff56y1n0k5dg23rzcfylh7r0000gn/T/RtmpDIUEoC/Rinst1550130eec8f1/Btrait’
         -----------------------------------
   ERROR: package installation failed
Error: Failed to install 'Btrait' from GitHub:
  ! System command 'R' failed

The solution for my system, which has gfortran as part of the homebrew gcc installation (brew install gcc), was to create a file ~/.R/Makevars with the following content:

FC = /opt/homebrew/Cellar/gcc/12.2.0/bin/gfortran
F77 = /opt/homebrew/Cellar/gcc/12.2.0/bin/gfortran
FLIBS = -L/opt/homebrew/Cellar/gcc/12.2.0/lib/gcc/12

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions