[odb-users] libodb-mysql.so Undefined Reference to 'THR_KEY_msys'

Boris Kolpackov boris at codesynthesis.com
Fri Jun 8 11:22:19 EDT 2012


Hi Alex,

Alex Hurd <hurdad at gmail.com> writes:

> libodb-2.0.0 + libodb-mysql-2.0.0 + Fedora 16 + mysqlclient.so.18
> 
> Compiling and installing libodb and libodb-mysql works fine.
> 
> However, when linking I get the following error:
> 
> $ ld -lodb-mysql
> ld: warning: cannot find entry symbol _start; not setting start address
> /usr/local/lib/libodb-mysql.so: undefined reference to `THR_KEY_mysys'

I did some investigating and here is the story: THR_KEY_mysys is a global
variable in libmysqlclient that contains the thread-specific storage key
that is used my MySQL. We use this key to work around some issues in
trying to handle MySQL per-thread initialization/termination automatically
and transparently (for the gory details, see the long comment at the
beginning of the connection-factory.cxx file).

This works well ith the vanilla build of the libmysqlclient library.
However, Fedora folks did some customizations to the build procedure.
Specifically, they limited the number of symbols that are visible form
the library. They only included the public interface plus some internal
functions used by other software (e.g., PHP).
 
> This variable is used in 'connection-factory.hxx' but I don't understand
> how it would compile and get the error during runtime.

Shared libraries can have undefined symbols. However, we pass the 
--no-undefined option to libtool to make sure this doesn't happen.
So this is strange.

In any case, I've come up with a workaround for the missing symbols. Can
you give this package a try:

http://www.codesynthesis.com/~boris/tmp/odb/libodb-mysql-2.0.1.tar.bz2

Let me know if it works for you and I will make an official bugfix. I am
also going to file a bug report with Fedora to see if we can add this
symbol to the export list.

And thanks for reporting this!

Boris



More information about the odb-users mailing list