[Rcpp-devel] Help compiling qtdensity example on windows [SOLVED]
edd at debian.org
Wed Nov 28 02:23:21 CET 2012
On 28 November 2012 at 01:43, Theodore Lytras wrote:
| Στις Δευ 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
Sweet! Good work.
| > 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.
That had hit me once or twice, and I still wish I was better at reading the
linker error, or the linker was better at telling me :-/
| 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
Noted. Will change. I think I will reference the URL to this thread on the
gmane.org mailing list interface as well, just in case. [ Done ]
| 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
Yes, that is generally advisable.
| 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....
If need be could even ifdef which works in .pro files too (but I'd have to
look up how...)
Ok, applied your patch, that will go into the next commit.
Thanks for sticking with this!
| Thanks again,
| --- 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
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the Rcpp-devel