Context: I am not certain whether this is my problem or the problem of the server this is running on. I am trying to compile and run a small utility, to become a cron job, that uses the mysql libraries. The program compiles successfully with the following command, no errors or warnings:
gcc my_program.c -o my_program -I /usr/include/mysql/ -L/usr/include/mysql -lmysqlclient -lglib-2.0 -Wall
I added -lglib-2.0
because...
Problem: when I then try to run the program, it aborts with the following error:
./my_program: symbol lookup error: /usr/lib/libmysqlclient.so.15: undefined symbol: strcpy, version GLIBC_2.0
The error happens at runtime, in the following line:
conn = mysql_init(conn);
conn
is declared as MYSQL *conn;
, this is the first time I use anything from mysql.h (except for the declarations), and strcpy
works fine if I use it in my_program.c
itself.
The libraries linked from libmysqlclient.so.15
are:
ldd /usr/lib/libmysqlclient.so.15
linux-gate.so.1 => (0xb7ef6000)
libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7cf4000)
libcrypt.so.1 => /lib/tls/i686/cmov/libcrypt.so.1 (0xb7cc2000)
libnsl.so.1 => /lib/tls/i686/cmov/libnsl.so.1 (0xb7ca9000)
libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7c84000)
libz.so.1 => /usr/lib/libz.so.1 (0xb7c6f000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7b20000)
/lib/ld-linux.so.2 (0xb7ef7000)
Is there anything I can do in my code, are my compilation or linking parameters missing something, or is there a problem with the dynamic linking of the libmysqlclient.so.15
library that lies within the library itself? If the latter (which I don't think considering that the mysql library is used in other places in the server AFAIK), what can the server's admin do to fix the problem?