Hi!
When compiling a test program statically, I end up with an error message from MySQL when trying to connect to the MySQL server, but there is no problem when linking dynamically.
The test program:
The output on static compile with: [CMD=""]gcc -static -o mt -I/usr/local/include/mysql -L/usr/local/lib/mysql mt.c -lmysqlclient[/CMD]
There is no problem, when leaving -static from the compile.
So, what might be the problem?
Any hint?
Thanks,
Thomas
When compiling a test program statically, I end up with an error message from MySQL when trying to connect to the MySQL server, but there is no problem when linking dynamically.
The test program:
Code:
int main(int argc, char *argv[]) {
MYSQL *mysql;
if (mysql_library_init(0, NULL, NULL)) {
fprintf(stderr, "Error 1: %s\n", mysql_error(mysql));
exit(-1);
}
mysql = mysql_init(NULL);
if (!mysql_real_connect(mysql, "db.some.host","dbuser","something_secret", "db", 0,NULL,0)) {
fprintf(stderr, "Error 2: %s\n", mysql_error(mysql));
exit(-1);
}
}
The output on static compile with: [CMD=""]gcc -static -o mt -I/usr/local/include/mysql -L/usr/local/lib/mysql mt.c -lmysqlclient[/CMD]
Code:
[mack@admin ~/sources]$ ./mt
Character set 'latin1' is not a compiled character set and is not specified in the '/usr/local/share/mysql/charsets/Index.xml' file
Error 2: Can't initialize character set latin1 (path: /usr/local/share/mysql/charsets/)
[mack@admin ~/sources]$ grep -w latin1 /usr/local/share/mysql/charsets/Index.xml
<charset name="latin1">
<alias>latin1</alias>
[mack@admin ~/sources]$
There is no problem, when leaving -static from the compile.
So, what might be the problem?
Code:
[mack@admin ~/sources]$ pkg_which /usr/local/lib/mysql/libmysql*.a
mysql-client-5.5.29
mysql-client-5.5.29
mysql-server-5.5.29
mysql-client-5.5.29
[mack@admin ~/sources]$
Any hint?
Thanks,
Thomas