[Python-Dev] Python 2.1.1

Thomas Wouters thomas@xs4all.net
Fri, 13 Jul 2001 12:57:20 +0200

On Thu, Jul 12, 2001 at 06:43:19PM +0200, Thomas Wouters wrote:
> On Thu, Jul 12, 2001 at 11:33:13AM -0500, Skip Montanaro wrote:

> >     Thomas> Both of these are distutils-build related, and I'm not sure on
> >     Thomas> the 'right' fix on either. The latter also applies to 'bsddb',
> >     Thomas> by the way, and is especially annoying to me, because I'm
> >     Thomas> running Debian on more and more machines :) Does anyone who
> >     Thomas> understands setup.py have time to look at these before a week
> >     Thomas> from friday, when 2.1.1-final is scheduled ?

> > I just added another variant (with a patch): bsddb build on Mandrake 8.0 is
> > broken because it doesn't account for the libdb* shared library when
> > creating bsddb.so:
> > 
> >     https://sourceforge.net/tracker/index.php?func=detail&aid=440725&group_id=5470&atid=105470

> > Thomas, I'm not sure if this applies to your Debian build woes, but
> > perhaps it will help.

> Yes, it does! Now bsddb builds, but dbmmodule still doesn't. It seems that's
> because setup.py only checks for libndbm.so, and not for libdbX.so, which
> also have a DBM implementation (IIRC), or libgdbm.so, which has one too.

This does fix my problem:

Index: setup.py
RCS file: /cvsroot/python/python/dist/src/setup.py,v
retrieving revision 1.38
diff -c -r1.38 setup.py
*** setup.py    2001/04/15 15:16:12     1.38
--- setup.py    2001/07/13 10:51:14
*** 323,331 ****
          # The standard Unix dbm module:
          if platform not in ['cygwin']:
!             if (self.compiler.find_library_file(lib_dirs, 'ndbm')):
                  exts.append( Extension('dbm', ['dbmmodule.c'],
!                                        libraries = ['ndbm'] ) )
                  exts.append( Extension('dbm', ['dbmmodule.c']) )
--- 323,337 ----
          # The standard Unix dbm module:
          if platform not in ['cygwin']:
!             for lib in ('ndbm', 'db', 'db1', 'db2', 'db3', 'dbm'):
!                 if self.compiler.find_library_file(lib_dirs, lib):
!                     break
!             else:
!                 lib = None
!             if lib:
                  exts.append( Extension('dbm', ['dbmmodule.c'],
!                                        libraries = [lib]) )
                  exts.append( Extension('dbm', ['dbmmodule.c']) )

The problem is very simple: distutils does not play well with autoconf. The
problem is that I have at least two implementations of 'dbm' available:
'libdbm', which comes with GDBM, and 'libdb1', which comes with libc.
Autoconf tries to figure out which include file to use, and it does a decent
job, but then distutils goes ahead and just tries to link with 'libndbm',
which I don't have. The search path I give above works because I need
'libdb1', but it would still barf if autoconf found a different header than
distutils tries to link with. 

In other words: it's a mess. Distutils should do the include-file-finding
*and* the library-file-finding, and pass the right arguments, *or* autoconf
should find both the include file and the library file, and pass that info
to distutils somehow.

Thomas Wouters <thomas@xs4all.net>

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