BSDi and PIL

Thomas Wouters thomas at
Sat Apr 15 19:37:34 CEST 2000

On Sat, Apr 15, 2000 at 04:22:48PM +0000, David Reid wrote:

> Has anyone had any joy in getting Python 1.5.2 and PIL 1.0 to build together
> on BSDi 4.0.1?

Is your problem python or PIL ? Compiling stock 1.5.2 on BSDI 4.x can be a
challenge: If you enable shared libraries (which is a good thing) you have
to convince configure that you are running on an ELF system (BSDI 4.x is
ELF, 3.x and lower isn't) or change the resulting Makefiles to reflect this.
You know when you hit this problem when you get errors about undefined
symbols in shared modules, and those undefined symbols are python-internal
symbols. (Like PyErr* or PyNone)

If you enable threads, you're in for more treats: threading on BSDI 4.x is
screwed in many subtle ways, resulting in for instance a pause() call that
never bothers to return, even if you do get a signal.

The linkflags problem is relatively easy to fix: After configure, edit the
toplevel Makefile, and Modules/Makefile.pre (not the Makefile itself, for it
will be overwritten after you change Modules/Setup)

Look for this block:

# Symbols used for using shared libraries
SO=             .so
LDSHARED=       ld
DESTSHARED=     $(BINLIBDEST)/lib-dynload

And change the middle three entries so it reads like this:

# Symbols used for using shared libraries
SO=             .so
LDSHARED=       gcc -shared
CCSHARED=       -fpic
LINKFORSHARED=  -Xlinker -export-dynamic
DESTSHARED=     $(BINLIBDEST)/lib-dynload

(If you ever lose this mail and forget what it was, steal those flags from
any system using ELF, like linux ;) This problem has been fixed, by the way,
in the CVS tree, so 1.6 wont require this patching.

The threading business is harder... The bugs are subtle, but unfortunately
not restricted to python code that uses threads: when you enable threads,
pause() will always hang your process indefinately. (I started python under
gdb once, to see what was happening... In thread-enabled code, the libc
pause() is a special with-threads version, and on receiving the signal,
there is some internal rumbling underneath pause(), but it never delivers
the signal to the calling function.)

So, my advice would be 'do not enable threads'. If you *have* to have
threads, or you would really like to have them, upgrade to BSDI 4.1, which
does handle threads OK (at least, the test that i threw at it.) Besides,
most BSDI patches are freely available, last time I looked, and fairly easy
to install.

As for PIL, well, I haven't bothered with installing it on our BSDI servers,
just on my linux workstations, but if you're still having trouble, I could
give it a go.

Thomas Wouters <thomas at>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!

More information about the Python-list mailing list