ports/175872: Static linking to libmysqlclient_r.a results in charset is not a compiled character set error
Thomas Mack
mack at ifis.cs.tu-bs.de
Wed Feb 6 05:40:01 UTC 2013
>Number: 175872
>Category: ports
>Synopsis: Static linking to libmysqlclient_r.a results in charset is not a compiled character set error
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Feb 06 05:40:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Thomas Mack
>Release: 8.3
>Organization:
>Environment:
FreeBSD admin.bildarchiv-ostpreussen.de 8.3-RELEASE-p3 FreeBSD 8.3-RELEASE-p3 #0: Tue Jun 12 00:39:29 UTC 2012 root at amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
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 at admin ~/sources]$ grep -w latin1 /usr/local/share/mysql/charsets/Index.xml
<charset name="latin1">
<alias>latin1</alias>
[mack at 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
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list