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?

4

2 回答 2

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.

于 2012-11-27T12:35:53.377 回答
0

程序中文字的显示太难看,简直是风格问题。但问题确实出在构建Qt的过程中。当我运行时./configure,我将配置信息输出到一个日志文件中,发现类似

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

此外,我在这里找到了 X11 的 Qt 要求。因此我得出结论,问题在于缺乏这样的库。幸运的是,安装它们后一切正常。

于 2012-11-30T08:19:57.280 回答