Bug #21239 Linking against the embedded server requires -lssl
Submitted: 23 Jul 2006 10:30 Modified: 14 Nov 2006 19:40
Reporter: Hartmut Holzgraefe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Embedded Library ( libmysqld ) Severity:S3 (Non-critical)
Version:4.1, 5.0 OS:
Assigned to: Hartmut Holzgraefe CPU Architecture:Any
Tags: compiling, embedded, linker, mysql_config, SSL

[23 Jul 2006 10:30] Hartmut Holzgraefe
Description:
Linking against libmysqld.a requires -lssl as a linker flag to avoid tons of SSL specific linker errors.

/usr/local/mysql-4.1-nodebug//lib/mysql/libmysqld.a(client.o): In function `mysql_ssl_free':
/home/hartmut/projects/mysql/dev/4.1/libmysqld/client.c:1501: undefined reference to `SSL_CTX_free'
/usr/local/mysql-4.1-nodebug//lib/mysql/libmysqld.a(libvio_viosslfactories.o): In function `vio_set_cert_stuff':
/home/hartmut/projects/mysql/dev/4.1/vio/viosslfactories.c:87: undefined reference to `SSL_CTX_use_certificate_file'
[...]

How to repeat:
Try to compile the attached test project against MySQL 4.1,
just doing a 

  configure --with-mysql=... ; make

fails with SSL specific linker errors

  LIBS=-lssl configure --with-mysql=... ; make

works (unless you run into bug #4921)

Suggested fix:
Add -lssl to the "mysql_config --libmysqld-libs" output
[23 Jul 2006 10:31] Hartmut Holzgraefe
This seems to be a regression of bug #5396
[23 Jul 2006 10:39] Hartmut Holzgraefe
Probably re-introduced in rev. 1.20 of scripts/mysql_config.sh
ChangeSet 1.2442.26.4 2005/09/28 13:39:28 kent@mysql.com
[23 Jul 2006 10:50] Hartmut Holzgraefe
test project

Attachment: bug21239-1.0.tar.bz2 (application/x-tar, text), 187.62 KiB.

[23 Jul 2006 10:55] 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/9461
[15 Sep 2006 14:36] 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/12028

ChangeSet@1.2273, 2006-09-15 16:35:50+02:00, hartmut@mysql.com +1 -0
  Add SSL specific linker flags to --libmysqld-libs (Bug #21239)
[15 Sep 2006 22:22] Chad MILLER
Available in 5.1.12-beta.
[15 Sep 2006 23:21] Paul DuBois
Noted in 5.1.12 changelog.

mysql_config --libmysqld-libs did not produce any SSL options necessary for linking libmysqld with SSL support enabled.

Resetting report to NDI pending merge into 5.0.
[14 Nov 2006 11:46] Magnus BlÄudd
Pushed to 5.0.26 - Sep 16 2006
[14 Nov 2006 19:40] Paul DuBois
Noted in 5.0.26 changelog.