[Rcpp-devel] Help compiling qtdensity example on windows

Dirk Eddelbuettel edd at debian.org
Mon Nov 26 18:36:06 CET 2012


On 26 November 2012 at 19:11, Theodore Lytras wrote:
| Hello all,
| 
| As a first step in porting my beautifully functional (and ever in development) 
| Qt / RInside application from Debian to Windows, I have tried to compile the 
| qtdensity example on Windows. 
| 
| However, I seem to be stuck with these "undefined reference" errors (long text 
| follows):
| 
| C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
| (.text+0x8be): undefined reference to `Rcpp::Function::Function(std::string 
| const&)'

[...]

| 
| Here's the whole story so far:
| 
| My box is running Windows 7, I have installed R 2.15.2 binary for Windows from 
| CRAN, and the full Qt SDK which includes Qt 4.8.1, Qt Creator and MinGW 4.4.0.
| 
| I have also installed Rtools, but *deleted* the MinGW version that comes with 
| Rtools, so that MinGW 4.4.0 from Qt SDK is the only compiler present in the 
| system.

I had this working years ago at a prior workplace (and would not have
published / pushed it otherwise).

I think I did it the other way around: rebuild Qt with the mingw from
Rtools. Not entirely sure.
 
| R is installed under "C:\R" and not under "C:\Program Files". Environment 
| variable R_HOME is set to "C:\R\R-2.15.2", and PATH includes the MinGW path 
| and the "C:\R\R-2.15.2\bin" path.
| 
| Rcpp and RInside seem to have been installed OK under "C:\R\R-2.15.2\library", 
| downloaded from CRAN and compiled from source, with the function:
| install.packages(c("Rcpp","RInside"), type="source)
| 
| The only modification I have made to the qtdensity.pro file is on lines 
| 31,32,41 and 42, where I have replaced the single quotes in the calls to 
| Rscript with double quotes:
| 
| RCPPINCL = $$system($$R_HOME/bin/Rscript -e \"Rcpp:::CxxFlags\(\)\")
| RCPPLIBS = $$system($$R_HOME/bin/Rscript -e \"Rcpp:::LdFlags\(\)\")
| RINSIDEINCL = $$system($$R_HOME/bin/Rscript -e \"RInside:::CxxFlags\(\)\")
| RINSIDELIBS = $$system($$R_HOME/bin/Rscript -e \"RInside:::LdFlags\(\)\")
| 
| as I have found that Rcpp:::LdFlags() and the rest were not evaluated when 
| delimited by single quotes.
| 
| The standard RInside examples compile and run without problem. For the 
| qtdensity example though, all object files are getting compiled, but there 
| seems to be a problem with linking.
| 
| I saw an earlier rcpp-devel post by Dirk, suggesting that one should use the 
| same MinGW compiler that was used to build Qt. The version of Qt shipped with 
| the Qt SDK is indeed supposed to be built with the shipped compiler, so there 
| *should* be no problem.
| 
| Nonetheless, I downloaded latest Qt source (http://releases.qt-
| project.org/qt4/source/qt-everywhere-opensource-src-4.8.3.zip) and built it 
| again on Windows with the SDK's MinGW compiler (again, the only compiler 
| present on the system). The configure options were: -platform win32-g++ -
| exceptions -rtti -no-phonon -no-phonon-backend -debug-and-release -opensource 
| -shared -no-qt3support -nomake examples -nomake demos
| 
| I adjusted the QTMAKESPEC and PATH enviroment variables to use this version, 
| and selected it for the project on Qt Creator. Compilation of qtdensity is OK, 
| and seems to use this custom-build version of Qt. 
| 
| However, I keep getting the same linker errors. So I am stuck, and out of 
| ideas.
| 
| Has anyone managed to run the qtdensity example on windows recently? If so, 
| would you please describe what you did, i.e. which exact setup worked (Win 
| version, Qt version, MinGW, etc) ?

Yes I have, but not recently and I no longer have access to the system on
which I did it.  

You could try rebuild Qt with the R toolchain compiler.  Or you could forget
it and switch to Rserve and tcp/ip connections to avoid the linker issue.

Dirk
 
| Any help is greatly appreciated!
| 
| Theodore Lytras
| 
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com  


More information about the Rcpp-devel mailing list