Nathan Dunfield | 23 Apr 17:58 2012

[Cython] Cython 0.16 issue Windows with Mingw32

I've encountered the following issue with Cython 0.16 on Windows with using the Mingw32 compiler (I'm
using Python 3.2 here, but I don't think that's the issue):

$ python3 setup.py build -c mingw32
running build
running build_py
running build_ext
skipping 'SnapPy.c' Cython extension (up-to-date)
building 'snappy.SnapPy' extension
c:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Iheaders -Iunix_kit -Iaddl_code -I.
-Ipari/pari-2.3.4/include/ -Ipari/pari-2.3.4/include/pari -Ic:\Python32\include
-Ic:\Python32\PC -c SnapPy.c -o build\temp.win32-3.2\Release\snappy.o
SnapPy.c: In function `__pyx_f_6snappy_6SnapPy_13Triangulation_build_rep_into_Sn':
SnapPy.c:25187: warning: implicit declaration of function `fg_get_num_orig_gens'
SnapPy.c:25423: warning: implicit declaration of function `candidateSn_is_valid'
SnapPy.c:25435: warning: implicit declaration of function `candidateSn_is_transitive'
SnapPy.c: At top level:
SnapPy.c:76434: error: initializer element is not constant
SnapPy.c:76434: error: (near initialization for `__pyx_CyFunctionType_type.tp_call')
error: command 'gcc' failed with exit status 1

The problem seems to be in the code that's pulled in from CythonFunction.c.   I apologize for not providing a
more minimal example (the above code is available at "hg clone
static-http://math.uic.edu/t3m/hg/SnapPy") but the small module I tried didn't pull in the
CythonFunction.c code. 

	Thanks,

	Nathan

(Continue reading)

Stefan Behnel | 23 Apr 20:28 2012
Picon

Re: [Cython] Cython 0.16 issue Windows with Mingw32

Nathan Dunfield, 23.04.2012 17:58:
> I've encountered the following issue with Cython 0.16 on Windows with
> using the Mingw32 compiler (I'm using Python 3.2 here, but I don't think
> that's the issue):
> 
> $ python3 setup.py build -c mingw32
> running build
> running build_py
> running build_ext
> skipping 'SnapPy.c' Cython extension (up-to-date)
> building 'snappy.SnapPy' extension
> c:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Iheaders -Iunix_kit -Iaddl_code -I.
-Ipari/pari-2.3.4/include/ -Ipari/pari-2.3.4/include/pari -Ic:\Python32\include
-Ic:\Python32\PC -c SnapPy.c -o build\temp.win32-3.2\Release\snappy.o
> SnapPy.c: In function `__pyx_f_6snappy_6SnapPy_13Triangulation_build_rep_into_Sn':
> SnapPy.c:25187: warning: implicit declaration of function `fg_get_num_orig_gens'
> SnapPy.c:25423: warning: implicit declaration of function `candidateSn_is_valid'
> SnapPy.c:25435: warning: implicit declaration of function `candidateSn_is_transitive'
> SnapPy.c: At top level:
> SnapPy.c:76434: error: initializer element is not constant
> SnapPy.c:76434: error: (near initialization for `__pyx_CyFunctionType_type.tp_call')
> error: command 'gcc' failed with exit status 1

Hmm, that line basically just says "PyCFunction_Call", which is a function
exported by CPython. I wonder why gcc would consider this "not a constant".

Could you check if the preprocessor (gcc -E, with all the above includes)
also sees that on your side?

Stefan
(Continue reading)

Stefan Behnel | 24 Apr 09:34 2012
Picon

Re: [Cython] Cython 0.16 issue Windows with Mingw32

Stefan Behnel, 23.04.2012 20:28:
> Nathan Dunfield, 23.04.2012 17:58:
>> I've encountered the following issue with Cython 0.16 on Windows with
>> using the Mingw32 compiler (I'm using Python 3.2 here, but I don't think
>> that's the issue):
>>
>> $ python3 setup.py build -c mingw32
>> running build
>> running build_py
>> running build_ext
>> skipping 'SnapPy.c' Cython extension (up-to-date)
>> building 'snappy.SnapPy' extension
>> c:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Iheaders -Iunix_kit -Iaddl_code -I.
-Ipari/pari-2.3.4/include/ -Ipari/pari-2.3.4/include/pari -Ic:\Python32\include
-Ic:\Python32\PC -c SnapPy.c -o build\temp.win32-3.2\Release\snappy.o
>> SnapPy.c: In function `__pyx_f_6snappy_6SnapPy_13Triangulation_build_rep_into_Sn':
>> SnapPy.c:25187: warning: implicit declaration of function `fg_get_num_orig_gens'
>> SnapPy.c:25423: warning: implicit declaration of function `candidateSn_is_valid'
>> SnapPy.c:25435: warning: implicit declaration of function `candidateSn_is_transitive'
>> SnapPy.c: At top level:
>> SnapPy.c:76434: error: initializer element is not constant
>> SnapPy.c:76434: error: (near initialization for `__pyx_CyFunctionType_type.tp_call')
>> error: command 'gcc' failed with exit status 1
> 
> Hmm, that line basically just says "PyCFunction_Call", which is a function
> exported by CPython. I wonder why gcc would consider this "not a constant".

My guess is that it's a Windows-DLL issue. Maybe symbols exported by
Windows-DLLs simply aren't "constant". We should be able to fix this by
indirecting the slot through a static function.
(Continue reading)

Vitja Makarov | 24 Apr 09:45 2012
Picon

Re: [Cython] Cython 0.16 issue Windows with Mingw32

2012/4/24 Stefan Behnel <stefan_ml@...>:
> Stefan Behnel, 23.04.2012 20:28:
>> Nathan Dunfield, 23.04.2012 17:58:
>>> I've encountered the following issue with Cython 0.16 on Windows with
>>> using the Mingw32 compiler (I'm using Python 3.2 here, but I don't think
>>> that's the issue):
>>>
>>> $ python3 setup.py build -c mingw32
>>> running build
>>> running build_py
>>> running build_ext
>>> skipping 'SnapPy.c' Cython extension (up-to-date)
>>> building 'snappy.SnapPy' extension
>>> c:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Iheaders -Iunix_kit -Iaddl_code -I.
-Ipari/pari-2.3.4/include/ -Ipari/pari-2.3.4/include/pari -Ic:\Python32\include
-Ic:\Python32\PC -c SnapPy.c -o build\temp.win32-3.2\Release\snappy.o
>>> SnapPy.c: In function `__pyx_f_6snappy_6SnapPy_13Triangulation_build_rep_into_Sn':
>>> SnapPy.c:25187: warning: implicit declaration of function `fg_get_num_orig_gens'
>>> SnapPy.c:25423: warning: implicit declaration of function `candidateSn_is_valid'
>>> SnapPy.c:25435: warning: implicit declaration of function `candidateSn_is_transitive'
>>> SnapPy.c: At top level:
>>> SnapPy.c:76434: error: initializer element is not constant
>>> SnapPy.c:76434: error: (near initialization for `__pyx_CyFunctionType_type.tp_call')
>>> error: command 'gcc' failed with exit status 1
>>
>> Hmm, that line basically just says "PyCFunction_Call", which is a function
>> exported by CPython. I wonder why gcc would consider this "not a constant".
>
> My guess is that it's a Windows-DLL issue. Maybe symbols exported by
> Windows-DLLs simply aren't "constant". We should be able to fix this by
(Continue reading)


Gmane