mysql_config --libs gives incorrect output on Centos7

Bug #1438009 reported by Roel Van de Paar
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.1
New
Undecided
Unassigned
5.5
New
Undecided
Unassigned
5.6
Triaged
High
Tomislav Plavcic
5.7
New
Undecided
Unassigned

Bug Description

$ mysql_config --libs
-L/usr/lib64 -lmysqlclient -lpthread -lm -lrt -lssl -lcrypto -ldl

But, when you try and compile some C program using `mysql_config --libs` as part of the gcc call, it fails. Reason (after much digging) is that the output above is wrong, it should instead read:

-L/usr/lib64/mysql -lmysqlclient -lpthread -lm -lrt -lssl -lcrypto -ldl

As this is where the client libs are;

$ ls /usr/lib64/mysql
libmysqlclient.a libmysqlclient_r.a libmysqlservices.a

Not sure how widespread this is in other Centos releaes etc.

This makes compiling programs with Percona Server client statically linked very difficult (it took Sergei & me about 1+ hours to work it out together), so this bug is high prio to aid client adoption.

Workaround is to do something like `mysql_config --libs | sed 's|lib64|lib64/mysql|'` instead.

Setup for testing;
sudo yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm
sudo yum install Percona-Server-devel-56 Percona-Server-client-56 Percona-Server-shared-56

Background:
https://dev.mysql.com/doc/refman/5.6/en/c-api-building-clients.html

Tags: pkg qa
description: updated
description: updated
Revision history for this message
Roel Van de Paar (roel11) wrote :

Previous releases of Centos should also be checked for the libperconaserverlcient implementation. In that case, the above may still apply (re: additional subdir), but additionally also the -lmysqlclient output of mysql_config should represent the correct client lib instead.

description: updated
description: updated
Revision history for this message
Roel Van de Paar (roel11) wrote :

If the -l client lib is indeed incorrect, it is one more reason to revert to standard client lib name imho.

Revision history for this message
Roel Van de Paar (roel11) wrote :

For upstream, the files are also in lib64/mysql. Yet, -lmysqlclient works fine without problems there.

Revision history for this message
Roel Van de Paar (roel11) wrote :

Mariadb otoh fixes the same with using subdir.

$ mysql_config --libs
-L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lssl -lcrypto -ldl

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.