[R-pkg-devel] SHLIB_OPENMP_*FLAGS in Makefiles

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Mon Apr 15 17:50:47 CEST 2019


On 15 April 2019 at 11:21, Jarrett Phillips wrote:
| In checking my R package via devtools::check and devtools::check_built, I
| received the following NOTE which I am unsure how to fix. My package
| contains compiled code (via Rcpp). Within my .cpp file I have the following
| line:
| 
| #define ARMA_DONT_PRINT_OPENMP_WARNING
| 
| Is this the issue?

No.
 
| checking use of SHLIB_OPENMP_*FLAGS in Makefiles ... NOTE
|   src/Makevars: SHLIB_OPENMP_CXXFLAGS is included in PKG_CXXFLAGS but
| not in PKG_LIBS
|   src/Makevars: SHLIB_OPENMP_CFLAGS is included in PKG_LIBS but
| linking is by C++
|   src/Makevars.win: SHLIB_OPENMP_CXXFLAGS is included in PKG_CXXFLAGS
| but not in PKG_LIBS
|   src/Makevars.win: SHLIB_OPENMP_CFLAGS is included in PKG_LIBS but
| linking is by C++

R is now quite explicit about something is used to not complain about: a mix
of C and CXX flags used in the two listed files (as Maxime pointed out).

This is quite possibly due to the skeleton version of these files included in
older versions of RcppArmadillo.  We of course switched to a corrected one
once these warnings appeared, but we cannot fix the packages already out there.
"Better" versions are at

https://github.com/RcppCore/RcppArmadillo/blob/master/inst/skeleton/Makevars
https://github.com/RcppCore/RcppArmadillo/blob/master/inst/skeleton/Makevars.win

and in essence you just need these two updated lines:

PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) 
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)

and we also recommend including

CXX_STD = CXX11

as the files do.

Hope this helps, Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org



More information about the R-package-devel mailing list