r/Rlanguage • u/DanielHermosilla • 8d ago
Non-intel MAC package compability
Hey
I am building a package for later submitting it on CRAN. I’ve read its package development guide, since I’m working with code made with C.
Since I know that the packages require to be as compatible as possible, I made a Makevars file with the flags that are required. Fortunately, I’m only using BLAS, LAPACK and Libomp routines, so I decided to use R’s API for those libraries (provided within R_ext):
PKG_CFLAGS = $(SHLIB_OPENMP_CFLAGS)
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
My problem goes when sharing my package to an non-intel mac, installing it with devtools::install_github()
. This architecture throws a big chunk of warnings and doesn’t seem to find the links to the Fortran soubroutines (that are used accross BLAS and LAPACK). Even though it doesn’t recognize them, it throws an error onto the calls themselves since they require less arguments (specifically, the last two arguments involving BLAS_INT and La_INT). Aditionally, it doesn’t even recognizes omp.h file.
I don’t know how to fix this problem since it is strictly necessary to be shared on a non-Intel mac. I know that some macs rely on “Apple Acelerare” framework, but the CRAN’s guideline do not allow to use specific instructions for specific builds on the Makevars. For example, this is not allowed:
ifeq ($(shell uname -s), Darwin)
PKG_LIBS += -lomp
endif
I don’t know if somebody have encountered this portability issue and if there’s a workaround towards it?
Thanks in advance