[Pyrex] Undefined references message when compiling

Lenard Lindstrom len-l at telus.net
Thu May 17 20:48:54 UTC 2007


stephen at theboulets.net wrote:
>> stephen at theboulets.net wrote:
>> Use distutils to build your extension module. Don't try to compile it by
>> hand.
>> Don't hardcode the path to Python.h.
>>
>>   http://docs.python.org/dist/dist.html
>>   http://docs.python.org/dist/single-ext.html
>>   http://docs.python.org/inst/inst.html
>>     
>
> Thanks for the help. Any idea how to pass the "-c" option to setup.py?
>
> Stephen
>   
>> python setup.py build_ext --inplace
>>     
> running build_ext
> error: Python was built with Visual Studio 2003;
> extensions must be built with a compiler than can generate compatible
> binaries.
> Visual Studio 2003 was not found on this system. If you have Cygwin
> installed,
> you can try compiling with MingW32, by passing "-c mingw32" to setup.py.
>
> Trying to pass "-c":
>
>   
>> python -c mingw32 setup.py build_ext --inplace
>>     
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
> NameError: name 'mingw32' is not defined
>
>   
>> python setup.py -c mingw32 build_ext --inplace
>>     
> 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 -c not recognized
>
>   
It goes after the build_ext:

python setup.py build_ext --inplace -c mingw32

If you want distutils to use mingw by default then put the following 
into the file Lib\distutils\distutils.cfg in the Python directory:

[build]
compiler=mingw32
[build_ext]
compiler=mingw32


Distutils is described in the Python documents "Installing Python 
Modules" and "Distributing Python Modules". Configuration files are 
explained in section 5 "Distutils Configuration Files" of "Installing 
Python Modules".

-------
Lenard Lindstrom
<len-l at telus.net>



More information about the Pyrex mailing list