[Rcpp-devel] Help compiling qtdensity example on windows
Theodore Lytras
thlytras at gmail.com
Mon Nov 26 18:11:10 CET 2012
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&)'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0x91c): undefined reference to `vtable for Rcpp::Language'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0x924): undefined reference to `Rcpp::Language::update()'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0x92c): undefined reference to `Rcpp::Function::~Function()'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0x96a): undefined reference to `Rcpp::DottedPair::operator[](int)'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0x9fc): undefined reference to `Rcpp::Function::Function(std::string
const&)'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0xa75): undefined reference to `vtable for Rcpp::Language'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0xa7d): undefined reference to `Rcpp::Language::update()'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0xa85): undefined reference to `Rcpp::Function::~Function()'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0xae5): undefined reference to `Rcpp::DottedPair::operator[](int)'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0xb08): undefined reference to `Rcpp::DottedPair::operator[](int)'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0xb2b): undefined reference to `Rcpp::DottedPair::operator[](int)'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0xbf1): undefined reference to `Rcpp::Language::eval()'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0xc83): undefined reference to `Rcpp::Language::~Language()'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0xc9c): undefined reference to `Rcpp::Language::~Language()'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0xcc9): undefined reference to `Rcpp::Language::~Language()'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0xcfc): undefined reference to `Rcpp::Language::~Language()'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0xe83): undefined reference to `Rcpp::Language::~Language()'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0xefb): more undefined references to `Rcpp::Language::~Language()'
follow
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0xfa0): undefined reference to `Rcpp::DottedPair::~DottedPair()'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0xfa8): undefined reference to `Rcpp::Function::~Function()'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0x1067): undefined reference to `Rcpp::Language::~Language()'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0x107c): undefined reference to `Rcpp::Language::~Language()'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0x109c): undefined reference to `Rcpp::Language::~Language()'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0x10b6): undefined reference to `Rcpp::DottedPair::~DottedPair()'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0x10be): undefined reference to `Rcpp::Function::~Function()'
C:/R/R-2.15.2/library/RInside/lib/i386/libRInside.a(RInside.o):RInside.cpp:
(.text+0x1128): undefined reference to `Rcpp::Language::~Language()'
collect2: ld returned 1 exit status
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.
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) ?
Any help is greatly appreciated!
Theodore Lytras
More information about the Rcpp-devel
mailing list