Στις Δευ 26 Νοε 2012, ο/η Dirk Eddelbuettel έγραψε:
> Hang in there. It would be nice to get this going, and document it. It is,
> as so many things, frightfully tedious in Windows but I think it can be
> done.

Finally nailed it!!! Compiled and run qtdensity example on windows. :D

> It may of course also work with the Qt binary you got.  Sometimes it is
> just link order etc pp.  But hard to tell.

That's exactly what the problem was: the linker was linking against libRcpp.a 
before linking libRInside.a.

So I had to modify the qtdensity.pro file, and move $$RINSIDELIBS just before 
$$RCPPLIBS on line 46 (QMAKE_LIBS). That did the trick.

In addition, I had to replace single quotes on lines 31,32,41 and 42 with 
double quotes, otherwise Rscript would not properly evaluate 
RInside:::LdFlags().

I used the latest Qt SDK (1.2.1), which includes the Qt 4.8.1 binaries, Qt 
Creator and MinGW 4.4.0. Didn't need to compile Qt from source. R was binary 
as well.

I did need however to install Rcpp and RInside from source, and with the same 
compiler used to compile qtdensity (otherwise I would get additional linker 
errors). As I had trouble getting the (Cygwin-based) g++ shipped with Rtools 
to work with Qt, I used instead the g++ shipped with Qt SDK to compile Rcpp 
and RInside. To do that, I adjusted the PATH environment variable to point to 
QtSDK\mingw\bin instead of Rtools\gcc-4.6.3\bin.

That's the whole story of how it worked for me. I suggest that qtdensity.pro 
receive these two modifications for the next RInside release (patch included); 
I tried this on Linux too and it seems to do no harm there.

I do wonder why linking order seems to matter on windows and not on linux, but 
I'm no expert....

Thanks again,

Theodore

--- qtdensity.pro.orig	2012-11-28 01:24:41.000000000 +0200
+++ qtdensity.pro	2012-11-28 01:24:08.000000000 +0200
@@ -28,8 +28,8 @@
 RRPATH =		-Wl,-rpath,$$R_HOME/lib
 
 ## include headers and libraries for Rcpp interface classes
-RCPPINCL = 		$$system($$R_HOME/bin/Rscript -e \'Rcpp:::CxxFlags\(\)\')
-RCPPLIBS = 		$$system($$R_HOME/bin/Rscript -e \'Rcpp:::LdFlags\(\)\')
+RCPPINCL = 		$$system($$R_HOME/bin/Rscript -e \"Rcpp:::CxxFlags\(\)\")
+RCPPLIBS = 		$$system($$R_HOME/bin/Rscript -e \"Rcpp:::LdFlags\(\)\")
 
 ## for some reason when building with Qt we get this each time
 ##   /usr/local/lib/R/site-library/Rcpp/include/Rcpp/module/Module_generated_ctor_signature.h:25: warning: unused parameter ‘classname
@@ -38,12 +38,12 @@
 #RCPPWARNING =		-Wno-unused-parameter 
 
 ## include headers and libraries for RInside embedding classes
-RINSIDEINCL = 		$$system($$R_HOME/bin/Rscript -e \'RInside:::CxxFlags\(\)\')
-RINSIDELIBS = 		$$system($$R_HOME/bin/Rscript -e \'RInside:::LdFlags\(\)\')
+RINSIDEINCL = 		$$system($$R_HOME/bin/Rscript -e \"RInside:::CxxFlags\(\)\")
+RINSIDELIBS = 		$$system($$R_HOME/bin/Rscript -e \"RInside:::LdFlags\(\)\")
 
 ## compiler etc settings used in default make rules
 QMAKE_CXXFLAGS +=	$$RCPPWARNING $$RCPPFLAGS $$RCPPINCL $$RINSIDEINCL
-QMAKE_LIBS +=           $$RLDFLAGS $$RBLAS $$RLAPACK $$RCPPLIBS $$RINSIDELIBS
+QMAKE_LIBS +=           $$RLDFLAGS $$RBLAS $$RLAPACK $$RINSIDELIBS $$RCPPLIBS
 
 ## addition clean targets
 QMAKE_CLEAN +=		qtdensity Makefile
_______________________________________________
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

Reply via email to