Skip to content

RcppParallelLibs() example and CRAN #212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
evanbiederstedt opened this issue Feb 28, 2024 · 3 comments
Closed

RcppParallelLibs() example and CRAN #212

evanbiederstedt opened this issue Feb 28, 2024 · 3 comments

Comments

@evanbiederstedt
Copy link

Hi there

The example in the documentation for added RcppParallel to R packages is the following:

https://rcppcore.github.io/RcppParallel/#r_packages

src\Makevars

PKG_LIBS += $(shell ${R_HOME}/bin/Rscript -e "RcppParallel::RcppParallelLibs()")

src\Makevars.win

PKG_CXXFLAGS += -DRCPP_PARALLEL_USE_TBB=1

PKG_LIBS += $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" \
              -e "RcppParallel::RcppParallelLibs()")

Question: is this CRAN compatible? The CRAN checks have been cracking down on += and ${shell .. } recently. GNU shell functions are not accepted.

https://cran.r-project.org/doc/manuals/R-exts.html#Writing-portable-packages

If the above is not CRAN-acceptable, would it be possible to provide new best standards to the community?

According to the manual:

The use of ${shell ...} can be avoided by using backticks, e.g.

PKG_CPPFLAGS = gsl-config --cflags
which works in all versions of make known74 to be used with R.

Thoughts?

Thanks for the help

@eddelbuettel
Copy link
Member

eddelbuettel commented Feb 28, 2024

The standard way around this to add GNU make as a SystemRequirement which is what the package does:

SystemRequirements: GNU make, Intel TBB, Windows: cmd.exe and cscript.exe, Solaris: g++ is required

See WRE -- this is the standard 'out' when one needs or wants a real make binary. There are other ways around it: you can also programmatically create src/Makevars from a src/Makevars.in by relying on a shell script, or R script, or .... saved as file configure (which does not have to be produced by autoconf).

@evanbiederstedt
Copy link
Author

I understand now; apologies, I was confused. CRAN trauma, I suppose.

Thanks @eddelbuettel

@eddelbuettel
Copy link
Member

No worries. We've all been there (see my now expanded comment for alternatives).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants