Date: Wed, 6 Feb 2013 05:39:53 GMT From: Thomas Mack <mack@ifis.cs.tu-bs.de> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/175872: Static linking to libmysqlclient_r.a results in charset is not a compiled character set error Message-ID: <201302060539.r165drQC014950@red.freebsd.org> Resent-Message-ID: <201302060540.r165e15l043054@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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@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@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 >Fix: >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302060539.r165drQC014950>