[Python-bugs-list] [ python-Bugs-497697 ] building shared modules

noreply@sourceforge.net noreply@sourceforge.net
Sat, 29 Dec 2001 15:21:03 -0800


Bugs item #497697, was opened at 2001-12-29 13:43
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=497697&group_id=5470

>Category: Documentation
Group: Python 2.1.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Matthias Klose (doko)
Assigned to: Nobody/Anonymous (nobody)
Summary: building shared modules

Initial Comment:
[ report from http://bugs.debian.org/121759, submitted 
by Jochen Voss <jvoss2@web.de> ]

I tried to follow the description in
/usr/share/doc/python2.1/html/ext/dnt-type-
methods.html and the
following manual sections in order to build a C 
extension module for
Python 2.1.  The mechanism does not work as advertised 
in the manual.

To reproduce the problem try the following

    mkdir bugdir
    cd bugdir
    touch testx1module.c
    touch testx2module.c

Now create a file named "Setup" with the following 
three lines in it:

    == Setup starts at next line 
=======================
    *shared*
    testx1 testx1module.c
    testx2 testx2module.c -DFISCH=Barsch
    == Setup ends at previous line 
=====================

The third line will cause the problem later.  I think 
it is valid
syntax, because .../ext/module-defn-example.html states

    Several compiler options are supported:
    [...]
     -Dname=value           Define a macro

Now we try whether it works: type

    cp /usr/lib/python2.1/config/Makefile.pre.in .
    make -f Makefile.pre.in boot
    make

For me this gives the output

    gcc -fPIC -g -O2 -Wall -Wstrict-prototypes -
I/usr/include/python2.1 -I/usr/include/python2.1 -
DHAVE_CONFIG_H  -c ././testx1module.c -
o ./testx1module.o
    gcc -shared  ./testx1module.o   -
o ./testx1module.so

The bug is the following: file "testx2module.so" is 
not created.
And in fact "grep testx Makefile" emits

    SHAREDMODS= ./testx1module$(SO)
    testx2 testx2module.c -DFISCH=Barsch
    ./testx1module.o: $(srcdir)/./testx1module.c; 
$(CC) $(CCSHARED) $(CFLAGS)  -c 
$(srcdir)/./testx1module.c -o ./testx1module.o
    ./testx1module$(SO):  ./testx1module.o; 
$(LDSHARED)  ./testx1module.o   -o ./testx1module$(SO)

The second line looks suspicious.

I can work around this by putting the defines in a 
variable,
but I think this should be fixed nevertheless.


----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2001-12-29 15:21

Message:
Logged In: YES 
user_id=21627

It's a documentation bug. The Setup.in method of building
extensions is not supported anymore; please use distutils.

If you can provide patches to bring Makefile.pre.in into a
state so that it works for extensions again, such a patch
would be incorporated (unless it breaks other things); we
will not actively look for a solution.

I assume that the specific section of the documentation
you've been looking at is the same as

http://www.python.org/doc/current/ext/building-on-unix.html
(i.e. section 3, not section 2).

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=497697&group_id=5470