June 16, 2011

ShimaCZ ShimaCZ
Lab Rat
4 posts

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:

  1. QT       += core gui
  2.  
  3. CONFIG += 32bit
  4.  
  5. CONFIG(32bit) {
  6.     TARGET = 5inRow32
  7.     QMAKE_CXXFLAGS += -m32
  8.     LIBS += -L/opt/Qt-32b//lib -lQtGui -L/opt/Qt-32b/lib -lXext -lX11 -lQtCore -lm -ldl -lrt -lpthread
  9. }
  10.  
  11. CONFIG(64bit) {
  12.     TARGET = 5inRow64
  13. }
  14.  
  15. QMAKE_LFLAGS += -Wl,-rpath=\'\$\$ORIGIN\'
  16.  
  17. TEMPLATE = app
  18.  
  19. SOURCES += main.cpp\
  20.        mainwindow.cpp \
  21.    board.cpp \
  22.    settings.cpp \
  23.    fiveinrowai.cpp
  24.  
  25. HEADERS  += mainwindow.h \
  26.    board.h \
  27.    settings.h \
  28.    fiveinrowai.h

Thanks in advise.

7 replies

June 16, 2011

Flux Flux
Lab Rat
141 posts

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.

June 16, 2011

ShimaCZ ShimaCZ
Lab Rat
4 posts

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.

June 17, 2011

Flux Flux
Lab Rat
141 posts

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.

June 17, 2011

ShimaCZ ShimaCZ
Lab Rat
4 posts

ldd shows this:

  1. shima@debian:/mnt/hgfs/Shared Folder/Unix X11 32bit$ ldd ./5inRow32
  2.  linux-gate.so.1 =>  (0xb77aa000)
  3.  libXext.so.6 => /usr/lib/libXext.so.6 (0xb778a000)
  4.  libX11.so.6 => /usr/lib/libX11.so.6 (0xb766d000)
  5.  libdl.so.2 => /lib/i686/cmov/libdl.so.2 (0xb7668000)
  6.  librt.so.1 => /lib/i686/cmov/librt.so.1 (0xb765f000)
  7.  libQtGui.so.4 => /mnt/hgfs/Shared Folder/Unix X11 32bit/./libQtGui.so.4 (0xb6b27000)
  8.  libQtCore.so.4 => /mnt/hgfs/Shared Folder/Unix X11 32bit/./libQtCore.so.4 (0xb6873000)
  9.  libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xb685a000)
  10.  libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb6764000)
  11.  libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb673e000)
  12.  libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb6720000)
  13.  libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb65da000)
  14.  libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb65c1000)
  15.  /lib/ld-linux.so.2 (0xb77ab000)
  16.  libXau.so.6 => /usr/lib/libXau.so.6 (0xb65bd000)
  17.  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?

June 17, 2011

Flux Flux
Lab Rat
141 posts

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?
$ LD_LIBRARY_PATH=/usr/lib ./5inRow32

June 17, 2011

ShimaCZ ShimaCZ
Lab Rat
4 posts

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:

  1. ./configure -prefix /opt/Qt-32b -platform linux-g++-32b -release -nomake demos -nomake examples
  2. make sub-src

and then build it this way:
  1. PATH=/opt/Qt-32b/bin:$PATH
  2. export PATH
  3. qmake -config -release
  4. make && make clean

and put Qt libs to folder with app.

.pro file is above.
Maybe I’ve missed something.

June 17, 2011

Flux Flux
Lab Rat
141 posts

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.

 
  ‹‹ Installation happening in Win 7 & not working in Win XP      configure "qtnamespace" flags? ››

You must log in to post a reply. Not a member yet? Register here!