Undefined symbol: SQLAllocHandle
I'm trying to build and run a Qt application on SLES 11 SP 1.
I'm using Qt SDK 1.2 (4.8.0). I've tried installing a newer version of the Qt SDK on SLES 11 SP 1, and it doesn't install (libstdc++ is too old to run the installer for 1.2.1).
So, I've built the Qt ODBC driver located at "QtSDK/QtSources/4.8.0/src/plugins/sqldrivers/odbc" in the 1.2 SDK. I actually compiled it on the machine I'm trying to use it on. That produces a libqsqlodbc.so binary.
When I try to use this driver, I get the following error:
prompt:~ # MyExecutable
prompt:~ # /path/to/MyExecutable: symbol lookup error: /opt/mypath/bin/sqldrivers/libqsqlodbc.so: undefined symbol: SQLAllocHandle
When I do an objdump on libqsqlodbc.so, I see the placeholder for SQLAllocHandle.
prompt:~ # objdump -T /opt/mypath/bin/sqldrivers/libqsqlodbc.so | grep SQLAllocHandle
00000000 D UND 00000000 SQLAllocHandle
And, here's my driver that I'm loading via odbc...
prompt:~ # objdump -T /usr/lib/psqlodbcw.so | grep SQLAllocHandle
00063760 g DF .text 00000142 Base SQLAllocHandle
At least I think I'm loading that thing. It's the only psqlodbc driver installed on the machine. Since the odbc driver is loaded at run time, based on the DSN used, ldd doesn't tell me anything valuable (at least not valuable to my fairly untrained eyes).
My /etc/unixODBC/odbc.ini file only has one DSN defined, and I only have one driver defined in odbcinst.ini. And, the drivers match :)
I have tried using a psqlodbc driver from OpenSuse and I've tried building my own driver from psqlodbc source. Both drivers exhibit this same behavior.
I can't seem to get past this. I'm hoping someone else has run into this.
you can do a cat of memory maps for your process that will tell you, what has been loaded and from where and possibly other info that may be helpful.
That doesn't work on my system.
We solved this problem. It turns out that our app was picking up the wrong version of the odbc library when it was loading.
To resolve it, we added the following to the odbc.pro file when we compiled the qt odbc driver..
LIBS += -L/usr/lib -lodbc
Thank you to pritamghanghas for trying to help. Much appreciated.
actually It was my mistake in last post. I had written pid in tags in between that probably got removed as a unidentified tag.
it should be cat /proc/pid/maps
where pid is the pid of your running application.