[debian-mysql] Bug#855244: libmariadbclient-dev: hardcoded -lmysqlclient, package not providing it though

Michael Prokop mika at debian.org
Wed Feb 15 21:39:04 UTC 2017


Package: libmariadbclient-dev
Version: 10.1.21-5
Severity: serious

% dpkg --list | grep mariadb
ii  libmariadbclient-dev     10.1.21-5            amd64        MariaDB database development files
ii  libmariadbclient18:amd64 10.1.21-5            amd64        MariaDB database client library

% grep Libs /usr/share/pkgconfig/mariadb.pc
Libs: -L${libdir} -lmysqlclient -lpthread -lz -lm -ldl
% grep mysqlclient /usr/bin/mysql_config
libs="-L$pkglibdir  -lmysqlclient -lpthread -lz -lm -ldl"

The hardcoded -lmysqlclient is wrong in this situation though:

% cat > demo.c << EOF
#include <stdio.h>
#include <mysql.h>

MYSQL  *conn;

void main(int argc, char *argv[])
{
  conn = mysql_init(NULL);
  mysql_close(conn);
}
EOF
% gcc -o demo demo.c $(pkg-config --cflags mariadb) $(pkg-config --libs mariadb)
/usr/bin/ld: cannot find -lmysqlclient
collect2: error: ld returned 1 exit status

% gcc -o demo demo.c $(mysql_config --cflags) $(mysql_config --libs)
/usr/bin/ld: cannot find -lmysqlclient
collect2: error: ld returned 1 exit status

If invoked with manually provided -lmariadbclient it's fine though:

% gcc -o demo demo.c $(pkg-config --cflags mariadb) -lmariadbclient
% gcc -o demo demo.c $(mysql_config --cflags) -lmariadbclient

As an alternative/workaround installing the
default-libmysqlclient-dev + libmariadbclient-dev-compat packages
also fixes the problem with -lmysqlclient usage.

This clearly shouldn't reach the stable stretch release as is, IMO.

regards,
-mika-



More information about the pkg-mysql-maint mailing list