Bug #7021 mysql_config misses -lz in --libs_r
Submitted: 5 Dec 2004 15:12 Modified: 11 Jan 2005 20:23
Reporter: Jochen Kokemüller Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:4.1.7 OS:Linux (Linux)
Assigned to: Jim Winstead CPU Architecture:Any

[5 Dec 2004 15:12] Jochen Kokemüller
Description:
When i compile my project using options from the mysql_config script i get the following error:
/usr/local/mysql/lib/mysql/libmysqlclient_r.so: undefined reference to `uncompress'
/usr/local/mysql/lib/mysql/libmysqlclient_r.so: undefined reference to `compress'
collect2: ld returned 1 exit status

This is clearly because of the missing -lz Flag which my Project does not support  becuase of no need for it by myself.
Looking at the output from mysql_config:
Options:
        --cflags         [-I/usr/local/mysql/include/mysql]
        --include        [-I/usr/local/mysql/include/mysql]
        --libs           [-L/usr/local/mysql/lib/mysql -lmysqlclient -lcrypt -lnsl -lm -lz]
        --libs_r         [-L/usr/local/mysql/lib/mysql -lmysqlclient_r -lpthread -lcrypt -lnsl -lm -lpthread]
        --socket         [/tmp/mysql.sock]
        --port           [3306]
        --version        [4.1.7]
        --libmysqld-libs [-L/usr/local/mysql/lib/mysql -lmysqld -lpthread -lcrypt -lnsl -lm -lpthread -lrt -lcrypt -lnsl -lm -lz]

-lz appears in every relevant line except in --libs_r

How to repeat:
LIBS=$(mysql_config --libs_r)
gcc foo.c $LIBS

Suggested fix:
Just add -lz to the output of --libs_r
[5 Dec 2004 22:11] Hartmut Holzgraefe
see also bug #6418
[11 Jan 2005 20:23] Paul DuBois
Mentioned in 4.1.9 change notes.