[Rcpp-devel] Rcpp installation problem on Windows XP

Dirk Eddelbuettel edd at debian.org
Tue Mar 20 00:29:07 CET 2012


On 19 March 2012 at 13:04, Dirk Eddelbuettel wrote:
| 
| On 19 March 2012 at 08:25, Isabella Ghement wrote:
| | Hello,
| |  
| | I am trying to get the "Rcpp" and "inline" libraries to work with R 2.14.2 on a
| | Windows XP platform and have followed all of the instructions I was able to
| | find with Google's help:
| |      
| |     1)  Installed R 2.14.2 in a directory without white spaces in its name (C:\
| | R\R-2.14.2);
| |      
| |     2)  Installed the latest version of R tools in C:\R\Rtools, which comes
| | with a folder named gcc-4.6.3;
| |      
| |     3) Changed the PATH environment to C:\R\Rtools\bin;C:\R\Rtools\gcc-4.6.3\
| | bin;C:\R\R-2.14.2\bin\i386;C:\WINDOWS;C:\WINDOWS\system32 
| |      
| |     4) Installed the R packages rcpp and inline in R. 
| |      
| |     However, when trying to execute a simple Rcpp/inline example in R, I get an
| | error message which seems to suggest that Rcpp cannot link to the gcc
| | compiler.  Here is part of the error message:
| |  
| | cygwin warning:
| |   MS-DOS style path detected: C:/R/R-214~1.2/etc/i386/Makeconf
| |   Preferred POSIX equivalent is: /cygdrive/c/R/R-214~1.2/etc/i386/Makeconf
| |   CYGWIN environment variable option "nodosfilewarning" turns off this warning.
| |   Consult the user's guide for more details about POSIX paths:
| |     http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
| | g++.exe: error: C:/Documents: No such file or directory
| | g++.exe: error: and: No such file or directory
| | g++.exe: error: Settings/dv6110ca/My: No such file or directory
| | g++.exe: error: Documents/R/win-library/2.14/Rcpp/lib/i386/libRcpp.a: No such
| | file
| |  
| | Any ideas on what might cause Rcpp to not work and how to overcome this?
| 
| There is a still a "C:/Documents and Settings/" somewhere which then gets
| broken as shown by the g++ error message (as I highlight below):
| 
|   g++.exe: error: C:/Documents
|   g++.exe: error: and
|   g++.exe: error: Settings/

For completeness, here is what looks like in an XP session in a virtual
machine I have -- and using 'verbose=TRUE'

R> f <- cxxfunction(signature(), plugin="Rcpp", body='return wrap("Hello, R/C++ World!");', verbose=TRUE)
 >> setting environment variables: 
PKG_LIBS =  c:/opt/R-library/Rcpp/lib/i386/libRcpp.a

 >> LinkingTo : Rcpp
CLINK_CPPFLAGS =  -I"c:/opt/R-library/Rcpp/include" 

 >> Program source :

   1 : 
   2 : // includes from the plugin
   3 : 
   4 : #include <Rcpp.h>
   5 : 
   6 : 
   7 : #ifndef BEGIN_RCPP
   8 : #define BEGIN_RCPP
   9 : #endif
  10 : 
  11 : #ifndef END_RCPP
  12 : #define END_RCPP
  13 : #endif
  14 : 
  15 : using namespace Rcpp;
  16 : 
  17 : 
  18 : // user includes
  19 : 
  20 : 
  21 : // declarations
  22 : extern "C" {
  23 : SEXP file44c29516753( ) ;
  24 : }
  25 : 
  26 : // definition
  27 : 
  28 : SEXP file44c29516753(  ){
  29 : BEGIN_RCPP
  30 : return wrap("Hello, R/C++ World!");
  31 : END_RCPP
  32 : }
  33 : 
  34 : 
Compilation argument:
 C:/opt/R-current/bin/i386/R CMD SHLIB file44c29516753.cpp 2> file44c29516753.cpp.err.txt 
g++  -I"C:/opt/R-CURR~1/include"    -I"c:/opt/R-library/Rcpp/include" -I"d:/RCompile/CRANpkg/extralibs/local/include"     -O2 -Wall  -mtune=core2 -c file44c29516753.cpp -o file44c29516753.o
g++ -shared -s -static-libgcc -o file44c29516753.dll tmp.def file44c29516753.o -Ld:/RCompile/CRANpkg/extralibs/local/lib/i386 -Ld:/RCompile/CRANpkg/extralibs/local/lib c:/opt/R-library/Rcpp/lib/i386/libRcpp.a -LC:/opt/R-CURR~1/bin/i386 -lR
cygwin warning:
  MS-DOS style path detected: C:/opt/R-CURR~1/etc/i386/Makeconf
  Preferred POSIX equivalent is: /cygdrive/c/opt/R-CURR~1/etc/i386/Makeconf
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
R> 
R> f()
[1] "Hello, R/C++ World!"
R> 

You see how g++ gets invoked once for compiling, and once for linking.  [ Not
sure where the D:/RCompile comes from -- might be CRAN. ]


Hope this helps,  Dirk

-- 
"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read." -- Groucho Marx


More information about the Rcpp-devel mailing list