LINUX.ORG.RU

Qt и PostgreSQL


0

0

Вообщем распаковал исходники Qt, зашел в плагин pgsql, сделал qmake "INCLUDEPATH+=/usr/local/pgsql/include" "LIBS+=-L/usr/local/pgsql/lib -lpq" psql.pro
make
появился libqsqlpsql.so
make install
install -m 755 -p "libqsqlpsql.so" "/usr/lib/qt/plugins/sqldrivers/libqsqlpsql.so"
strip --strip-unneeded "/usr/lib/qt/plugins/sqldrivers/libqsqlpsql.so"

при попытке запустить откомпиленный проект. ругается
./postgreconn
QSqlDatabase: QPSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL3 QMYSQL

Пути: QT_PLUGIN_PATH=/root/.kde/lib/kde4/plugins/:/usr/lib/kde4/plugins/:/usr/lib/qt/ plugins/sqldrivers:/usr/local/pgsql/lib

заголовки:
#include <QtDebug>
#include <QtGui>
#include <QSqlDatabase>
#include <QSqlQueryModel>
#include <QSqlError>

★★★★★

You should always use client libraries that have been compiled with the same compiler as you are using for your project. If you cannot get a source distibution to compile the client libraries yourself, you must make sure that the pre-compiled library is compatible with your compiler, otherwise you will get a lot of "undefined symbols" errors. Some compilers have tools to convert libraries, e.g. Borland ships the tool COFF2OMF.EXE to convert libraries that have been generated with Microsoft Visual C++.

If the compilation of a plugin succeeds but it cannot be loaded, make sure that the following requirements are met:

Ensure that you are using a shared Qt library; you cannot use the plugins with a static build. Ensure that the plugin is in the correct directory. You can use QApplication::libraryPaths() to determine where Qt looks for plugins. Ensure that the client libraries of the DBMS are available on the system. On Unix, run the command ldd and pass the name of the plugin as parameter, for example ldd libqsqlmysql.so. You will get a warning if any of the client libraries couldn't be found. On Windows, you can use Visual Studio's dependency walker. Compile Qt with QT_DEBUG_COMPONENT defined to get very verbose debug output when loading plugins.

shutty
()
Ответ на: комментарий от shutty

ldd /usr/lib/qt/plugins/sqldrivers/libqsqlpsql.so

linux-gate.so.1 =>(0xffffe000) libpq.so.5=>notfound libQtSql.so.4 => /usr/lib/qt/lib/libQtSql.so.4 (0xb7e76000)
...
Прописал путь в /etc/ld.so.conf
сделал ldconfig
При запуске программы та же ошибка.

splinter ★★★★★
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.