Qt 5.4 + firebird embedded (Linux)
-
hi good evening,
I'm trying to compile the driver for embedded firebird and create a sample application,
I have installed Qt in my home directory (/home/user/Qt) and firebird (FirebirdCS-2.5.3.26778-0.amd64.tar.gz 7 MB) in /opt/firebird with links to the firebird includes in /usr/include, the libs in /opt/firebird/lib
these are the steps I followed:
-
in ~/Qt/5.4/Src/qtbase/src/plugins/sqldrivers/ibase I compiled the ibase driver (libqsqlibase.so) with
~/Qt/5.4/gcc_64/bin/qmake "INCLUDEPATH+=/opt/firebird/include" "LIBS+=-L/opt/firebird/lib" "LIBS+=-lfbembed" ibase.pro;
make;
make install
plugins were generated in ~/Qt/5.4/Src/qtbase/plugins/sqldrivers and ~/Qt/5.4/gcc_64/plugins/sqldrivers -
I copied the drivers in the application directory and in sqldrivers subdirectory with firebird files (aliases.conf firebird.msg libfbembed.so libfbembed.so.2.5.4 libicudata.so libicudata.so.30.0 libicui18n. so.30 libicuuc.so libicuuc.so.30.0 firebird.conf libfbembed.so.2.5 libib_util.so libicudata.so.30 libicui18n.so libicui18n.so.30.0 libqsqlibase.so libicuuc.so.30) also copied the folders and UDF intl
-
in the .pro file I added QT + = SQL
-
the main.cpp has #include <QSqlDatabase> and qDebug() << QApplication::libraryPaths(); qDebug() << QSqlDatabase::drivers();
when I call bd = QSqlDatabase :: addDatabase ("QIBASE"); answer back
QSqlDatabase: QIBASE driver not loaded
QSqlDatabase: available drivers: QIBASE QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7qDebug() << bd.lastError().text(); answer back "Driver not loaded Driver not loaded"
qDebug() << QApplication::libraryPaths(); answer back ("/home/usuario/Qt/5.4/gcc_64/plugins", "/media/usuario/Documentos/Programacion/Pruebas/Qt/Bases de datos/BD-varias-build-Desktop_Qt_5_4_1_GCC_64bit-Release")
and qDebug() << QSqlDatabase::drivers(); answer back ("QIBASE", "QSQLITE", "QMYSQL", "QMYSQL3", "QPSQL", "QPSQL7")
he firebird download website says it takes glibc> = 2.6 for the classic server and for superclasic but says nothing of embedded, I have the glibc 2.19, that will influence?
as I can run this plugin? I'm doing wrong?
thank you very much,
greetings,
P.D.: sorry for my english by google translator
P.D.2: sorry, I can not find the tag code to insert the main and mainwindow
-
-
Hi,
Something's not clear. Do you have that problem while developing or when you want to deploy your application ?
-
The problem is neither, it just not loading.
To get more information, start your application with the environment variable QT_DEBUG_PLUGINS set to 1
-
hello SGaist,
this is part of the output
QFactoryLoader::QFactoryLoader() looking at "/home/usuario/Qt/5.4/gcc_64/plugins/sqldrivers/libqsqlibase.so" Found metadata in lib /home/usuario/Qt/5.4/gcc_64/plugins/sqldrivers/libqsqlibase.so, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QIBASE" ] }, "className": "QIBaseDriverPlugin", "debug": false, "version": 328705 }
[...]
QFactoryLoader::QFactoryLoader() looking at "/media/usuario/Documentos/Programacion/Pruebas/Qt/Bases de datos/BD-varias-build-Desktop_Qt_5_4_1_GCC_64bit-Debug/sqldrivers/libqsqlibase.so" Found metadata in lib /media/usuario/Documentos/Programacion/Pruebas/Qt/Bases de datos/BD-varias-build-Desktop_Qt_5_4_1_GCC_64bit-Debug/sqldrivers/libqsqlibase.so, metadata= { "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface", "MetaData": { "Keys": [ "QIBASE" ] }, "className": "QIBaseDriverPlugin", "debug": false, "version": 328705 }
[...]
loaded library "/home/usuario/Qt/5.4/gcc_64/plugins/sqldrivers/libqsqlibase.so" QLibraryPrivate::loadPlugin failed on "/home/usuario/Qt/5.4/gcc_64/plugins/sqldrivers/libqsqlibase.so" : "Cannot load library /home/usuario/Qt/5.4/gcc_64/plugins/sqldrivers/libqsqlibase.so: (libfbembed.so.2.5: no se puede abrir el archivo del objeto compartido: No existe el archivo o el directorio)" QSqlDatabase: QIBASE driver not loaded
libqsqlibase.so load plugin says failed to open shared object file, there is no file or directory, referring to libfbembed.so.2.5, but libfbembed.so.2.5 library exists in the application directory and directories plugins
look at these lines
in these lines "QLoaderFactory" processes the library libfbembedQFactoryLoader::QFactoryLoader() looking at "/media/usuario/Documentos/Programacion/Pruebas/Qt/Bases de datos/BD-varias-build-Desktop_Qt_5_4_1_GCC_64bit-Debug/sqldrivers/libfbembed.so" "Plugin verification data mismatch in '/media/usuario/Documentos/Programacion/Pruebas/Qt/Bases de datos/BD-varias-build-Desktop_Qt_5_4_1_GCC_64bit-Debug/sqldrivers/libfbembed.so.2.5.4'" not a plugin QFactoryLoader::QFactoryLoader() looking at "/media/usuario/Documentos/Programacion/Pruebas/Qt/Bases de datos/BD-varias-build-Desktop_Qt_5_4_1_GCC_64bit-Debug/sqldrivers/libfbembed.so.2.5" "Plugin verification data mismatch in '/media/usuario/Documentos/Programacion/Pruebas/Qt/Bases de datos/BD-varias-build-Desktop_Qt_5_4_1_GCC_64bit-Debug/sqldrivers/libfbembed.so.2.5.4'" not a plugin QFactoryLoader::QFactoryLoader() looking at "/media/usuario/Documentos/Programacion/Pruebas/Qt/Bases de datos/BD-varias-build-Desktop_Qt_5_4_1_GCC_64bit-Debug/sqldrivers/libfbembed.so.2.5.4" "Plugin verification data mismatch in '/media/usuario/Documentos/Programacion/Pruebas/Qt/Bases de datos/BD-varias-build-Desktop_Qt_5_4_1_GCC_64bit-Debug/sqldrivers/libfbembed.so.2.5.4'" not a plugin
thank you very much,
greetings,
-
What does
ldd libqsqlibase.so
return ? -
libfbembed.so.2.5 => not found -- ¿?¿?¿?¿?
but...# ls libfbembed.so.2.5 libqsqlite.so libqsqlpsql.so libqsqlibase.so libqsqlmysql.so
linux-vdso.so.1 => (0x00007fff7530d000) libfbembed.so.2.5 => not found libQt5Sql.so.5 => /home/usuario/Qt/5.4/gcc_64/lib/libQt5Sql.so.5 (0x00007f5302855000) libQt5Core.so.5 => /home/usuario/Qt/5.4/gcc_64/lib/libQt5Core.so.5 (0x00007f5302119000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f5301e0a000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f5301b03000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f530173f000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f5301521000) libicui18n.so.53 => /home/usuario/Qt/5.4/gcc_64/lib/libicui18n.so.53 (0x00007f53010d4000) libicuuc.so.53 => /home/usuario/Qt/5.4/gcc_64/lib/libicuuc.so.53 (0x00007f5300d49000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f5300b45000) libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f5300942000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f530073a000) libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f530042b000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f5300213000) /lib64/ld-linux-x86-64.so.2 (0x00007f5302cd1000) libicudata.so.53 => /home/usuario/Qt/5.4/gcc_64/lib/libicudata.so.53 (0x00007f52feb8b000) libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f52fe91d000)
but if I copy
cp libfbembed.so.2.5 /home/usuario/Qt/5.4/gcc_64/lib/ libfbembed.so.2.5 => /home/usuario/Qt/5.4/gcc_64/lib/libfbembed.so.2.5 (0x00007f95e95eb000)
the problem is largely solved, however, does not care if the lib is in the directory of the application, how can I fix this? because the intention is to distribute the application
thank you very much SGaist.
greetings,
-
How do you intend to distribute your application ? Custom package ? Using the distributions package manager ?
-
Hello SGaist,
at first I'm going to distribute it as .deb, .rpm and .msi, but if libqsqlibase.so requires libfbembed.so.2.5 is located in /home/usuario/Qt/5.4/gcc_64/lib/, if I set the deb and rpm so that the library installed in /usr/local/lib /usr/lib or in the application directory, I'll have the same problem
thank you.
greetings,
-
Then add firebird as a dependency of your package so you don't have to worry about installing it.