Thursday Night

Paul Betts’s personal website / blog / what-have-you

Don’t worry, I haven’t forgotten QtRuby on Win32!

I was planning on posting the same kind of tutorial for Win32 for using QtRuby, but I’m currently stuck as to how to get it to build. After fighting with random build glitches for three hours or so (making progress, slowly), I’m currently stuck here:

Compiled with:
C:/MinGW/bin/g++.exe   -IC:/Qt/4.3.0/include/QtDBus -IC:/Qt/4.3.0/include/QtTest
 -IC:/Qt/4.3.0/include/QtUiTools -IC:/Qt/4.3.0/include/QtScript -IC:/Qt/4.3.0/in
clude/QtSvg -IC:/Qt/4.3.0/include/QtXml -IC:/Qt/4.3.0/include/QtSql -IC:/Qt/4.3.
0/include/QtOpenGL -IC:/Qt/4.3.0/include/QtNetwork -IC:/Qt/4.3.0/include/QtDesig
ner -IC:/Qt/4.3.0/include/QtDesigner -IC:/Qt/4.3.0/include/QtAssistant -IC:/Qt/4
.3.0/include/Qt3Support -IC:/Qt/4.3.0/include/QtGui -IC:/Qt/4.3.0/include/QtCore
 -IC:\Qt\4.3.0\mkspecs/default -IC:/Qt/4.3.0/include/Qt -IC:/Qt/4.3.0/include  C
:/Qt/4.3.0/lib/libQtCore4.a C:/Qt/4.3.0/lib/libQtNetwork4.a C:/Qt/4.3.0/lib/libQ
tSql4.a C:/Qt/4.3.0/lib/libQtXml4.a C:/Qt/4.3.0/lib/libQtGui4.a C:/Qt/4.3.0/lib/
libQtUiTools.a C:/Qt/4.3.0/lib/libQtSvg4.a C:/Qt/4.3.0/lib/libQtOpenGL4.a C:/Qt/
4.3.0/lib/libQt3Support4.a  -o C:\Users\paulbe\AppData\Local\Temp/3428-qtguess C
:\Users\paulbe\AppData\Local\Temp/3428-qtguess.cpp
Compiler output:
C:\Users\paulbe\AppData\Local\Temp/3428-qtguess.cpp:8:2: warning: no newline at
end of file
C:\Users\paulbe\AppData\Local\Temp/ccMxaaaa.o(.text+0×147):3428-qtguess.cpp:
undefined reference to `_imp___ZN12QApplicationC1ERiPPci
C:\Users\paulbe\AppData\Local\Temp/ccMxaaaa.o(.text+0×154):3428-qtguess.cpp:
undefined reference to `QApplication::~QApplication()’

collect2: ld returned 1 exit status

Thoughts? It looks like I’ve got some sort of compiler mismatch (one library compiled with MSVC and one compiled with MinGW, probably). I have no idea where though, I’m 85% sure that Qt is compiled with MinGW

Update: Alright, the new plan is to compile everything from scratch, and see if I can get some better results.

Update 2: It’s definitely the compiler difference:

> objdump -x C:\Qt\4.3.0\lib\libQtGui4.a

{ Snip! }

SYMBOL TABLE:
[  0](sec  1)(fl 0×00)(ty   0)(scl   3) (nx 0) 0×00000000 .text
[  1](sec  2)(fl 0×00)(ty   0)(scl   3) (nx 0) 0×00000000 .idata$7
[  2](sec  3)(fl 0×00)(ty   0)(scl   3) (nx 0) 0×00000000 .idata$5
[  3](sec  4)(fl 0×00)(ty   0)(scl   3) (nx 0) 0×00000000 .idata$4
[  4](sec  5)(fl 0×00)(ty   0)(scl   3) (nx 0) 0×00000000 .idata$6
[  5](sec  1)(fl 0×00)(ty   0)(scl   2) (nx 0) 0×00000000 __ZN12QApplicationC2ERiPPci
[  6](sec  3)(fl 0×00)(ty   0)(scl   2) (nx 0) 0×00000000 __imp___ZN12QApplicationC2ERiPPci
[  7](sec  0)(fl 0×00)(ty   0)(scl   2) (nx 0) 0×00000000 __head_QtGui4_dll

The compiler’s looking for __imp___ZN12QApplicationC1ERiPPci, but the precompiled library has C2. I don’t understand why Qt’s distributing a busted library – this would break even their samples in straight C++ – it’s possible that Mingw updated behind their back though.

Written by Paul Betts

July 22nd, 2007 at 8:32 pm

Posted in Microsoft, QT/KDE, Ruby