[Rd] R CMD Check should allow packages with C and C++ and OpenMP without generating a NOTE

Sebastian Martin Krantz @eb@@t|@n@kr@ntz @end|ng |rom gr@du@te|n@t|tute@ch
Tue Jun 7 20:44:39 CEST 2022


Dear Developers,

I have the following issue with my package collapse:
https://github.com/SebKrantz/collapse,
whose code base is 34.5% C code and 28.3% C++, and to which I now want to
add OpenMP multithreading and send it to CRAN. For this I have set up a
Makevars file with

PKG_CFLAGS = $(SHLIB_OPENMP_CFLAGS)
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS)

as linking is through C++ via Rcpp. The problem is that this generates a
NOTE on R CMD Check:

src/Makevars: SHLIB_OPENMP_CFLAGS is included in PKG_CFLAGS but not in
PKG_LIBS

If I alternatively put

PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(SHLIB_OPENMP_CFLAGS)

I get another NOTE stating that this is not portable. Finally putting

PKG_LIBS = $(SHLIB_OPENMP_CFLAGS)

gives a note (or warning) that linking is through C++. CRAN maintainers
have not engaged constructively with me on the issue, but I do believe this
is an issue requiring constructive engagement i.e. I believe R CMD Check
should be adjusted to allow for such a configuration, and possibly some
instructions should be added to the Writing R Extensions Manual. I have
also asked Dirk Eddelbuettel (
https://github.com/SebKrantz/collapse/issues/258) who agrees that this is
an upstream issue. I am happy for any proactive comments or suggestions.

Best regards,

Sebastian Krantz

	[[alternative HTML version deleted]]



More information about the R-devel mailing list