Re: Compiling Python for .so

Guido.van.Rossum@cwi.nl
Mon, 09 Jan 1995 11:40:05 +0100

> I can compile python 1.1 on a sparcstation 20 running SunOS 5.3,
> but it does not seem to "automatically" detect the fact that
> dlfcn.h exists on my system and that it is capable of using
> shared objects.
>
> The problem is the two environment variables in Python/import.c
> called DYNAMIC_LINK and USE_SHLIB are never set by configure, and
> the code imbedded in these #ifdef's never gets included in the
> compilation.

This should work automatically.

The configure script is not supposed to set these variables directly,
however it should detect the existence of <dlfcn.h> and dlopen().
There's code in import.c that uses this:

#if !defined(DYNAMIC_LINK) && defined(HAVE_DLFCN_H) && defined(HAVE_DLOPEN)
#define DYNAMIC_LINK
#define USE_SHLIB
#endif

(it may actually look a little different since this is quoting from a
modified version but I'm pretty sure this is in essence what it does).

Check the generated config.h for HAVE_DLFCN_H and HAVE_DLOPEN, to see
whether the configure script thinks these exist (I presume that at
least one of them is undefined). Then have a look at the configure
script and see why it doesn't find them -- it does on our Solaris 2.2
system.

--Guido van Rossum, CWI, Amsterdam <mailto:Guido.van.Rossum@cwi.nl>
<http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>