<div dir="ltr"><div>Hi all :)</div><div><br></div>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.<div>

<br></div><div>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:</div><div><br></div><div>
<div>
#force custom TMP directory, replace jeroen with your username</div><div>cd /tmp</div><div>sudo mkdir test</div><div>sudo chown jeroen test</div><div>sudo chgrp jeroen test</div><div>sudo chmod 755 /tmp</div><div>TMPDIR=/tmp/test bash -c R</div>

</div><div><br></div><div>#then in R do:</div><div>tempdir() #check </div><div>install.packages("RcppExamples") #or any other rcpp package</div><div><br></div><div>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/<span style="font-family:arial,sans-serif;font-size:12.727272033691406px">tmpfDbJ9KD. </span></div>

<div><span style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br></span></div><div><font face="arial, sans-serif">How can I make g++ use the same TMPDIR as the R process?</font></div></div>