1

I'm trying to install a package in R, and I get the following error:

clang: error: unsupported option '-fopenmp'

This, is after I got an error:

ld: warning: search path '/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0' not found
ld: warning: search path '/opt/gfortran/lib' not found
ld: library 'gfortran' not found

From my understanding this is an issue of the compiler. So I edited .R/Makevars to point towards the correct compiler (GCC). If I understand correctly, it should support OpenMP. This is currently my Makevars file:

# This file's location is ~/.R/Makevars
# Default variables (no omp)
# Also potentially CXX11 (for C++11 compiler)
# CXX11=/usr/bin/clang++

# I followed the instructions at http://hpc.sourceforge.net/ to install gcc 4.9
CC=/opt/homebrew/bin/gcc-14    
CXX=/opt/homebrew/bin/gcc-14
FC=/opt/homebrew/bin/gfortran
F77=/opt/homebrew/bin/gfortran

PKG_LIBS = -fopenmp -lgomp
PKG_CFLAGS= -O3 -Wall -pipe -pedantic -std=gnu99 -fopenmp
CFLAGS= -O3 -Wall -pipe -pedantic -std=gnu99 -fopenmp

SHLIB_OPENMP_CFLAGS=-Xpreprocessor -fopenmp
SHLIB_OPENMP_CXXFLAGS=-Xpreprocessor -fopenmp

I've seen some other questions about the topic, but they were either directly related to data.table package. Or they didn't solve the issue.

2

1 Answer 1

1

What worked for me is setting the compiler paths directly:

# This file's location is ~/.R/Makevars
# Default variables (no omp)

CC=/opt/homebrew/bin/gcc-14 
CXX=/opt/homebrew/bin/gcc-14 
FC=/opt/homebrew/bin/gfortran 
F77=/opt/homebrew/bin/gfortran 
FLIBS=-L/opt/homebrew/opt/gcc/lib/gcc/14  

Not sure if it has openMP support or not, but it allowed me to compile the package.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.