Compile line in Makefile does not work if client libs are static
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
MySQL Data Dumper | Status tracked in Trunk | |||||
0.1 |
Fix Released
|
Medium
|
Domas Mituzas | |||
Trunk |
Fix Released
|
Medium
|
Domas Mituzas |
Bug Description
If the libmysqlclient_r library is static, gcc will implicitly link against it statically. Therefore the default compile line as chosen by the `make` command using the current Makefile won't work:
$ make
cc `mysql_config --cflags` `pkg-config --cflags glib-2.0 gthread-2.0` -Wall -O3 -g -dynamic `mysql_config --libs_r` `pkg-config --libs glib-2.0 gthread-2.0` mydumper.c -o mydumper
/tmp/ccgUIPyb.o: In function `dump_table_data':
/home/erik/
/home/erik/
/home/erik/
....
This however works:
c `mysql_config --cflags` `pkg-config --cflags glib-2.0 gthread-2.0` -Wall -O3 -g -dynamic `mysql_config --libs_r` `pkg-config --libs glib-2.0 gthread-2.0` mydumper.c -o mydumper -lmysqlclient_r
So suggested change to Makefile:
CFLAGS=
LDFLAGS=
all:
cc -g $(CFLAGS) mydumper.c -o mydumper $(LDFLAGS)
clean:
rm -rf mydumper dump *~ *BAK *.dSYM *.o
indent:
gnuindent -ts4 -kr -l200 dump.c
which produces this line which works regardless of whether the lib is static or dynamic:
cc -g `mysql_config --cflags` `pkg-config --cflags glib-2.0 gthread-2.0` -Wall -O3 -g mydumper.c -o mydumper `mysql_config --libs_r` `pkg-config --libs glib-2.0 gthread-2.0`
Cheers,
Erik