Compiling on Ubuntu 64bit for 32bit - App looks bad
I have written app and when I will compile it for 64bit version, it looks well. But if I will compile it for 32bit, no matter if with dynamic or static linking of Qt libs, it looks bad. I'm running Ubuntu 64-bit and using qmake. If I'm compiling for 32bit, I'm using 32bit version of qmake.
My pro file:
QT += core gui
CONFIG += 32bit
TARGET = 5inRow32
QMAKE_CXXFLAGS += -m32
LIBS += -L/opt/Qt-32b//lib -lQtGui -L/opt/Qt-32b/lib -lXext -lX11 -lQtCore -lm -ldl -lrt -lpthread
TARGET = 5inRow64
QMAKE_LFLAGS += -Wl,-rpath='$$ORIGIN'
TEMPLATE = app
SOURCES += main.cpp
HEADERS += mainwindow.h
Thanks in advise.
Define 'bad'. I guess you mean it shows up in an ugly style. But how should a 32 bit lib retrieve its styling from a 64 bit lib? They can't link against each other.
Yes, its ugly style, like win98. It is game 5 in row and circles painted on board look also awful. Image will be more ilustrative: http://i56.tinypic.com/14kl2k8.png
But even if I will run it on 32bit Ubuntu, it looks that ugly.
Then run ldd to see which library you are linking on your 32bit deployment target. In your case QGtkStyle is delivering the correct styling and it does so by asking gtk's theme engine. Of course that can only work with dynamically linked dlls build for your target system. 32bit libs on your 64 bit system are most likely compiled without gtk style support.
ldd shows this:
shima@debian:/mnt/hgfs/Shared Folder/Unix X11 32bit$ ldd ./5inRow32
linux-gate.so.1 => (0xb77aa000)
libXext.so.6 => /usr/lib/libXext.so.6 (0xb778a000)
libX11.so.6 => /usr/lib/libX11.so.6 (0xb766d000)
libdl.so.2 => /lib/i686/cmov/libdl.so.2 (0xb7668000)
librt.so.1 => /lib/i686/cmov/librt.so.1 (0xb765f000)
libQtGui.so.4 => /mnt/hgfs/Shared Folder/Unix X11 32bit/./libQtGui.so.4 (0xb6b27000)
libQtCore.so.4 => /mnt/hgfs/Shared Folder/Unix X11 32bit/./libQtCore.so.4 (0xb6873000)
libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xb685a000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb6764000)
libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb673e000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb6720000)
libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb65da000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb65c1000)
libXau.so.6 => /usr/lib/libXau.so.6 (0xb65bd000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb65b8000)
So I have to install different package with GTK style support? Could you give me advise which package is it?
No, just make it link against your target system's Qt library. Maybe it helps already if you put the default location into LD_LIBRARY_PATH?
<code>$ LD_LIBRARY_PATH=/usr/lib ./5inRow32</code>
Qt library is distributed with app and its linked correctly. I've used libs compiled on my deployment machine (Ubuntu 10.04 64-bit) with Qt lib conf:
@./configure -prefix /opt/Qt-32b -platform linux-g++-32b -release -nomake demos -nomake examples
and then build it this way:
qmake -config -release
make && make clean@
and put Qt libs to folder with app.
.pro file is above.
Maybe I've missed something.
I would think you can't have a correctly linked 32 bit library which works theming wise on your 64 bit system. And if you distribute that, it of course keeps looking the same on the 32 bit target host.