Trying to connect to a mysql database through C works fine, as long as the program is linked dynamically. Linking statically (gcc -static ...) results in the error: 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/) even though the charset is at least included in /usr/local/share/mysql/charsets/Index.xml: [mack@admin ~/sources]$ grep -w latin1 /usr/local/share/mysql/charsets/Index.xml <charset name="latin1"> <alias>latin1</alias> [mack@admin ~/sources]$ Tested on mysql-client-5.5.29. How-To-Repeat: Just try to connect to a MySQL database from C: ===================================================== #include <stdio.h> #include <stdlib.h> #include <mysql.h> 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_server.host.name","dbuser","password", "db_name", 0,NULL,0)) { fprintf(stderr, "Error 2: %s\n", mysql_error(mysql)); exit(-1); } } =================================================================== and compile it statically: gcc -static -o mt -I/usr/local/include/mysql -L/usr/local/lib/mysql mt.c -lmysqlclient_r -lz -lm
To which port does this PR apply?
Responsible Changed From-To: freebsd-ports-bugs->ale Over to maintainer (via the GNATS Auto Assign Tool)
State Changed From-To: open->closed You should add '-pthread' to compile command.