Important: Please read the Qt Code of Conduct -

Compiling on Ubuntu 64bit for 32bit - App looks bad

  • Hi,
    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

    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

    CONFIG(64bit) {
    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:
    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 => (0xb77aa000) => /usr/lib/ (0xb778a000) => /usr/lib/ (0xb766d000) => /lib/i686/cmov/ (0xb7668000) => /lib/i686/cmov/ (0xb765f000) => /mnt/hgfs/Shared Folder/Unix X11 32bit/./ (0xb6b27000) => /mnt/hgfs/Shared Folder/Unix X11 32bit/./ (0xb6873000) => /lib/i686/cmov/ (0xb685a000) => /usr/lib/ (0xb6764000) => /lib/i686/cmov/ (0xb673e000) => /lib/ (0xb6720000) => /lib/i686/cmov/ (0xb65da000) => /usr/lib/ (0xb65c1000)
    /lib/ (0xb77ab000) => /usr/lib/ (0xb65bd000) => /usr/lib/ (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
    make sub-src@
    and then build it this way:
    export PATH
    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.

Log in to reply