Unsolved can not load libqsqlodbc.so build with unixODBC
-
hi
every one,
I need to connect mssqlserver,then I find a way by using unixODBC and freetds.
I installed qt4.8.7 on my ubuntu.
frist I dowload qt-ererywhere-opensource-src-4.7.8 and unixODBC-2.3.2. then I enter unixODBC directory,execute"./configure --prefix=/usr/local/unixODBC",
"make",
"makeinstall",no error found .
Next I enter "~/qt-everywhere-opensource-src-4.7.8/src/plugins/sqldrivers/odbc",executeqmake "INCLUDEPATH+=/usr/local/unixODBC/include" "LIBS+=-L/usr/local/unixODBC/lib -lodbc" odbc.pro
make ,
make install,no error found the same, and /usr/lib/i386-linux-gnu/qt4/plugins/sqldrivers/libqsqlodbc.so generated. but when I try to load load the odbc in my library with code below:
QStringList strList = QSqlDatabase::drivers();
qDebug()<<strList;only ("QSQLITE") was printed.
and if I build the odbc without lodbc,justqmake "INCLUDEPATH+=/usr/local/unixODBC/include"odbc.pro
("QSQLITE","QOBDC3","QODBC") was print,
when I try to open the QSqlDatabase,error print belowsymbol lookup error: /usr/lib/i386-linux-gnu/qt4/plugins/sqldrivers/libqsqlodbc.so: undefined symbol: SQLAllocHandle
I am stuck here for two days ,Is any body can help me ,thanks.
-
Hi, I think you need to rebuild libqsqlodbc.so with that -lodbc switch, for example see here
-
@hskoglund
I had try this by add option to qmake
qmake "INCLUDEPATH+=/usr/local/unixODBC/include" "LIBS+=-L/usr/local/unixODBC/lib -lodbc" odbc.pro
by this way , QSqlDatabase::drivers() can not find "QODBC",only "QSQLITE" is Found.