[XML-SIG] PyXML-0.7.1 expat ext. build failed under sygwin

Dmitry Tikhostup dm_top@hotmail.com
Fri, 21 Jun 2002 06:03:10 +0800


Hello,

---------------------------------------------------------------
Target:
I need the XML SAX parser for Python under Cygwin.

---------------------------------------------------------------
Precondition:

*Windows 2000 Prof.
*CygWin ver.:  2.194.2.22
*GCC ver.:     2.95.3-5
    Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/specs
    gcc version 2.95.3-5 (cygwin special)
*Python ver.:  2.2.1
    $ python
    Python 2.2.1 (#1, Jun  6 2002, 16:53:43)
    [GCC 2.95.3-5 (cygwin special)] on cygwin

---------------------------------------------------------------
Description of the problem:

After unpacking of the tarball, the issuing the python setup.py build
cause the following compiling error during building the expat extention:

.
. -- copying ---
.
.
copying xml/xslt/_4xslt.py -> build/lib.cygwin-1.3.10-i686-2.2/_xmlplus/xslt
copying xml/xslt/__init__.py -> 
build/lib.cygwin-1.3.10-i686-2.2/_xmlplus/xslt
running build_ext
building '_xmlplus.parsers.pyexpat' extension
creating build/temp.cygwin-1.3.10-i686-2.2
gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -DUSE_DL_IMPORT -DHAVE_EXPAT_H 
-DV
ERSION="1.95.2" -DXML_NS=1 -DXML_DTD=1 -DXML_BYTE_ORDER=12 
-DXML_CONTEXT_BYTES=1
024 -Iextensions/expat/lib -I/usr/local/include/python2.2 -c 
extensions/pyexpat.
c -o build/temp.cygwin-1.3.10-i686-2.2/pyexpat.o
extensions/pyexpat.c:1709: initializer element is not constant
extensions/pyexpat.c:1709: (near initialization for 
`handler_info[2].setter')
extensions/pyexpat.c:1712: initializer element is not constant
extensions/pyexpat.c:1712: (near initialization for 
`handler_info[3].setter')
extensions/pyexpat.c:1715: initializer element is not constant
extensions/pyexpat.c:1715: (near initialization for 
`handler_info[4].setter')
extensions/pyexpat.c:1718: initializer element is not constant
extensions/pyexpat.c:1718: (near initialization for 
`handler_info[5].setter')
extensions/pyexpat.c:1727: initializer element is not constant
extensions/pyexpat.c:1727: (near initialization for 
`handler_info[8].setter')
extensions/pyexpat.c:1736: initializer element is not constant
extensions/pyexpat.c:1736: (near initialization for 
`handler_info[11].setter')
extensions/pyexpat.c:1739: initializer element is not constant
extensions/pyexpat.c:1739: (near initialization for 
`handler_info[12].setter')
extensions/pyexpat.c:1742: initializer element is not constant
extensions/pyexpat.c:1742: (near initialization for 
`handler_info[13].setter')
extensions/pyexpat.c:1745: initializer element is not constant
extensions/pyexpat.c:1745: (near initialization for 
`handler_info[14].setter')
extensions/pyexpat.c:1754: initializer element is not constant
extensions/pyexpat.c:1754: (near initialization for 
`handler_info[17].setter')
extensions/pyexpat.c:1757: initializer element is not constant
extensions/pyexpat.c:1757: (near initialization for 
`handler_info[18].setter')
extensions/pyexpat.c:1760: initializer element is not constant
extensions/pyexpat.c:1760: (near initialization for 
`handler_info[19].setter')
extensions/pyexpat.c:1763: initializer element is not constant
extensions/pyexpat.c:1763: (near initialization for 
`handler_info[20].setter')
error: command 'gcc' failed with exit status 1

---------------------------------------------------------------
Workaround:

the simple code review and primitive test like:
void funcA(int a, int b)
{
  printf("from A: %d, %d\n", a, b);
}

void funcB(int a, int b)
{
  printf("from B: %d, %d\n", a, b);
}

typedef void (*PF)(int, int);

struct S {
  const char * _F;
  PF           _pf;
};


extern struct S ars[2];

static struct S ars[] =
  {
    {"funcA", funcA },
    {"funcB", funcB },
  };

int main()
{
  printf("%s ", ars[0]._F);
  ars[0]._pf(1, 2);
  printf("%s ", ars[1]._F);
  ars[1]._pf(3, 4);

  return 0;
}

and
$ gcc -o test main.c

shows that everything should be all right. But it is not...

---------------------------------------------------------------
Searching the net:
1. I did not find the precompiled version of the PyXML for cygwin.
   Could you build and put on the site the precomiled version for the cygwin 
as well? I believe that cygwin's rpm would be more then enough.
2. The problem like "initializer element is not constant" is shown but the 
recommendations goes to the updating of the gcc compiler with unclear 
direction. That's possibly true, but instalation of the GNU's projects under 
cygwin is a different story.

With the best regards,
  Dmitri Tikhostoup
  e-mail: dm_top@hotmail.com



_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com