I would like to be able to distribute my extension as a Windows
installer, so that users don't have to mess around with compilers they
might not even have. If I try to make a windows installer on cygwin with
python setup.py bdist_wininst
I get the following error message:
....
distutils.errors.DistutilsPlatformError: distribution contains
extensions and/or C libraries; must be compiled on a Windows 32 platform
If I try to run the same command with Python under Windows instead of
Python on cygwin, then distutils tries to use the cl.exe compiler, which
I don't have.
Is it possible to create a Windows installer with distutils using the
Cygwin/mingw gcc compiler?
Thanks in advance.
Michiel de Hoon
University of Tokyo, Human Genome Center
$ python setup.py --compiler=mingw32
$ python setup.py bdist_wininst
'python' must be the win32 Python, *not* the Cygwin Python.
Gerhard
--
mail: gerhard <at> bigfoot <dot> de registered Linux user #64239
web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id AD24C930
public key fingerprint: 3FCC 8700 3012 0A9E B0C9 3667 814B 9CAA AD24 C930
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))
> c:\\python22\\python setup.py --compiler=mingw32
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: option --compiler not recognized
I get the same error with both the win32 Python and the Cygwin Python.
My win32 Python is the latest version. Any idea what is going wrong? I
attached my setup.py in case it is of any help.
Thanks again -- Michiel
setup.py:
#!/usr/bin/env python
from distutils.core import setup, Extension
setup(name="Cluster",
version="1.01",
description="The C Clustering Library",
author="Michiel de Hoon",
author_email="mde...@ims.u-tokyo.ac.jp",
url="http://bonsai.ims.u-tokyo.ac.jp/~mdehoon/software/software.html",
packages = ['Pycluster'],
ext_modules=[Extension("Pycluster.cluster",["cluster.c","clustermodule.c",
"ranlib/src/ranlib.c","ranlib/src/com.c","ranlib/linpack/linpack.c"],include_dir
s=['ranlib/src'],extra_link_args=['-s'])]
)
python setup.py build --compiler=mingw32
Tim Delaney
That should be
python setup.py build --compiler-mingw32
Tim Delaney
It almost works -- the source files get compiled and everything seems to
be fine, up to the linking stage where two references
(__imp___Py_NoneStruct and __imp__PyCObject_Type) are unresolved. These
two are (I think) in python22.lib, which gcc seems to find, but somehow
it can't find those two routines in it.
I also tried to link them as
c:\cygwin\usr\local\bin\gcc.exe -mno-cygwin -mdll -static --entry
_DllMain@12 -s
build\temp.win32-2.2\Release\cluster.o
build\temp.win32-2.2\Release\clustermodule.o
build\temp.win32-2.2\Release\ranlib.o build\temp.win32-2.2\Release\com.o
build\temp.win32-2.2\Release\linpack.o
build\temp.win32-2.2\Release\cluster.def
c:\python22\libs\python22.lib -o
build\lib.win32-2.2\Pycluster\cluster.pyd -s
to make sure it finds python22.lib, but with the same result.
Any ideas? Sorry to bother you guys again.
C:\cygwin\home\mdehoon\Software\Cluster>c:\\python22\\python setup.py
build --compiler=mingw32
running build
running build_py
creating build
creating build\lib.win32-2.2
creating build\lib.win32-2.2\Pycluster
copying Pycluster\__init__.py -> build\lib.win32-2.2\Pycluster
running build_ext
building 'Pycluster.cluster' extension
creating build\temp.win32-2.2
creating build\temp.win32-2.2\Release
c:\cygwin\usr\local\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Iranlib/src
-Ic:\python22\include -c cluster.c -o build\temp.win32-2.2\Release\cluster.o
c:\cygwin\usr\local\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Iranlib/src
-Ic:\python22\include -c clustermodule.c -o
build\temp.win32-2.2\Release\clustermodule.o
clustermodule.c:51: warning: `set_transposed_strides' defined but not used
clustermodule.c:188: warning: `do_array_inout' defined but not used
c:\cygwin\usr\local\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Iranlib/src
-Ic:\python22\include -c ranlib/src/ranlib.c -o
build\temp.win32-2.2\Release\ranlib.o
c:\cygwin\usr\local\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Iranlib/src
-Ic:\python22\include -c ranlib/src/com.c -o
build\temp.win32-2.2\Release\com.o
c:\cygwin\usr\local\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Iranlib/src
-Ic:\python22\include -c ranlib/linpack/linpack.c -o
build\temp.win32-2.2\Release\linpack.o
writing build\temp.win32-2.2\Release\cluster.def
c:\cygwin\usr\local\bin\gcc.exe -mno-cygwin -mdll -static --entry
_DllMain@12 -s
build\temp.win32-2.2\Release\cluster.o
build\temp.win32-2.2\Release\clustermodule.o
build\temp.win32-2.2\Release\ranlib.o build\temp.win32-2.2\Release\com.o
build\temp.win32-2.2\Release\linpack.o
build\temp.win32-2.2\Release\cluster.def -L
c:\python22\libs -lpython22 -o build\lib.win32-2.2\Pycluster\cluster.pyd
-s
build\temp.win32-2.2\Release\clustermodule.o(.text+0x74):clustermodule.c:
undefined reference to `__imp___Py_NoneStruct'
build\temp.win32-2.2\Release\clustermodule.o(.text+0x7c):clustermodule.c:
undefined reference to `__imp___Py_NoneStruct'
build\temp.win32-2.2\Release\clustermodule.o(.text+0x28da):clustermodule.c:
undefined reference to `__imp__PyCObject_Type'
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
Thanks again
--Michiel.
C:\cygwin\home\mdehoon\Software\Cluster>c:\cygwin\usr\local\bin\gcc.exe
-mno-cygwin -mdll -static --entry _DllMain@12 -s build\temp.win32-2.2\Release\cluster.o
build\temp.win32-2.2\Release\clustermodule.o
build\temp.win32-2.2\Release\ranlib.o
build\temp.win32-2.2\Release\com.o build\temp.win32-2.2\Release\linpack.o
build\temp.win32-2.2\Release\cluster.def -Lc:\python22\libs -lpython22
-o build\lib.win32-2.2\Pycluster\cluster.pyd -s
c:\winnt\system32\python22.dll