Problem using pexports & Cygwin to build Python 2.2 extension modules

Les Button lbut at stny.rr.com
Sun Mar 17 10:21:19 EST 2002


Hello,

I have been trying unsuccessfully to use Cygwin/gcc to build Python
extensions for native Windows Python 2.2 on Windows XP.  I followed
the general outline at
http://python.sourceforge.net/devel-docs/inst/non-ms-compilers.html

Summary of problem (whether I use distutils, or just try to "do it
by hand"): I get a linker failure, from undefined references
to "libpython22_a_iname" and "_nm___Py_NoneStruct".

Has anyone else had success building an extension module with Windows
Python 2.2 and Cygwin/gcc?

Thanks,
--Les Button
lbut at stny.rr.com

P.S. I also had a problem with "Python.h" needing to have definitions of
SIZEOF_INT
and SIZEOF_LONG;  these apparently didn't get defined properly (for
Cygwin/gcc)
in "pyconfig.h"??  I fixed for now by providing #define's for these two,
before the
#include "Python.h" -- I don't see why this should be related to the linker
failure.

pexports version 0.43
dlltool version 2.11.92 20011001
gcc version 2.95.3-5
Windows Python 2.2
Windows XP (home edition)

******** Attempted build: *********
$ ./pexports python22.dll > python22.def
$ dlltool --dllname python22.dll --def
python22.def --output-lib=libpython22.a
$ cp libpython22.a  /cygdrive/c/Python22/libs
$ python setup.py build --compiler=cygwin
running build
running build_ext
building 'pr_int' extension
creating build
creating build\temp.win32-2.2
creating build\temp.win32-2.2\Release
C:\cygwin\bin\gcc.exe -mcygwin -mdll -O -Wall -Ic:\Python22\include -c
pr_int.c
-o build\temp.win32-2.2\Release\pr_int.o
writing build\temp.win32-2.2\Release\pr_int.def
creating build\lib.win32-2.2
C:\cygwin\bin\gcc.exe -mcygwin -mdll -static -s
build\temp.win32-2.2\Release\pr_
int.o
build\temp.win32-2.2\Release\pr_int.def -Lc:\Python22\libs -lpython22 -o b
uild\lib.win32-2.2\pr_int.pyd
Warning: resolving __Py_NoneStruct by linking to __imp___Py_NoneStruct
(auto-imp
ort)
fu000001.o(.idata$3+0xc): undefined reference to `libpython22_a_iname'
fu000002.o(.idata$3+0xc): undefined reference to `libpython22_a_iname'
nmth000000.o(.idata$4+0x0): undefined reference to `_nm___Py_NoneStruct'
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

******** setup.py: *********
import sys

from distutils.core import setup
from distutils.extension import Extension

setup (
    name = "pr_int",

    ext_modules = [Extension(
        name="pr_int",
        sources = [ "pr_int.c" ]
        )],
)





More information about the Python-list mailing list