On 8 September 2011 at 15:11, Bjørn Skogtrø wrote: | Hi Dirk, | | Thanks for the response - it was helpful.
Glad to hear that! | I've added the library you suggested and the appropriate path, and now linking | is fine. For completeness, my makevars.win now looks like this: | | ## Use the R_HOME indirection to support installations of multiple R version | ## PKG_LIBS = $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e | "Rcpp:::LdFlags()") | | PKG_LIBS = $("C:/PROGRA~1/R/R-2.13.1/library/Rcpp/lib/i386/libR.cpp.a") | PKG_LIBS+= -lRcpp | PKG_LIBS+= -LC:/PROGRA~1/R/R-213~1.1/library/Rcpp/libs/i386 Isn't the first line a null op? What is it supposed to do? Just the latter two are probably fine as well. Dirk | Guess the approach can be prettified using the $(shell....) approach above and | regular expressions, but I'm no expert on this. | | Thanks again! | | BR, | Bjørn | | | | | 2011/9/8 Dirk Eddelbuettel <e...@debian.org> | | | Hi Bjørn, | | Welcome! | | On 8 September 2011 at 10:36, Bjørn Skogtrø wrote: | | Hi guys. | | | | First off, thanks for a nice piece of software. | | | | Now to the issue at hand: | | | | I'm trying to compile and link the package obtained using | Rcpp.package.skeleton | | (...) (out of the box). I'm running R 2.13.1, with Rcpp 0.9.6 on a | Windows XP | | machine. | | | | The first problem I ran into was how the package-libs variable PKG_LIBS | was | | pasted into the g++ string for compiling: | | | | g++ -shared -s -static-libgcc -o processes.dll tmp.def rcpp_hello_world.o | | rcpp_module.o C:/Program Files/R/R-2.13.1/library/Rcpp/lib/i386/libRcpp.a | -LC:/ | | PROGRA~1/R/R-213~1.1/bin/i386 -lR | | g++.exe: C:/Program: No such file or directory | | g++.exe: Files/R/R-2.13.1/library/Rcpp/lib/i386/libRcpp.a: No such file | or | | directory | | ERROR: compilation failed for package 'processes' | | * removing 'D:/Documents/Eclipse/processes.Rcheck/processes' | | | | As you can see, paths with spaces in them is not cool. | | Correct. The shell / Makefile quoting gets in the way. | | If someone comes with _reliable ways to improve this_ we'd be open for | patches. Until then the recommendation is to not use directories with | spaces. | | | I resolved this by overriding it in makevars.win by hard-coding it, so my | makevars.win looks like | | Good idea. | | | ## Use the R_HOME indirection to support installations of multiple R | version | | ## PKG_LIBS = $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e | | "Rcpp:::LdFlags()") | | PKG_LIBS = $("C:/PROGRA~1/R/R-2.13.1/library/Rcpp/lib/i386/libRcpp.a") | | | | Compiling then works fine, and spits out the files rcpp_module.o and | | rcpp_hello_world.o. The problem then is linking, which complains over | | "undefined reference": | | | | * installing *source* package 'processes' ... | | ** libs | | cygwin warning: | | MS-DOS style path detected: C:/PROGRA~1/R/R-213~1.1/etc/i386/Makeconf | | Preferred POSIX equivalent is: /cygdrive/c/PROGRA~1/R/R-213~1.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 | | g++ -shared -s -static-libgcc -o processes.dll tmp.def rcpp_hello_world.o | | rcpp_module.o -LC:/PROGRA~1/R/R-213~1.1/bin/i386 -lR | | rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x66): undefined reference | to | | `Rcpp::RObject::setSEXP(SEXPREC*)' | | rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x71): undefined reference | to | | `void Rcpp::internal::r_init_vector<16>(SEXPREC*)' | | rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x148): undefined | reference to | | `Rcpp::RObject::setSEXP(SEXPREC*)' | | rcpp_hello_world.o:rcpp_hello_world.cpp:(.text+0x1a7): undefined | reference to | | `Rcpp::RObject::setSEXP(SEXPREC*)' | | | | I'm assuming that these two errors are somewhat related, but can't figure | it | | out (the compile processs running R CMD check is a bit intransparent to | me). I | | should mention that this exact procedure worked fine until I upgraded | from | | 2.13.0 to 2.13.1 yesterday. | | | | Any clues on what to look at?? | | Your PKG_LIBS appears to be wrong: | | g++ -shared -s -static-libgcc -o processes.dll tmp.def | rcpp_hello_world.o | rcpp_module.o -LC:/PROGRA~1/R/R-213~1.1/bin/i386 -lR | | You need a -L part for a location, as well as -l part giving a library, eg | | g++ -shared -s -static-libgcc -o processes.dll tmp.def | rcpp_hello_world.o | rcpp_module.o -LC:/PROGRA~1/R/R-213~1.1/bin/i386 -lRcpp -lR | | where I added -lRcpp. | | Hope this helps, Dirk | | | Thanks! | | | | BR, | | Bjørn | | | | | | -- | | Up, down, turn around | | Please dont let me hit the ground | | Tonight I think Ill walk alone | | Ill find my soul as I go home. | | | | ---------------------------------------------------------------------- | | _______________________________________________ | | Rcpp-devel mailing list | | Rcpp-devel@lists.r-forge.r-project.org | | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel | -- | Two new Rcpp master classes for R and C++ integration scheduled for | New York (Sep 24) and San Francisco (Oct 8), more details are at | http://dirk.eddelbuettel.com/blog/2011/08/04# | rcpp_classes_2011-09_and_2011-10 | http://www.revolutionanalytics.com/products/training/public/ | rcpp-master-class.php | | | | | -- | Up, down, turn around | Please dont let me hit the ground | Tonight I think Ill walk alone | Ill find my soul as I go home. -- Two new Rcpp master classes for R and C++ integration scheduled for New York (Sep 24) and San Francisco (Oct 8), more details are at http://dirk.eddelbuettel.com/blog/2011/08/04#rcpp_classes_2011-09_and_2011-10 http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel