"initializer element is not constant"

E

emin.martinian

When trying to compile python extensions written in C using "python
setup.py build" on cygwin I get the following error:

foo.c: initializer element is not constant
foo.c: error: (near initialization for `FooType.ob_type')

I remember someone telling me a long time ago that this had something
to do with declspec and how dlls are imported on cygwin/python. Can
someone give me a pointer to how to build python extensions on cygwin?

Thanks
 
S

Scott David Daniels

When trying to compile python extensions written in C using "python
setup.py build" on cygwin I get the following error:

foo.c: initializer element is not constant
foo.c: error: (near initialization for `FooType.ob_type')

I remember someone telling me a long time ago that this had something
to do with declspec and how dlls are imported on cygwin/python. Can
someone give me a pointer to how to build python extensions on cygwin?

Essentially, Python and its extensions must be compatibly compiled.
The distributed Windows python is compatible with MS C/C++ and (as a
result) also compatible with the Intel C/C++ compilers. In addition,
"MinGW" (Minimal GNU for Windows) can compile C source to be compatible
with and use the MS C runtimes. If you really want cygwin, you need to
compile the whole of Python with cygmin (I've no idea if that compile
cleanly). If you want to use the MinGW approach, your call to setup is
something like "python setup.py -compiler=mingw32 -build " (look it up,
there are more details to know about.

--Scott David Daniels
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top