can_compile: Test if compilation is possible

Description Usage Arguments Details Value Examples

Description

Test if compilation appears possible. This tries compiling a trivial C program with R CMD SHLIB (using shlib). Results are cached between runs within a session so this should be fast to rely on.

Usage

1
can_compile(verbose = FALSE, skip_cache = FALSE)

Arguments

verbose

Be verbose when running commands?

skip_cache

Try again to compile, skipping the cached value?

Details

If this function believes you can't compile, and if gcc can't be found on the path, a diagnostc message will be printed. This will of course not be very interesting if you use a different compiler to gcc! But the most likely people affected here are Windows users; if you get this ensure that you have rtools installed. If you have devtools installed, devtools::find_rtools() may be helpful for diagnosing compiler issues.

Value

A logical scalar

Examples

1
2
can_compile() # will take ~0.1s the first time
can_compile() # should be basically instantaneous

richfitz/rcmdshlib documentation built on May 27, 2019, 8:25 a.m.