Skip to content

Instantly share code, notes, and snippets.

@remlapmot
Last active December 8, 2023 19:22
Show Gist options
  • Save remlapmot/245edd63f250683ef56d3f0e09dee7a9 to your computer and use it in GitHub Desktop.
Save remlapmot/245edd63f250683ef56d3f0e09dee7a9 to your computer and use it in GitHub Desktop.
~/.R/Makevars file - to make homebrew libraries available whilst compiling source packages on Apple Silicon computers
FC=/usr/local/bin/gfortran
F77=/usr/local/bin/gfortran
FLIBS=-L/usr/local/gfortran/lib
CFLAGS=-I/opt/homebrew/include
CPPFLAGS=-I/opt/homebrew/include
CXXFLAGS=-I/opt/homebrew/include
CXX11FLAGS=-I/opt/homebrew/include
LDFLAGS=-L/opt/homebrew/lib
#LDFLAGS="-L/opt/homebrew/opt/libomp/lib"
#CPPFLAGS="-I/opt/homebrew/opt/libomp/include"
CPPFLAGS+=-Xclang -fopenmp
LDFLAGS+=-lomp
@remlapmot
Copy link
Author

remlapmot commented Nov 17, 2022

On my M1 Mac Mini

CFLAGS=-I/opt/homebrew/include
CPPFLAGS=-I/opt/homebrew/include
CXXFLAGS=-I/opt/homebrew/include

LDFLAGS+="-L/opt/homebrew/opt/libomp/lib"
CPPFLAGS+="-I/opt/homebrew/opt/libomp/include"

# R native
#FLIBS=-L/opt/R/arm64/gfortran/lib
#F77=/opt/R/arm64/gfortran/bin/gfortran
#FC=/opt/R/arm64/gfortran/bin/gfortran

# homebrew alternative
FLIBS=-L/opt/homebrew/opt/gfortran/lib
F77=/opt/homebrew/bin/gfortran
FC=/opt/homebrew/bin/gfortran

#CC=clang
#CXX=clang++

@remlapmot
Copy link
Author

M2 MacBook Air

FLIBS=-L/opt/homebrew/opt/gfortran/lib
F77=/opt/homebrew/bin/gfortran
FC=/opt/homebrew/bin/gfortran

CFLAGS=-I/opt/homebrew/include
CPPFLAGS=-I/opt/homebrew/include
CXXFLAGS=-I/opt/homebrew/include
CXX11FLAGS=-I/opt/homebrew/include
LDFLAGS=-L/opt/homebrew/lib

LDFLAGS+="-L/opt/homebrew/opt/libomp/lib"
CPPFLAGS+="-I/opt/homebrew/opt/libomp/include"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment