PDA

View Full Version : Problem Running 32bit QT Application on 64bit Machine Compiled in a Chroot (Ubuntu)



thaynes
7th September 2011, 19:54
Hi,

I am attempting to run a 32bit application on a 64 bit machine running Ubuntu 10.4. I had to use a chroot running 32bit Ubuntu 9.10 to compile the application since it was written for 32bit. The issue at hand appears when attempting to connect the application to the postgres 8.4 database. The chroot is configured identically as the root, with the same applications installed. I have also installed 32 bit libraries on the 64bit machine.

I can launch the application inside of the chroot environment and the database connects fine. However, When exiting the chroot it fails to connect and reports the error,

QSqlDatabase: QPSQL driver not loaded
QSqlDatabase: available drivers:

I can manually access the database using either environment simply by typing psql dbname.

Also, is there a location where I can find more information on why this is failing, such as a QT log directory?

wysota
7th September 2011, 20:00
What do you mean "when exiting the chroot"? You mean you want to launch the same application outside chroot? I would assume the application picks an incorrect library. You can check it out with ldd (check both the application and the QPSQL driver).

thaynes
7th September 2011, 20:20
Yep, I am looking to only compile inside of the chroot and then be able to use it outside.

Also, it would appear to be returning the incorrect library,

Inside the chroot (works),


libQtCore.so.4 => /usr/share/qt4/lib/libQtCore.so.4 (0xf742c000)
libQtSql.so.4 => /usr/share/qt4/lib/libQtSql.so.4 (0xf73ef000)
libQtGui.so.4 => /usr/share/qt4/lib/libQtGui.so.4 (0xf6a51000)
libQtNetwork.so.4 => /usr/share/qt4/lib/libQtNetwork.so.4 (0xf693b000)
libQtXml.so.4 => /usr/share/qt4/lib/libQtXml.so.4 (0xf68f8000)


Outside the chroot (does not work)


libQtCore.so.4 => /chroot/usr/lib/libQtCore.so.4 (0xf7441000)
libQtSql.so.4 => /chroot/usr/lib/libQtSql.so.4 (0xf7404000)
libQtGui.so.4 => /chroot/usr/lib/libQtGui.so.4 (0xf6a66000)
libQtNetwork.so.4 => /chroot/usr/lib/libQtNetwork.so.4 (0xf6950000)
libQtXml.so.4 => /chroot/usr/lib/libQtXml.so.4 (0xf690c000)


What I believe I need is to have the application outside of the chroot link to the libraries found in /chroot/usr/share/qt4/lib rather than /chroot/usr/lib/

I will change the Environment Variables governing this and see if that fixes the issue.

Thanks!

thaynes
7th September 2011, 22:31
I'm a bit unclear on how shared library dependencies work and having trouble linking the application to the correct libraries. Is there a way to manually link them? Also, how are the libraries chosen? Some linked are not from directories listed in LD_LIBRARY_PATH. Adding some directories to this environment variable change the links while others do not.

ChrisW67
7th September 2011, 22:39
QSqlDatabase: QPSQL driver not loaded
QSqlDatabase: available drivers:

When you are in your 64-bit environment the 32-bit application cannot find a 32-bit Qt SQL plugin for Postgres to load (or any others, e.g. Sqlite, by the look of it). This plugin will also need 32-bit Postgres libraries to be available. The default search path built in to the chrooted 32-bit Qt libraries (/usr/share/qt4/lib/plugins) will probably be still exist in the 64-bit environment but contain 64-bit plugins.