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

Dirk Eddelbuettel edd at debian.org
Thu Apr 28 13:08:44 CEST 2011


On 28 April 2011 at 09:45, Den Alpin wrote:
| I have Rcpp installed in
| C:/Documents and Settings/Damberti/R/win-library/2.12/

As you know, that is not a supported location as far as R goes.

| 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

Looks like you also have R itself in a path with spaces.

| 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)?

You could try make sure all relevant variables are defined in the short form,
so try resetting PKG_LIBS to c:/docume~1/damberti/... etc.  

Dirk

| 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")
| _______________________________________________
| 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

-- 
Gauss once played himself in a zero-sum game and won $50.
                      -- #11 at http://www.gaussfacts.com


More information about the Rcpp-devel mailing list