JavaNewbie
JavaNewbie

Reputation: 251

R: check value of compile and load flags

R uses compile and load flags to compile C and C++ code, and I know that I can alter these flags using Makevars files in my ~/.R directory or inside a package. How can I query the value of one of these variables? From inside R, or also from the command line? For instance, I would like to know what the variable LDFLAGS evaluates to when I use the R function install.packages (ignoring the possible package-level Makevars). How do I do that?

I figured out that certain variables that can be used in a Makevars, such as R_HOME, can be queried by doing:

Sys.getenv("R_HOME")

So why is this method not working (returning an empty string) for flags such as LDFLAGS and CXX_STD ? Are they a different kind of variables than R_HOME ? Is there another method for these variables?

Thanks a lot, Alessandro

Upvotes: 0

Views: 434

Answers (1)

Dirk is no longer here
Dirk is no longer here

Reputation: 368439

Well, I mostly need this while writing code rather than during run-time so I just grep the file.

But in general you can query this at the command-line via R CMD CONFIG:

$ R CMD config LDFLAGS
-Wl,-Bsymbolic-functions -Wl,-z,relro
$ 

Upvotes: 1

Related Questions