[Rcpp-devel] Help compiling qtdensity example on windows [SOLVED]

Theodore Lytras thlytras at gmail.com
Wed Nov 28 00:43:11 CET 2012


Στις Δευ 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: qtdensity-pro.diff
Type: text/x-patch
Size: 1503 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20121128/a77ec101/attachment.bin>


More information about the Rcpp-devel mailing list