Skip to content

Commit

Permalink
Document issues with C++ code on macOS (#10)
Browse files Browse the repository at this point in the history
and how to use `check_rTRNG_linking()` in general to explicitly check.
  • Loading branch information
riccardoporreca committed Mar 3, 2020
1 parent d9e24dd commit ab1c511
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 1 deletion.
6 changes: 6 additions & 0 deletions R/rTRNG-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
#' \code{importFrom(rTRNG, TRNG.Version)} in the NAMESPACE file, and
#' setting relevant linker flags (via \code{\link[rTRNG]{LdFlags}}) and
#' C++11 compilation (\code{CXX_STD = CXX11}) in Makevars[.win].
#' \item
#' Note that C++ code using the TRNG library (sourced via
#' \code{Rcpp::sourceCpp} or part of an \R package) might fail on certain
#' systems due issues with building and linking against \pkg{rTRNG}. This
#' is typically the case for macOS, and can be in general checked using
#' \code{\link[rTRNG]{check_rTRNG_linking}}.
#' }
#' }
#' See the package vignettes (\code{browseVignettes("rTRNG")}) for an overview
Expand Down
11 changes: 10 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ x_serial <- rnorm_trng(1e5L)
identical(x_serial, x_parallel)
```


### Use TRNG from standalone C++

The TRNG C++ library is made available by **rTRNG** to standalone C++ code
Expand Down Expand Up @@ -199,3 +198,13 @@ Creating an R package with C++ code using the TRNG library and headers through
- Makevars: `PKG_LIBS += $(shell ${R_HOME}/bin/Rscript -e "rTRNG::LdFlags()")`
- Makevars.win: `PKG_LIBS += $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "rTRNG::LdFlags()")`

### Note about C++ code on macOS

C++ code using the TRNG library (sourced via `Rcpp::sourceCpp` or part of an R
package) might fail on certain systems due issues with building and linking
against **rTRNG**. This is typically the case for **macOS**, and can be in
general checked by running

```{r check-linking, eval=FALSE}
rTRNG::check_rTRNG_linking()
```
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,14 @@ through **rTRNG** is achieved by
"rTRNG::LdFlags()")`
- Makevars.win: `PKG_LIBS += $(shell
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "rTRNG::LdFlags()")`

### Note about C++ code on macOS

C++ code using the TRNG library (sourced via `Rcpp::sourceCpp` or part
of an R package) might fail on certain systems due issues with building
and linking against **rTRNG**. This is typically the case for **macOS**,
and can be in general checked by running

``` r
rTRNG::check_rTRNG_linking()
```
6 changes: 6 additions & 0 deletions man/rTRNG-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions vignettes/rTRNG.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,15 @@ Creating an R package with C++ code using the TRNG library and headers through
- setting the relevant linker flags in Makevars[.win] via `rTRNG::LdFlags()`
- Makevars: `PKG_LIBS += $(shell ${R_HOME}/bin/Rscript -e "rTRNG::LdFlags()")`
- Makevars.win: `PKG_LIBS += $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "rTRNG::LdFlags()")`


### Note about C++ code on macOS

C++ code using the TRNG library (sourced via `Rcpp::sourceCpp` or part of an R
package) might fail on certain systems due issues with building and linking
against **rTRNG**. This is typically the case for **macOS**, and can be in
general checked by running

```{r check-linking, eval=FALSE}
rTRNG::check_rTRNG_linking()
```

0 comments on commit ab1c511

Please sign in to comment.