469,628 Members | 1,001 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,628 developers. It's quick & easy.

"initializer element is not constant"

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

May 30 '06 #1
1 2529
em************@gmail.com wrote:
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
sc***********@acm.org
May 30 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Todd Nathan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.