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
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