[Rcpp-devel] Rcpp / g++ ignoring TMPDIR

Jeroen Ooms jeroen.ooms at stat.ucla.edu
Mon Dec 2 02:52:20 CET 2013


Hi all :)

I'm experiencing an issue with building Rcpp packages inside the OpenCPU
sandbox. I think this issue was introduced with the upgrade to Rcpp 0.10.6.
The problem is that g++ seems to ignore the TMPDIR environment variable,
and instead always tries to use the default /tmp. When /tmp is not
writable, this causes the compiling to fail.

I am personally using RAppArmor to enforce these security policies, but an
easier way to reproduce the problem is by temporarily disable write access
to /tmp. Something like this:

#force custom TMP directory, replace jeroen with your username
cd /tmp
sudo mkdir test
sudo chown jeroen test
sudo chgrp jeroen test
sudo chmod 755 /tmp
TMPDIR=/tmp/test bash -c R

#then in R do:
tempdir() #check
install.packages("RcppExamples") #or any other rcpp package

The process fails with 'Fatal error: creating temporary file for '-e'
failed -L/usr/lib/R/lib -lR'. When using AppArmor, the error is actually
more detailed and says that g++ tried to create a file /tmp/tmpfDbJ9KD.

How can I make g++ use the same TMPDIR as the R process?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20131201/86fdb8eb/attachment.html>


More information about the Rcpp-devel mailing list