Bug #64577 Undefined Symbol in libmyodbc5
Submitted: 7 Mar 2012 6:21 Modified: 8 Jun 2012 10:09
Reporter: Travis DePrato Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:myodbc5 OS:Linux (Debian 6)
Assigned to: Bogdan Degtyariov CPU Architecture:Any
Tags: dynstr_append_mem, libmyodbc, linux, myodbc5, symbol

[7 Mar 2012 6:21] Travis DePrato
Description:
Attempting to connect with ODBC (using iODBC) to produces the error:

Driver Manager: 03.52.0709.0909
1: SQLDriverConnect = [iODBC][Driver Manager]/usr/local/lib/libmyodbc5.so: undefined symbol: dynstr_append_mem (0) SQLSTATE=00000
2: SQLDriverConnect = [iODBC][Driver Manager]Specified driver could not be loaded (0) SQLSTATE=IM003

Using iODBC with Debian 6, mysql  Ver 14.14 Distrib 5.5.21, for Linux (x86_64) using readline 5.1, all built from source

How to repeat:
Run the command iodbctest ["DSN=myodbc"]
[7 Mar 2012 9:43] Bogdan Degtyariov
Hi Travis,

What is the exact version of Connector/ODBC 5.1 driver you are using? is it the latest version 5.1.10?
[7 Mar 2012 13:45] Travis DePrato
Yes, I downloaded it from the MySQL website yesterday.
[8 Mar 2012 4:28] Bogdan Degtyariov
That is strange, the missing symbol (dynstr_append_mem) is the internal function defined in mysql client library, which is statically linked to the driver (the code is embedded into libmyodbc5.so).

It can be easily checked using nm command:

$  nm /home/dbs/app/mysql-connector-odbc-5.1.10-linux-glibc2.3-x86-64bit/lib/libmyodbc5.so | grep dynstr_append_mem
0000000000077260 T dynstr_append_mem

As you can see the symbol is located in the Text (code) segment of the shared library.

I can think only of one scenario when dynstr_append_mem() is not found: you built it from the sources and mysql lib directory had only libmysqlclient.so (shared library). Hence, the driver built in such way depends on libmysqlclient.so. Our release driver has no such dependence because as I mentioned before, the mysql client lib functions are embedded into the driver shared library.

Please confirm whether you use the release driver binaries or your own built ones.

Also, please send the output from the following commands:

nm libmyodbc5.so | grep dynstr_append_mem

ldd libmyodnc5.so

Thanks.
[8 Mar 2012 4:32] Bogdan Degtyariov
I see your comment about all built from source, but it does not say anything about ODBC Driver:

> Using iODBC with Debian 6, mysql  Ver 14.14 Distrib 5.5.21, for 
> Linux (x86_64) using readline 5.1, all built from source

If the driver is built from source as well you need to relink it using the static mysqlclient library. Make sure the threadsafe version is present in the lib directory: libmysqlclient_r.a
[9 Apr 2012 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[30 May 2012 9:24] Frank Oosterhuis
nm libmyodbc5.so | grep dynstr_append_mem
         U dynstr_append_mem

ldd libmyodbc5.so 
	linux-gate.so.1 =>  (0xffffe000)
	libiodbc.so.2 => /usr/lib/libiodbc.so.2 (0xb76af000)
	libiodbcinst.so.2 => /usr/lib/libiodbcinst.so.2 (0xb769b000)
	libmysqlclient.so.18 => /usr/lib/libmysqlclient.so.18 (0xb73bf000)
	libpthread.so.0 => /lib/libpthread.so.0 (0xb73a4000)
	libm.so.6 => /lib/libm.so.6 (0xb7378000)
	libdl.so.2 => /lib/libdl.so.2 (0xb7373000)
	libc.so.6 => /lib/libc.so.6 (0xb7206000)
	libz.so.1 => /lib/libz.so.1 (0xb71ee000)
	libssl.so.1.0.0 => /lib/libssl.so.1.0.0 (0xb7197000)
	libcrypto.so.1.0.0 => /lib/libcrypto.so.1.0.0 (0xb6ff7000)
	libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1 (0xb6fd8000)
	/lib/ld-linux.so.2 (0xb776d000)
[8 Jun 2012 10:09] Bogdan Degtyariov
This bug is about the same issue described in another report:
http://bugs.mysql.com/bug.php?id=65509

ldd shows dependance on libmysqlclient.so.18. This is not right
for MySQL ODBC driver, which should link the static library.

I am afraid the MySQL driver in Ubuntu distributions is built
faulty from the beginning. Depending on shared libmysqlclient
is the potential source of compatibility issues (such as the
current case). That is why in the official MySQL 
Connector/ODBC distributions we link the driver statically 
and prevent the problem from happening.

This is not our bug, the error is in Ubuntu build process.