Q: linking Python 1.5.2 on Solaris 2.6 w/ pthreads

Brian Fritz brianfr at speakeasy.org
Thu Aug 9 00:09:46 CEST 2001

Sorry to be dredging up an old version of Python, but it's what is
in production and has to be lived with.

I'm trying to build a local copy of Python that uses Pthreads on my
local SparcStation using the tarball from SunFreeware. The local 
gcc is version 2.8.1.

I've read through the README file and have run ./configure with the
'--with-thread' option. Then, the README has a couple of tables of
compiler switches and linker libraries and flags. It only says that
manual intervention is necessary, but doesn't clearly (at least to
me) say where these flags should be manually added.

I did some historical searches going back two years on Deja
using the key words "solaris" and "lpthread" hoping to find some
insight. I found a couple of articles discussing newer versions of
Python. What I gleaned was that maybe the manual changes needed to
be made to the Pyhon/Makefile.

I changed the Python/Makefile like this, adding the -D_REENTRANT
switch and changing lthread to lpthread:

> LIBOBJS=         thread.o thread.o
> LIBS=           -lsocket -lnsl -ldl  -lpthread

I then ran make in the base directory. No problem, saw various gcc
command lines scroll by with the -D_REENTRANT tag. The 'make test'
ran without problem, and I thought I was home free.

However, after I 'make install' I used ldd to check my linking and
I did not have lpthreads.

> blackriver Python> ldd /usr/local/bin/python
>         libsocket.so.1 =>        /lib/libsocket.so.1
>         libnsl.so.1 =>   /lib/libnsl.so.1
>         libdl.so.1 =>    /lib/libdl.so.1
>         libthread.so.1 =>        /lib/libthread.so.1
>         libm.so.1 =>     /lib/libm.so.1
>         libc.so.1 =>     /lib/libc.so.1
>         libmp.so.2 =>    /lib/libmp.so.2
>         /usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1

Can someone enlighten me as to what I'm missing here?



More information about the Python-list mailing list