[Rcpp-devel] Rcpp, inline and R CMD SHLIB compilation problem on Win XP

Den Alpin den.alpin at gmail.com
Thu Apr 28 09:45:45 CEST 2011


I have Rcpp installed in
C:/Documents and Settings/Damberti/R/win-library/2.12/
I’m trying to use package inline to compile a simple example (below),
I’m experiencing a compilation problem due to the space in the
installation path “C:/Documents and Settings”  giving this:

Error in compileCode(f, code, language = language, verbose = verbose) :
  Compilation ERROR, function(s)/method(s) not created! g++.exe:
C:/Documents: No such file or directory
g++.exe: and: No such file or directory
g++.exe: Settings/Damberti/R/win-library/2.12/Rcpp/lib/i386/libRcpp.a:
No such file or directory

The error seems to be caused by missing double quote for libRcpp.a
path on this chain:

Rcpp.system.file
RcppLdPath
RcppLdFlags
Rcpp:::inlineCxxPlugin
getPlugin('Rcpp')
$env$PKG_LIBS [1] " C:/Documents and
Settings/Damberti/R/win-library/2.12/Rcpp/lib/i386/libRcpp.a"
and finally:
Compilation argument:
 C:\PROGRA~1\R\R-212~1.1/bin/i386/R CMD SHLIB file3c125a01.cpp 2>
file3c125a01.cpp.err.txt
g++ -I"C:/PROGRA~1/R/R-212~1.1/include"   -I"C:/Documents and
Settings/Damberti/R/win-library/2.12/Rcpp/include"      -O2 -Wall  -c
file3c125a01.cpp -o file3c125a01.o
g++ -shared -s -static-libgcc -o file3c125a01.dll tmp.def
file3c125a01.o C:/Documents and
Settings/Damberti/R/win-library/2.12/Rcpp/lib/i386/libRcpp.a
-LC:/PROGRA~1/R/R-212~1.1/bin/i386 -lR
g++.exe: C:/Documents: No such file or directory
g++.exe: and: No such file or directory
g++.exe: Settings/Damberti/R/win-library/2.12/Rcpp/lib/i386/libRcpp.a:
No such file or directory

Any suggestion (different from installing Rcpp on a different path)?
I’m using R 2.12.2, Windows XP and latest available versions of Rcpp
and inline from CRAN.
Best regards,
Den


Example:
library(inline)
src <- '
 Rcpp::NumericVector xa(a);
 Rcpp::NumericVector xb(b);
 int n_xa = xa.size(), n_xb = xb.size();
 Rcpp::NumericVector xab(n_xa + n_xb - 1);
 for (int i = 0; i < n_xa; i++)
 for (int j = 0; j < n_xb; j++)
 xab[i + j] += xa[i] * xb[j];
 return xab;
'

fun <- cxxfunction(signature(a = "numeric", b = "numeric"),
 src, plugin = "Rcpp")


More information about the Rcpp-devel mailing list