Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 76745 - mysql and QSqlDatabase: driver not loaded although build with USE=mysql
Summary: mysql and QSqlDatabase: driver not loaded although build with USE=mysql
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: High major
Assignee: Gentoo KDE team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-05 03:02 UTC by Olaf Leidinger
Modified: 2005-01-24 09:01 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olaf Leidinger 2005-01-05 03:02:11 UTC
It seems as if Qt can't load its mysql plugin although it is located in /usr/qt/3/plugins/sqldrivers

ls -l /usr/qt/3/plugins/sqldrivers/
insgesamt 260
-rw-r--r--  1 root root 264188  5. Jan 09:56 libqsqlmysql.so

I also added this path to lib paths in qtconfig.

Running mythtv or qsql (small app from http://www.mobiustech.net/qtsql) I get:

QSqlDatabase:  driver not loaded
QSqlDatabase: available drivers:

This happens with qt-3.3.* ; can't emerge qt-3.2 due fontconfig, but this is another story...



Reproducible: Always
Steps to Reproduce:
1. emerge qt with USE=mysql
2. test it with QtSQL from http://www.mobiustech.net/qtsql/




[ebuild     U ] x11-libs/qt-3.3.3 [3.3.2] +cups -debug +doc -firebird +gif -icc 
-immqt -immqt-bc +ipv6 +mysql +nas -odbc +opengl -postgres -sqlite +xinerama 
+zlib 0 kB

[ebuild   R   ] dev-db/mysql-4.0.22  +berkdb -debug -innodb +perl +readline (-
selinux) +ssl -static +tcpd 0 kB
Comment 1 Caleb Tennis (RETIRED) gentoo-dev 2005-01-05 07:01:48 UTC
When you run qtconfig, does it list a path to the sql driver?
Comment 2 Olaf Leidinger 2005-01-05 07:58:31 UTC
qtconfig shows the following lib paths (running as root):

/usr/kde/3.3/lib/kde3/plugins
/root/.kde/lib/kde3/plugins
/usr/qt/3/plugins/sqldriver
/usr/qt/3/plugins
/usr/qr/3/bin

I added /usr/qt/3/plugins/sqldriver afterwards, but it doesn't change anything.
Comment 3 Olaf Leidinger 2005-01-05 08:06:07 UTC
This link also sais something about the possible bug (concerning qt-3.1):

http://www.gossamer-threads.com/lists/mythtv/dev/1110#1110

> I too have a problem with qt-3.1.0 - no way I can get it to load the 
> qsql drivers, <b>even though the plugin library is compiled.</b>

> However the above approach with the mysql USE flag did solve my problem 
> with qt-3.0.x
Comment 4 graham madarasz 2005-01-09 17:22:53 UTC
I get the same problem with both qt-3-3-3-r1 and qt-3.2.3-r1.
The qt libraryPath has /usr/qt/3/plugins/sqldrivers in it
and libqsqlmysql.o is built correctly and in that directory.
Qt just refuses to dynamically load the plugin.
Comment 5 graham madarasz 2005-01-09 20:17:29 UTC
...qt-3.3.3...same problem.
Comment 6 Caleb Tennis (RETIRED) gentoo-dev 2005-01-10 04:47:03 UTC
Does an 'ldd' on the libmysqlclient.so show any unresolved library dependencies?
Comment 7 Greg Gilbert 2005-01-10 11:26:02 UTC
This looks like it might be a related problem. On the machine I'm running into this problem, the mysql libraries are all in /usr/lib/mysql, while on another machine the libraries are in /usr/lib.

http://bugs.gentoo.org/show_bug.cgi?id=75548
Comment 8 Caleb Tennis (RETIRED) gentoo-dev 2005-01-10 12:10:45 UTC
Perhaps a rerun of "ldconfig" (as root) will then then?
Comment 9 Olaf Leidinger 2005-01-10 13:03:51 UTC
libmysqlclient is placed in /usr/lib on my system and there are no undefined deps:

ldd /usr/lib/libmysqlclient.so
        linux-gate.so.1 =>  (0xffffe000)
        libz.so.1 => /lib/libz.so.1 (0x4fd03000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x418d1000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x410d2000)
        libm.so.6 => /lib/libm.so.6 (0x4fbdd000)
        libssl.so.0.9.7 => /usr/lib/libssl.so.0.9.7 (0x415ae000)
        libcrypto.so.0.9.7 => /usr/lib/libcrypto.so.0.9.7 (0x415e8000)
        libc.so.6 => /lib/libc.so.6 (0x4fac8000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
        libdl.so.2 => /lib/libdl.so.2 (0x4fc01000)


 ls -l /usr/lib/mysql/
insgesamt 6260
-rw-r--r--  1 root root   15074  5. Jan 11:00 libdbug.a
-rw-r--r--  1 root root   38466  5. Jan 11:00 libheap.a
-rw-r--r--  1 root root   15588  5. Jan 11:00 libmerge.a
-rw-r--r--  1 root root  311846  5. Jan 11:00 libmyisam.a
-rw-r--r--  1 root root   26910  5. Jan 11:00 libmyisammrg.a
-rw-r--r--  1 root root  376902  5. Jan 11:00 libmysqlclient.a
-rwxr-xr-x  1 root root     888  5. Jan 11:00 libmysqlclient.la
-rw-r--r--  1 root root  386184  5. Jan 11:00 libmysqlclient_r.a
-rwxr-xr-x  1 root root     917  5. Jan 11:00 libmysqlclient_r.la
lrwxrwxrwx  1 root root      22  5. Jan 11:00 libmysqlclient_r.so -> ../libmysqlclient_r.so
lrwxrwxrwx  1 root root      20  5. Jan 11:00 libmysqlclient.so -> ../libmysqlclient.so
-rw-r--r--  1 root root 4652490  5. Jan 11:00 libmysqld.a
-rw-r--r--  1 root root  145844  5. Jan 11:00 libmystrings.a
-rw-r--r--  1 root root  269376  5. Jan 11:00 libmysys.a
-rw-r--r--  1 root root  121532  5. Jan 11:00 libnisam.a
-rw-r--r--  1 root root   16966  5. Jan 11:00 libvio.a


After calling ldconfig I get the same error ;-(
Comment 10 Caleb Tennis (RETIRED) gentoo-dev 2005-01-10 13:05:11 UTC
I meant run the ldd on the plugin installed by Qt, in /usr/qt/3/plugins...
Comment 11 Olaf Leidinger 2005-01-10 13:11:41 UTC
There are also no unresolved deps:

ldd /usr/qt/3/plugins/sqldrivers/libqsqlmysql.so
        linux-gate.so.1 =>  (0xffffe000)
        libqt-mt.so.3 => /usr/qt/3/lib/libqt-mt.so.3 (0xb78a0000)
        libmng.so.1 => /usr/lib/libmng.so.1 (0xb7823000)
        libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0xb77fd000)
        libpng.so.3 => /usr/lib/libpng.so.3 (0xb77c7000)
        libz.so.1 => /lib/libz.so.1 (0xb77b4000)
        libXi.so.6 => /usr/X11R6/lib/libXi.so.6 (0xb77ac000)
        libXrender.so.1 => /usr/X11R6/lib/libXrender.so.1 (0xb77a4000)
        libXrandr.so.2 => /usr/X11R6/lib/libXrandr.so.2 (0xb77a0000)
        libXcursor.so.1 => /usr/X11R6/lib/libXcursor.so.1 (0xb7796000)
        libXinerama.so.1 => /usr/X11R6/lib/libXinerama.so.1 (0xb7793000)
        libXft.so.2 => /usr/X11R6/lib/libXft.so.2 (0xb777e000)
        libfreetype.so.6 => /usr/X11R6/lib/libfreetype.so.6 (0xb7712000)
        libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0xb76e7000)
        libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0xb76d5000)
        libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0xb75ee000)
        libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0xb75e5000)
        libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0xb75cd000)
        libdl.so.2 => /lib/libdl.so.2 (0xb75ca000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xb7579000)
        libstdc++.so.6 => /usr/lib/gcc-lib/i686-pc-linux-gnu/3.4.2/libstdc++.so.6 (0xb74a6000)
        libm.so.6 => /lib/libm.so.6 (0xb7484000)
        libgcc_s.so.1 => /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/libgcc_s.so.1 (0xb747b000)
        libc.so.6 => /lib/libc.so.6 (0xb7367000)
        libaudio.so.2 => /usr/X11R6/lib/libaudio.so.2 (0xb7352000)
        libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0xb72f5000)
        libexpat.so.0 => /usr/X11R6/lib/libexpat.so.0 (0xb72d7000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
        libXau.so.6 => /usr/X11R6/lib/libXau.so.6 (0xb72d3000)

I also added /usr/lib/mysql to /etc/ld.so.conf - no effect.
Comment 12 Caleb Tennis (RETIRED) gentoo-dev 2005-01-10 13:16:51 UTC
On my machine, it links against mysql:

       linux-gate.so.1 =>  (0xffffe000)
       libmysqlclient.so.12 => /usr/lib/libmysqlclient.so.12 (0x4001c000)
       libqt-mt.so.3 => /usr/qt/3/lib/libqt-mt.so.3 (0x4005c000)

Looks like yours doesn't.
Comment 13 Caleb Tennis (RETIRED) gentoo-dev 2005-01-10 13:24:35 UTC
yep, looks the same as 75548 - will have to make modifications to Qt ebuild so it can find the libraries at compile time
Comment 14 Olaf Leidinger 2005-01-10 13:37:15 UTC
Strange - but why does the qt-plugin build if it doesn't find the lib?!?

Please let me know when your ebuild is testable ;-)
Comment 15 Caleb Tennis (RETIRED) gentoo-dev 2005-01-10 13:38:18 UTC
as a test, perhaps you can modify your ebuild so that the line that has "use mysql && myconf=${myconf}..." uses /usr/lib/mysql instead of /usr/lib.  

Re-emerge Qt and see if that fixes it
Comment 16 Olaf Leidinger 2005-01-10 14:54:14 UTC
Recent qt ebuilds now contain the patch you wanted me to do. Now I get something like:

QSqlDatabase:  driver not loaded
QSqlDatabase: available drivers: QMYSQL3 QSQLITE

And 
 ldd /usr/qt/3/plugins/sqldrivers/libqsqlmysql.so
ldd: warning: you do not have execution permission for `/usr/qt/3/plugins/sqldrivers/libqsqlmysql.so'
        linux-gate.so.1 =>  (0xffffe000)
        libmysqlclient.so.12 => /usr/lib/libmysqlclient.so.12 (0xb7f94000)
        libqt-mt.so.3 => /usr/qt/3/lib/libqt-mt.so.3 (0xb78a4000)
...

But when I do a 

chmod a+x /usr/qt/3/plugins/sqldrivers/libqsqlmysql.so

it seems to work (at least I can connect to the db using qtsql)
Comment 17 graham madarasz 2005-01-10 22:49:39 UTC
As best I can tell, mysql-4.0.23 screws up the install and makes
lib files which are missing the .so extension. This screws up the
mv'ing and symlinking of same files from /usr/lib which cascades
into Qt not finding the libs etc...

in /usr/lib/mysql:

lrwxrwxrwx  1 root root      21 Jan 10 21:50 libmysqlclient -> libmysqlclient.12.0.0
lrwxrwxrwx  1 root root      21 Jan 10 21:50 libmysqlclient.12 -> libmysqlclient.12.0.0
-rwxr-xr-x  1 root root  256388 Jan 10 21:50 libmysqlclient.12.0.0
-rw-r--r--  1 root root  350998 Jan 10 21:50 libmysqlclient.a
-rwxr-xr-x  1 root root     879 Jan 10 21:50 libmysqlclient.la
lrwxrwxrwx  1 root root      23 Jan 10 21:50 libmysqlclient_r -> libmysqlclient_r.12.0.0
lrwxrwxrwx  1 root root      23 Jan 10 21:50 libmysqlclient_r.12 -> libmysqlclient_r.12.0.0
-rwxr-xr-x  1 root root  264004 Jan 10 21:50 libmysqlclient_r.12.0.0
rm 

mysql-4.0.22 gets it right and then qt-3.3.3-r1 is good to go.
 
Comment 18 Gregorio Guidi (RETIRED) gentoo-dev 2005-01-16 08:35:14 UTC
comment 17 is related to bug 75524, which is fixed now.
comment 16, instead, suggest that the solution is just to patch the ebuild
this way:

        plugins=`find plugins -name "lib*.so" -print`
        for x in $plugins; do
-               insinto ${QTBASE}/`dirname $x`
-               doins $x
+               into ${QTBASE}/`dirname $x`
+               dolib.so $x

ok to push out qt-3.3.3-r3 with this fix?
Comment 19 Caleb Tennis (RETIRED) gentoo-dev 2005-01-22 15:50:56 UTC
Yes Greg, also if you want to fix the gif dep in the same revbump, and possibly include the proposed enhancement patches that would be great.
Comment 20 Gregorio Guidi (RETIRED) gentoo-dev 2005-01-24 09:01:20 UTC
Should be fixed in qt-3.3.3-r3.