0

I have a Qt executable file. When this program runs on a Ubuntu 11.04 virtual machine, the GUI is ugly though you can still tell it is the GUI that you want. When it runs on Ubuntu 12.04 of my laptop, however, everything goes well. Thus I guess there might be something wrong with the environment of the virtual machine.

To find out whether the problem lies in the libraries, I ran the command

ldd filename

I got library dependencies as following:

% Below is the output on the virtual machine    
linux-gate.so.1 =>  (0x00cc8000)
libQtGui.so.4 => /opt/qt-4.7.1x86/lib/libQtGui.so.4 (0x00cc9000)
libQtCore.so.4 => /opt/qt-4.7.1x86/lib/libQtCore.so.4 (0x00110000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0x003b6000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0x003cf000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0x004ba000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0x004e0000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0x004fc000)
libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0x00686000)
libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0x00695000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0x0065d000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0x007b0000)
/lib/ld-linux.so.2 (0x00668000)
libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0x00a96000)
libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0x009ed000)
libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0x008a8000)

% Below is the output on Ubuntu 12.04 of my laptop
linux-gate.so.1 =>  (0xb776f000)
libQtGui.so.4 => /usr/lib/i386-linux-gnu/libQtGui.so.4 (0xb6c8a000)
libQtCore.so.4 => /usr/lib/i386-linux-gnu/libQtCore.so.4 (0xb69ad000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb6991000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb68ac000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb6880000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb6862000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb66bd000)
libfontconfig.so.1 => /usr/lib/i386-linux-gnu/libfontconfig.so.1 (0xb6688000)
libaudio.so.2 => /usr/lib/i386-linux-gnu/libaudio.so.2 (0xb666f000)
libglib-2.0.so.0 => /lib/i386-linux-gnu/libglib-2.0.so.0 (0xb6576000)
libpng12.so.0 => /lib/i386-linux-gnu/libpng12.so.0 (0xb654c000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb6536000)
libfreetype.so.6 => /usr/lib/i386-linux-gnu/libfreetype.so.6 (0xb649b000)
libgobject-2.0.so.0 => /usr/lib/i386-linux-gnu/libgobject-2.0.so.0 (0xb644c000)
libSM.so.6 => /usr/lib/i386-linux-gnu/libSM.so.6 (0xb6443000)
libICE.so.6 => /usr/lib/i386-linux-gnu/libICE.so.6 (0xb6429000)
libXi.so.6 => /usr/lib/i386-linux-gnu/libXi.so.6 (0xb6419000)
libXrender.so.1 => /usr/lib/i386-linux-gnu/libXrender.so.1 (0xb640e000)
libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0xb63fc000)
libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xb62c8000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb62c3000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb62ba000)
/lib/ld-linux.so.2 (0xb7770000)
libexpat.so.1 => /lib/i386-linux-gnu/libexpat.so.1 (0xb628f000)
libXt.so.6 => /usr/lib/i386-linux-gnu/libXt.so.6 (0xb6233000)
libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xb622f000)
libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb61f3000)
libffi.so.6 => /usr/lib/i386-linux-gnu/libffi.so.6 (0xb61ec000)
libuuid.so.1 => /lib/i386-linux-gnu/libuuid.so.1 (0xb61e5000)
libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xb61c4000)
libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xb61bd000)

Then I am wondering how can they be different? Can I find out what is wrong by tools such as strace?

Christian Rau
  • 45,360
  • 10
  • 108
  • 185
beaver
  • 550
  • 1
  • 9
  • 23

2 Answers2

0

I can see that Qt is installed in /opt on your 11.04. I guess that means you've built it yourself? Two solutions here:

  1. Install Qt from Ubuntu's repository instead. It comes with the needed Gtk style. (Note that 11.04 also has Qt available; it's just that 12.04 installs it by default while 11.04 doesn't.)

  2. When you build Qt, make sure to enable the Gtk style by passing the "-gtkstyle" option to the configure script. You will probably need to have all needed development packages for Gtk installed.

Nikos C.
  • 50,738
  • 9
  • 71
  • 96
  • This is inspiring and I'll try. Before that, I am wondering: The document says the styles are built into QtGui, then why `/opt/qt-4.7.1x86/lib/libQtGui.so.4` doesn't work? Moreover, on Ubuntu 11.04, even "hello" can be displayed as "h e lo", is it all about style? – beaver Nov 28 '12 at 01:43
  • What's more, on the Ubuntu 11.04, I previously installed Qt 4.8.2 and it ran well. But now, even that version has the same problem. I am not sure what other operations has been done to the system, because the computer is accessible by many users. Maybe I should start with a clean system? – beaver Nov 28 '12 at 02:17
  • After my test, perhaps the problem lies in `libQtGui.so.4` and `libQtCore.so.4`. I also have Qt4.8.1, which was probably installed while installing Qt Creator. After compiling by that version, the program uses libraries in another path and works fine. – beaver Nov 28 '12 at 02:38
0

The display of text in the program is too ugly to be simply a problem of style. But the problem indeed lies in the process of building Qt. When I ran ./configure, I output the configure information into a log file and found things like

  88 Xinerama support ....... no
  89 Xcursor support ........ no
  90 Xfixes support ......... no
  91 Xrandr support ......... no
  92 Xrender support ........ no
  93 Xi support ............. no

Moreover, I found the Qt for X11 requirements here. Therefore I concluded that the problem lies in a lack of such libraries. And fortunately, everything works fine after installing them.

beaver
  • 550
  • 1
  • 9
  • 23