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

Dirk Eddelbuettel edd at debian.org
Tue Jul 17 00:17:37 CEST 2012

On 16 July 2012 at 16:54, Ken Williams wrote:
| 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.

Our position has been consistent over the years, and consists in repeating
that one

   should not install R in a directory with spaces

which goes back to _this very paragraph_ from the "R on Windows" FAQ (aka rw-FAQ):

   If you want to be able to build packages from sources, we recommend that
   you choose an installation path not containing spaces.  (Using a path
   with spaces in will probably work, but is little-tested.)  Users of

So why the R installer still defaults to a directory with spaces, despite all
this, defies my understanding -- but that is where we are at.

When I have to work on Windows, I use something like


(which I can then replace with the next R release in the same location.) No
spaces, no changing $PATH.  Works for me.

I am not particularly interested in having to support platform-specific
fixes. I once tried (either in Rcpp 0.6.* or 0.7.*) to use double-quotes and
it had side-effects.

I will consider _careful_ patches supplied with sufficient evidence that they
do not break anything else.

With that, let me say that I am sorry for your troubles with Rcpp.  My
preference is to work on a different OS most of the time...


| --
| 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.
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com  

More information about the Rcpp-devel mailing list