[R] Error in Rcpp/inline (Windows XP)

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Oct 12 18:37:33 CEST 2011


Did you read the posting guide (it says R-help is not for questions 
about compiled code)?

Or the rw-FAQ (it warned you that lots of contributed packages did not 
take account of spaces in path names, so suggested you install R in a 
path without one)?

This is a bug in one of the packages you are using, so you could 
(following the posting guide) discuss it with the package maintainers. 
But it is so common that you would do well to take the defensive 
action recommended in the rw-FAQ.

On Wed, 12 Oct 2011, allenhahaha wrote:

> Hi, everyone,
>
> I am just trying to use Rcpp in my computer, and I would like to try a
> simple example from website, but R keeps reporting me error. I am using
> Windows XP, and has installed Rtools and GSI.
>
> Here is the response:
>
>> src = '
> + Rcpp::NumericVector xa(a);
> + Rcpp::NumericVector xb(b);
> + int n_xa = xa.size();
> + int 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",verbose=T)
> >> setting environment variables:
> PKG_LIBS =  C:/Program Files/R/R-2.13.0/library/Rcpp/lib/i386/libRcpp.a
>
> >> LinkingTo : Rcpp
> CLINK_CPPFLAGS =  -I"C:/Program Files/R/R-2.13.0/library/Rcpp/include"
>
> >> Program source :
>
> ......
>
> Compilation argument:
> C:/PROGRA~1/R/R-213~1.0/bin/i386/R CMD SHLIB file6d55374d.cpp 2>
> file6d55374d.cpp.err.txt
> g++ -I"C:/PROGRA~1/R/R-213~1.0/include"    -I"C:/Program
> Files/R/R-2.13.0/library/Rcpp/include"      -O2 -Wall  -c file6d55374d.cpp
> -o file6d55374d.o
> g++ -shared -s -static-libgcc -o file6d55374d.dll tmp.def file6d55374d.o
> C:/Program Files/R/R-2.13.0/library/Rcpp/lib/i386/libRcpp.a
> -LC:/PROGRA~1/R/R-213~1.0/bin/i386 -lR
> cygwin warning:
>  MS-DOS style path detected: C:/PROGRA~1/R/R-213~1.0/etc/i386/Makeconf
>  Preferred POSIX equivalent is:
> /cygdrive/c/PROGRA~1/R/R-213~1.0/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: C:/Program: No such file or directory
> g++.exe: Files/R/R-2.13.0/library/Rcpp/lib/i386/libRcpp.a: No such file or
> directory
>
> ERROR(s) during compilation: source code errors or compiler configuration
> errors!
>
> Program source:
> ......
> Erreur dans compileCode(f, code, language = language, verbose = verbose) :
>  Compilation ERROR, function(s)/method(s) not created! cygwin warning:
>  MS-DOS style path detected: C:/PROGRA~1/R/R-213~1.0/etc/i386/Makeconf
>  Preferred POSIX equivalent is:
> /cygdrive/c/PROGRA~1/R/R-213~1.0/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: C:/Program: No such file or directory
> g++.exe: Files/R/R-2.13.0/library/Rcpp/lib/i386/libRcpp.a: No such file or
> directory
>>
>> fun(1:3, 1:4)
>
> Also, here is a test by Romain that perhaps useful.
>
>> system( "R CMD SHLIB test.c" )
> cygwin warning:
>  MS-DOS style path detected: C:/PROGRA~1/R/R-213~1.0/etc/i386/Makeconf
>  Preferred POSIX equivalent is:
> /cygdrive/c/PROGRA~1/R/R-213~1.0/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
> gcc -I"C:/PROGRA~1/R/R-213~1.0/include"    -I"C:/Program
> Files/R/R-2.13.0/library/Rcpp/include"      -O3 -Wall  -std=gnu99 -c test.c
> -o test.o
> gcc -shared -s -static-libgcc -o test.dll tmp.def test.o C:/Program
> Files/R/R-2.13.0/library/Rcpp/lib/i386/libRcpp.a
> -LC:/PROGRA~1/R/R-213~1.0/bin/i386 -lR
> gcc.exe: C:/Program: No such file or directory
> gcc.exe: Files/R/R-2.13.0/library/Rcpp/lib/i386/libRcpp.a: No such file or
> directory
>> dyn.load( "test.so" )
> Erreur dans inDL(x, as.logical(local), as.logical(now), ...) :
>  impossible de charger l'objet partagé 'C:/Documents and Settings/kangj/Mes
> documents/test.so':
>  LoadLibrary failure:  Le module spécifié est introuvable.
> alide.
>> .Call( "f" )
> Erreur dans .Call("f") :
>  point d'entrée C "f" absent de la table de chargement
>
>
> Thanks so much.
>
> Kent
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Error-in-Rcpp-inline-Windows-XP-tp3898121p3898121.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


More information about the R-help mailing list