Bug #34025 mysql_config is not returning -ldl lib flag needed when using embedded server
Submitted: 23 Jan 2008 22:31 Modified: 8 Dec 2008 23:27
Reporter: Jonathan Miller Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Packaging Severity:S3 (Non-critical)
Version:5.1-mysql OS:Linux (non icc and Solaris 9)
Assigned to: Tatiana Azundris Nuernberg CPU Architecture:Any

[23 Jan 2008 22:31] Jonathan Miller
Description:
Hi,

When trying to embed the server into an application, I got the following error:

/data0/cr_autotest/lib/mysql//libmysqld.a(sql_udf.o)(.text+0xe6b):/data0/acrt-clones/clone-mysql-5.1-telco-6.2-2008-01-22.30353/libmysqld/sql_udf.cc:445: undefined reference to `dlopen'
/data0/cr_autotest/lib/mysql//libmysqld.a(sql_udf.o)(.text+0xe87):/data0/acrt-clones/clone-mysql-5.1-telco-6.2-2008-01-22.30353/libmysqld/sql_udf.cc:449: undefined reference to `dlerror'
/data0/cr_autotest/lib/mysql//libmysqld.a(sql_udf.o)(.text+0x1159): In function `mysql_drop_function(THD*, st_mysql_lex_string const*)':
/data0/acrt-clones/clone-mysql-5.1-telco-6.2-2008-01-22.30353/libmysqld/sql_udf.cc:554: undefined reference to `dlclose'

looking at mysql_config, it does not include the needed -ldl flag.

./mysql_config --libmysqld-libs 
-rdynamic -L/data0/cr_autotest/lib/mysql -lmysqld -lz -lpthread -lcrypt -lnsl -lm -lpthread -lrt

How to repeat:
Build 5.1 using --with-embedded-server

run  mysql_config --libmysqld-libs

Suggested fix:
mysql_config --libmysqld-libs should also return -ldl when clone has been built using embedded server.
[30 Jan 2008 14:51] Jonathan Miller
Work around would be to append -ldl to the $LIB make varaible
[10 Nov 2008 21:17] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/58384

2705 Tatiana A. Nurnberg	2008-11-10
      Bug#34025: mysql_config is not returning -ldl lib flag needed when using embedded server
      
      mysql_config did not output -ldl (or equivalent) when needed for --libmysqld-libs,
      so its output could be insufficient to build an application using the embedded
      server.
      
      LIBDL was already set in configure; it's now propagated all the way into the
      relevant mysql_config scripts.
[10 Nov 2008 21:23] Tatiana Azundris Nuernberg
This should fix the building of programs using the embedded server
in that sql_udf should no longer give unresolved symbols. You still
can't have UDFs, though. Because

http://dev.mysql.com/doc/refman/5.1/en/libmysqld-restrictions.html

sez you can't. ;)
[26 Nov 2008 3:46] Tatiana Azundris Nuernberg
Patch queued in 5.1-bugteam for 5.1.31 on 2008/11/10,
[26 Nov 2008 4:34] Tatiana Azundris Nuernberg
Patch queued in 6.0-bugteam for 6.0.9 on 2008/11/10.
[8 Dec 2008 10:23] Bugs System
Pushed into 5.1.31  (revid:azundris@mysql.com-20081110211215-zrlgml502yv7xk3s) (version source revid:azundris@mysql.com-20081110211215-zrlgml502yv7xk3s) (pib:5)
[8 Dec 2008 11:33] Bugs System
Pushed into 6.0.9-alpha  (revid:azundris@mysql.com-20081110211215-zrlgml502yv7xk3s) (version source revid:ingo.struewing@sun.com-20081121151447-dtf2ofz2ys0zqed1) (pib:5)
[8 Dec 2008 23:27] Paul DuBois
Noted in 5.1.31, 6.0.9 changelogs.

mysql_config did not output -ldl (or equivalent) when needed for
--libmysqld-libs, so its output could be insufficient to build 
applications that use the embedded server.
[19 Jan 2009 11:31] Bugs System
Pushed into 5.1.31-ndb-6.2.17 (revid:tomas.ulin@sun.com-20090119095303-uwwvxiibtr38djii) (version source revid:tomas.ulin@sun.com-20090108105244-8opp3i85jw0uj5ib) (merge vers: 5.1.31-ndb-6.2.17) (pib:6)
[19 Jan 2009 13:09] Bugs System
Pushed into 5.1.31-ndb-6.3.21 (revid:tomas.ulin@sun.com-20090119104956-guxz190n2kh31fxl) (version source revid:tomas.ulin@sun.com-20090119104956-guxz190n2kh31fxl) (merge vers: 5.1.31-ndb-6.3.21) (pib:6)
[19 Jan 2009 16:14] Bugs System
Pushed into 5.1.31-ndb-6.4.1 (revid:tomas.ulin@sun.com-20090119144033-4aylstx5czzz88i5) (version source revid:tomas.ulin@sun.com-20090119144033-4aylstx5czzz88i5) (merge vers: 5.1.31-ndb-6.4.1) (pib:6)