[Rd] R CMD SHLIB on Mac OS X fails when the default tempdir() is used (PR#14168)

From: <osklyar_at_gmx.com>
Date: Sun, 27 Dec 2009 20:25:12 +0100 (CET)

This is prompted by trying to run the 'inline' package on Mac OS X Leopard =
with R 2.10.1. Mac uses completely crazy temp paths and R uses those as wel=
l. The inline package creates source files in the temp directory which it t=
hen compiles with R CMD SHLIB and attaches. The compilation fails with the =
error message below which seems to be caused by the complexity of the path =
(compiling the same file with R CMD SHLIB and a sane path is ok, see below)=
. What can look like an inline problem, in fact is not inline's as it fails=
 in exactly the same way when run from a command line (see below). It fails=
 on c, cpp, f files. For the inline package, I will get a workaround by set=
wd to the location of the code and then setwd back, but generally one shoul=
d be able to run R CMD SHLIB with any valid path, at least this one contain=
s only alphanumerics and + and -.

Best,
Oleg

Browse[2]> system("/Library/Frameworks/R.framework/Resources/bin/R CMD SHLI= B /var/folders/bU/bUB3Gk1uHBuDXq1G72Xc+++++TI/-Tmp-/RtmpGzn3kA/file60b7acd9= .cpp")
Error in sub(p0(base, "."), "", a) :=20
  invalid regular expression '/var/folders/bU/bUB3Gk1uHBuDXq1G72Xc+++++TI/-= Tmp-/RtmpGzn3kA/file60b7acd9.'
Calls: <Anonymous> -> .shlib_internal -> sub In addition: Warning message:
In sub(p0(base, "."), "", a) :
  regcomp error: 'Invalid use of repetition operators' Execution halted
Browse[2]> system("R CMD SHLIB /var/folders/bU/bUB3Gk1uHBuDXq1G72Xc+++++TI/= -Tmp-/RtmpGzn3kA/file60b7acd9.cpp")
Error in sub(p0(base, "."), "", a) :=20
  invalid regular expression '/var/folders/bU/bUB3Gk1uHBuDXq1G72Xc+++++TI/-= Tmp-/RtmpGzn3kA/file60b7acd9.'
Calls: <Anonymous> -> .shlib_internal -> sub In addition: Warning message:
In sub(p0(base, "."), "", a) :
  regcomp error: 'Invalid use of repetition operators' Execution halted
Browse[2]> tempdir()
[1] "/var/folders/bU/bUB3Gk1uHBuDXq1G72Xc+++++TI/-Tmp-//RtmpGzn3kA"
Browse[2]> sessionInfo()
R version 2.10.1 (2009-12-14)=20
x86_64-apple-darwin9.8.0=20

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/C/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base=20=20=
=20=20=20

other attached packages:
[1] inline_0.3.3.1

bash-3.2$ R CMD SHLIB /var/folders/bU/bUB3Gk1uHBuDXq1G72Xc+++++TI/-Tmp-/Rtm= pGzn3kA/file60b7acd9.cpp
Error in sub(p0(base, "."), "", a) :=20
  invalid regular expression '/var/folders/bU/bUB3Gk1uHBuDXq1G72Xc+++++TI/-= Tmp-/RtmpGzn3kA/file60b7acd9.'
Calls: <Anonymous> -> .shlib_internal -> sub In addition: Warning message:
In sub(p0(base, "."), "", a) :
  regcomp error: 'Invalid use of repetition operators' Execution halted
bash-3.2$ pwd
/Users/osklyar/Code
bash-3.2$ cd tmp/
bash-3.2$ ln -s /var/folders/bU/bUB3Gk1uHBuDXq1G72Xc+++++TI/-Tmp-/RtmpGzn3k= A/file60b7acd9.cpp file60b7acd9.cpp
bash-3.2$ ls
file60b7acd9.cpp inline
bash-3.2$ R CMD SHLIB file60b7acd9.cpp=20 g++-4.2 -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -I= /Library/Frameworks/R.framework/Resources/include/x86_64 -I/usr/local/incl= ude -fPIC -mtune=3Dcore2 -g -O2 -c file60b7acd9.cpp -o file60b7acd9.o

g++-4.2 -arch x86_64 -dynamiclib -Wl,-headerpad_max_install_names -undefine=
d dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib=
 -o file60b7acd9.so file60b7acd9.o -F/Library/Frameworks/R.framework/.. -fr=
amework R -Wl,-framework -Wl,CoreFoundation
	[[alternative HTML version deleted]]

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon 28 Dec 2009 - 12:46:07 GMT

This archive was generated by hypermail 2.2.0 : Tue 29 Dec 2009 - 01:11:15 GMT