The package currently uses OpenMP for parallelization with the following configuration in src/Makevars:
CXX_STD = CXX14
PKG_CXXFLAGS += -O3 -march=native -pipe -fopenmp
PKG_LIBS += -fopenmp $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
This works fine on Linux but fails to compile on macOS with the following error:
clang++: error: unsupported option '-fopenmp'
This happens because Apple's default Clang compiler doesn't support OpenMP. Additionally, R CMD check gives warnings about GNU extensions.
Proposed Solution
Create platform-specific Makevars files and a configure script to automatically handle the differences between operating systems:
- Keep current settings for Linux in
src/Makevars
- Create
src/Makevars.win for Windows
- Create
src/Makevars.mac for macOS without OpenMP flags
- Add a
configure script that detects macOS and uses the appropriate Makevars file
- Add documentation for users who want OpenMP support on macOS
- Add a function to check if OpenMP is enabled at runtime
The package currently uses OpenMP for parallelization with the following configuration in
src/Makevars:This works fine on Linux but fails to compile on macOS with the following error:
This happens because Apple's default Clang compiler doesn't support OpenMP. Additionally, R CMD check gives warnings about GNU extensions.
Proposed Solution
Create platform-specific Makevars files and a configure script to automatically handle the differences between operating systems:
src/Makevarssrc/Makevars.winfor Windowssrc/Makevars.macfor macOS without OpenMP flagsconfigurescript that detects macOS and uses the appropriate Makevars file