Bug using 32-bit libmysqlclient on a 64-bit system?

Bug using 32-bit libmysqlclient on a 64-bit system?

am 04.06.2011 02:18:39 von Alex Gaynor

--bcaec51f9905e242fc04a4d7cfc4
Content-Type: text/plain; charset=ISO-8859-1

I've got a 64-bit Linux system, with a 32-bit libmysqlclient (and a 64-bit),
and a C program using the libmysqlclient API which behaves very differently
depending on which platform it is compiled for. The program is:

#include
#include

#include


int main() {
MYSQL *conn = mysql_init(NULL);
mysql_real_connect(conn, NULL, "root", NULL, "test_mysqldb",
0, NULL, 0);
mysql_real_query(conn, "SHOW COLLATION", strlen("SHOW COLLATION"));
MYSQL_RES *result = mysql_store_result(conn);
int n_fields = mysql_num_fields(result);
MYSQL_FIELD *fields = mysql_fetch_fields(result);
int i;
for (i = 0; i < n_fields; i++) {
printf("%s: %d\n", fields[i].name, fields[i].type);
}
mysql_free_result(result);
mysql_close(conn);
}


When run under 64-bit I get the expected result:

alex@devalex:/tmp$ ./test
Collation: 253
Charset: 253
Id: 8
Default: 253
Compiled: 253
Sortlen: 8

However when run under 32-bit I get something very unexpected:

alex@devalex:/tmp$ ./test32
Collation: 253
CHARACTER_SET_NAME: 142345400
COLLATIONS: 142345464
: 142345496
: 142345584
def: 1280069443


I'm not sure what the issue is, and it may very well be on my end, but any
debugging help you can provide would be great (this was originally extracted
from a bug in a Python MySQL driver I'm working on using the ctypes FFI).

Thanks,
Alex

--bcaec51f9905e242fc04a4d7cfc4--

Re: Bug using 32-bit libmysqlclient on a 64-bit system?

am 04.06.2011 19:06:04 von walter harms

It is basicly a not clever solution to run 32bit libs with a 64bit system.
You have to compile -m32 and all sort of things.
It is *way* better to compile with pure 64bit.

re,
wh

Am 04.06.2011 02:18, schrieb Alex Gaynor:
> I've got a 64-bit Linux system, with a 32-bit libmysqlclient (and a 64-bit),
> and a C program using the libmysqlclient API which behaves very differently
> depending on which platform it is compiled for. The program is:
>

>

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: Bug using 32-bit libmysqlclient on a 64-bit system?

am 13.06.2011 18:45:43 von Alex Gaynor

--90e6ba614eec7ee78704a59aa66a
Content-Type: text/plain; charset=ISO-8859-1

Unfortunately the decision to run 32-bit libs on 64-bit systems is outside
of my control. Given that it *should* work I'm more interested in
diagnosing whether this is a bug of some sort in libmysqlclient or a bug in
my code/build procedure.

Alex

On Sat, Jun 4, 2011 at 10:06 AM, walter harms wrote:

> It is basicly a not clever solution to run 32bit libs with a 64bit system.
> You have to compile -m32 and all sort of things.
> It is *way* better to compile with pure 64bit.
>
> re,
> wh
>
> Am 04.06.2011 02:18, schrieb Alex Gaynor:
> > I've got a 64-bit Linux system, with a 32-bit libmysqlclient (and a
> 64-bit),
> > and a C program using the libmysqlclient API which behaves very
> differently
> > depending on which platform it is compiled for. The program is:
> >
>
> >
>

--90e6ba614eec7ee78704a59aa66a--

Re: Bug using 32-bit libmysqlclient on a 64-bit system?

am 13.06.2011 19:47:05 von walter harms

Am 13.06.2011 18:45, schrieb Alex Gaynor:
> Unfortunately the decision to run 32-bit libs on 64-bit systems is outside
> of my control. Given that it *should* work I'm more interested in
> diagnosing whether this is a bug of some sort in libmysqlclient or a bug in
> my code/build procedure.


You should starting here: http://maketecheasier.com/run-32-bit-apps-in-64-bit-linux/20 09/08/10

basicly you have to check that every lib you use is realy 32bit. Missing one is asking for
trouble: random bugs, etc.

Basicly everything else like running linux in a LXC Container, a vitual machine with qemu, or
simply buy a 32bit box is more maintainable than mixing 32 und 64 bit application. They can run
perfectly until some random momentum.

re,
wh


> Alex
>
> On Sat, Jun 4, 2011 at 10:06 AM, walter harms wrote:
>
>> It is basicly a not clever solution to run 32bit libs with a 64bit system.
>> You have to compile -m32 and all sort of things.
>> It is *way* better to compile with pure 64bit.
>>
>> re,
>> wh
>>
>> Am 04.06.2011 02:18, schrieb Alex Gaynor:
>>> I've got a 64-bit Linux system, with a 32-bit libmysqlclient (and a
>> 64-bit),
>>> and a C program using the libmysqlclient API which behaves very
>> differently
>>> depending on which platform it is compiled for. The program is:
>>>
>>
>>>
>>
>

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org