[Rcpp-devel] link issue when Rcpp package is installed in a path with space

Ken Williams Ken.Williams at windlogics.com
Mon Jul 16 23:54:38 CEST 2012


Jiqiang Guo wrote on Thu Jul 12 02:18:32 CEST 2012:
> From some reason, my Rcpp package on windows is installed in C:/Program
> Files/R/R-2.15.1/library/, which has a space in the path.  So in the end,
> when compiling cpp code using inline package, I would have the following
> error, which prevent me using Rcpp at all.
>
> Compilation argument:
>  C:/PROGRA~1/R/R-215~1.1/bin/i386/R CMD SHLIB file75c3d5d6216.cpp 2>
> file75c3d5d6216.cpp.err.txt
> g++  -I"C:/PROGRA~1/R/R-215~1.1/include" -DNDEBUG    -I"C:/Program
> Files/R/R-2.15.1/library/Rcpp/include"      -O2 -Wall  -mtune=core2 -c
> file75c3d5d6216.cpp -o file75c3d5d6216.o
> g++ -shared -s -static-libgcc -o file75c3d5d6216.dll tmp.def
> file75c3d5d6216.o C:/Program
> Files/R/R-2.15.1/library/Rcpp/lib/i386/libRcpp.a
> -LC:/PROGRA~1/R/R-215~1.1/bin/i386 -lR
> g++.exe: error: C:/Program: No such file or directory
> g++.exe: error: Files/R/R-2.15.1/library/Rcpp/lib/i386/libRcpp.a: No such
> file or directory
>
> Could we add quotes to those the Rcpp libraries?  It is easy to just fix
> for me on my computer, i.e., change file RcppLdpath.R
> (
> https://r-forge.r-project.org/scm/viewvc.php/pkg/Rcpp/R/RcppLdpath.R?view=markup&root=rcpp
>)

Coincidentally I encountered this problem for the first time today too, when attempting to install the 'earthmovdist' package from R-Forge.    Perhaps there's another workaround - can the install directory for Rcpp be set to "C:/PROGRA~1/R/R-215~1.1/library/Rcpp" instead of "C:/Program Files/R/R-2.15.1/library/Rcpp" somehow?

I tried setting it via .libPaths() (which is ultimately what base:::system.file() looks at) but it seems to be thwarting me:

> .libPaths("C:/PROGRA~1/R/R-214~1.1/library")
> .libPaths()
[1] "C:/Program Files/R/R-2.14.1/library"

The docs for .libPaths() say it will run the string through Sys.glob() and path.expand(), but at the bottom it mentions it's actually even more aggressive, it runs it through normalizePath() too, which sticks the space back in.

A better global fix than messing around with quotes would actually be to use system2() and pass the arguments as the 'args' parameter.  Not sure whether the build system allows that though.

--
Ken Williams, Senior Research Scientist
WindLogics
http://windlogics.com


CONFIDENTIALITY NOTICE: This e-mail message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution of any kind is strictly prohibited. If you are not the intended recipient, please contact the sender via reply e-mail and destroy all copies of the original message. Thank you.


More information about the Rcpp-devel mailing list