View Full Version : general sqlplugin problem

22nd February 2006, 12:50
I get a problem compiling self-made sqlplugin on linux.
I want to use third-party library(ibpp 2.4) but can't link it to my
plugin properly.
i've tried to link it as a shared object (so):

1. in case plugin compiled with gcc 2.95, ibpp compiled with gcc 3.2,
only ibpp interface header included in plugin: plugin is being
recognized by qt, but i get "unresolved depednedcy" error on every
function calls from libibpp.so
2. in case both compiled with 3.2, plugin isnt being recognized at all

i've also tried to include ibpp's source code:

3. in case i include ibpp's source code and compile plugin with gcc
3.2, plugin isnt being recognized too.

p.s. - facts
1. i have gcc 2.95 on my os and have no ability to upgrade it; just
install additionaly instances and use it by temporary modifying of
PATH environment variable
2. ibpp requires gcc 3.2

22nd February 2006, 13:12
How did you compile that plugin? And what does ldd say when you point it to your plugin? Does it give you any "not founds"?

22nd February 2006, 19:33
Plugin is compiled right way. I tested it step-by-step, starting with empty example (QNullDriver from here -http://doc.trolltech.com/3.3/sql-driver.html), and ending full(?)-functional version.

At first step it has no ibpp dependency - only QNullDriver. It compiles well and is being recognized by qt.
Next step i add ibpp.h and link to ibpp.so - it's still ok.
Next step i add "IBPP::DatabaseFactory(..)" call to QNullDriver::QNullDriver() constructor and at THIS point my plugin disappears from sqldrivers list. It means problem consists of ibpp - qt-mt interaction.

Moreover, in case i call QSqlDatabase::addDatabase("WRONG-KEY") i get sqlplugins list without my plugin's key. But in case i call with right key ::addDatabase("MYPLUGIN") - QNullDriver's constructor is called and my call to ibpp's DatabaseFactory produces runtime error "unresolved link..." or something like that.
I'm not for sure, but i think i can understand this - libibpp.so compiled with gcc3.2 and my plugin with gcc2.95, this means function signature in libibpp and my plugin may differ.
I take it into account and compile plugin with gcc3.2. In this case it can't be loaded too. One can say i ought to rebuild qt-mt, but i cant. Due to security policy i cant touch libqt-mt.so, i must use given version and have nothing to do with it.

Ldd-ing my plugin gives following:
libibpp.so => /usr/lib/libibpp.so (0x4001a000)
libqt-mt.so.3 => /usr/lib/qt-3.3.3/lib/libqt-mt.so.3 (0x40084000)
libpthread.so.0 => /lib/libpthread.so.0 (0x407b8000)
libstdc++.so.5 => /usr/local/gcc-3.2/lib/libstdc++.so.5 (0x407cb000)
libm.so.6 => /lib/libm.so.6 (0x40841000)
libgcc_s.so.1 => /usr/local/gcc-3.2/lib/libgcc_s.so.1 (0x40860000)
libc.so.6 => /lib/libc.so.6 (0x40869000)
libgds.so => /usr/lib/libgds.so (0x4094e000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x40ac5000)
libdl.so.2 => /lib/libdl.so.2 (0x40af2000)
libXrender.so.1 => /usr/X11R6/lib/libXrender.so.1 (0x40af7000)
libXrandr.so.2 => /usr/X11R6/lib/libXrandr.so.2 (0x40aff000)
libXcursor.so.1 => /usr/X11R6/lib/libXcursor.so.1 (0x40b03000)
libXinerama.so.1 => /usr/X11R6/lib/libXinerama.so.1 (0x40b0c000)
libXft.so.2 => /usr/X11R6/lib/libXft.so.2 (0x40b0f000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x40b21000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x40b93000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x40bbb000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x40bc9000)
libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x40c8c000)
libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x40c96000)
libstdc++-libc6.1-2.so.3 => /usr/lib/libstdc++-libc6.1-2.so.3 (0x40cae000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
libexpat.so.0 => /usr/lib/libexpat.so.0 (0x40cf7000)
libz.so.1 => /usr/lib/libz.so.1 (0x40d19000)

I watch out for "not founds" and can say that's not a reason for my problem.

P.S. If anyone can say that my problem is unsolvable it would be great too. I wasted a week for it and think it's beyond my understanding.

22nd February 2006, 19:43
Could you also post ldd output for yours libibpp.so and libqt-mt.so? Especially the lines which say anything about gcc dependencies.

26th February 2006, 11:15
Here it is:

1. ldd libqt-mt.so

libXrender.so.1 => /usr/X11R6/lib/libXrender.so.1 (0x4073c000)
libXrandr.so.2 => /usr/X11R6/lib/libXrandr.so.2 (0x40744000)
libXcursor.so.1 => /usr/X11R6/lib/libXcursor.so.1 (0x40748000)
libXinerama.so.1 => /usr/X11R6/lib/libXinerama.so.1 (0x40751000)
libXft.so.2 => /usr/X11R6/lib/libXft.so.2 (0x40755000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x40767000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x407d8000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x40800000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x4080e000)
libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x408d1000)
libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x408dc000)
libdl.so.2 => /lib/libdl.so.2 (0x408f4000)
libpthread.so.0 => /lib/libpthread.so.0 (0x408f8000)
libstdc++-libc6.1-2.so.3 => /usr/lib/libstdc++-libc6.1-2.so.3 (0x4090b000)
libm.so.6 => /lib/libm.so.6 (0x40953000)
libc.so.6 => /lib/libc.so.6 (0x40972000)
libexpat.so.0 => /usr/lib/libexpat.so.0 (0x40a58000)
libz.so.1 => /usr/lib/libz.so.1 (0x40a7a000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

2. ldd libibpp.so

libgds.so => /usr/lib/libgds.so (0x400a7000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x4021e000)
libdl.so.2 => /lib/libdl.so.2 (0x4024b000)
libpthread.so.0 => /lib/libpthread.so.0 (0x4024f000)
libstdc++.so.5 => /usr/local/gcc-3.2/lib/libstdc++.so.5 (0x40263000)
libm.so.6 => /lib/libm.so.6 (0x402d8000)
libgcc_s.so.1 => /usr/local/gcc-3.2/lib/libgcc_s.so.1 (0x402f7000)
libc.so.6 => /lib/libc.so.6 (0x40300000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

all in /usr/local/gcc-3.2 are a gcc 3.2.4, all the rest gcc stuff are gcc 2.95

28th February 2006, 10:03
I've build another instance of qt-mt with gcc 3.2 compiler (just for testing) and it recognized my plugin. I fear compiler used for qt-mt version must correspond one version used to compile plugins. If it's right there's no way to solve my problem.