Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Feb 1999 16:25:58 +0100
From:      mkes@ra.rockwell.com
To:        Freebsd-questions@FreeBSD.ORG
Subject:   problem with MySQL module for python under 3.0
Message-ID:  <C125671A.0052DA3B.00@raclesmtp01.cle.ra.rockwell.com>

next in thread | raw e-mail | index | archive | help
Hi all

I have a box with 3.0 release. I have installed MySQL 3.21.33 and python
1.5.1 both from packages.
I have downloaded MySQLmodule-1.4 which is a source (just one .c file) for
python module allowing to access MySQL database.
The README says:

---------------
To build a dynamically loadable module without access to the python
source tree, use (Trond Eivind Glomsr\xf8d):

     gcc -shared -I/usr/include/python1.5 -I/usr/local/include/mysql \
     MySQLmodule.c -lmysqlclient -L/usr/lib/python1.5/config -lpython1.5 \
     -o MySQLmodule.so

and move the resulting MySQLmodule.so file into the PYTHONPATH. Again,
substitute the proper locations of your include and library files.
----------------

Applied to my situation the command line was:

     gcc -shared -I/usr/local/include/python1.5 -I/usr/local/include/mysql
\
     MySQLmodule.c -L/usr/local/lib/mysql -lmysqlclient
-L/usr/local/lib/python1.5/config -lpython1.5 \
     -o MySQLmodule.so

that is how I compiled the module and moved the resulting MySQLmodule.so to
 appropriate place.

When I run python and try to use it the python crashes:

ferda:/usr/home/mira> python
Python 1.5.1 (#2, Oct 12 1998, 15:11:45)  [GCC 2.7.2.1] on freebsd3
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import MySQL
Fatal Python error: PyThreadState_Get: no current thread
Abort (core dumped)
ferda:/usr/home/mira>

If I do that under FreeBSD 2.6 release it works. So my guess is there
something wrong with the compiler options
a.out vs ELF, or .... I found some 3.0 & MySQL related notes saying:

------------------------------------
You have to configure with:

--with-named-thread-libs=-lc_r

The pthreads library for FreeBSD doesn't contain the sigwait function and
there is some bugs in it. To fix this, get the
`FreeBSD-3.0-libc_r-1.0.diff' file and
apply this in the `/usr/src/lib/libc_r/uthread' directory. Follow after
this the instructions that can be found with man pthread about how to
recompile the
libc_r library.

You can test if you have a 'modern' libpthread.a with:

> nm /usr/lib/libc_r.a | grep sigwait.

If the above doesn't find sigwait you have to use the above patch and
recompile libc_r.
----------------------------------

My experience with compiler options, libraries to link with etc. is not
good enough to fix this.
Can anybody give me a hint what's wrong?

Thanks a lot

Mira



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C125671A.0052DA3B.00>