cython 0.9.6.13.1 fails with gcc 2.95.2 (compiling lxml)

Bug #215550 reported by Holger Joukl
2
Affects Status Importance Assigned to Milestone
Cython
Fix Committed
Medium
Unassigned

Bug Description

Trying to compile the latest lxml trunk with Cython 0.9.6.13.1 fails with gcc 2.95.2
(Support for older compilers has been temporarily lost before, e.g. #137002):

python2.4 setup.py build
Building lxml version 2.1.alpha1-53648.
Building with Cython 0.9.6.13.1.
Using build configuration of libxslt 1.1.20
Building against libxml2/libxslt in one of the following directories:
  /apps/prod//lib
  /data/pydev/DOWNLOADS/LXML/libxml2/libxml2-2.6.27
running build
running build_py
writing byte-compilation script '/tmp/tmpAQK0Ye.py'
/apps/pydev/bin/python2.4 -O /tmp/tmpAQK0Ye.py
removing /tmp/tmpAQK0Ye.py
running build_ext
building 'lxml.etree' extension
gcc -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/apps/prod//include -I/apps/prod//include/libxml2 -I/apps/prod/include/libxml2 -I/apps/prod/include -I/apps/pydev/include/python2.4 -c src/lxml/lxml.etree.c -o build/temp.solaris-2.8-sun4u-2.4/src/lxml/lxml.etree.o -w
src/lxml/lxml.etree.c: In function `init2etree':
src/lxml/lxml.etree.c:112054: parse error before `*'
src/lxml/lxml.etree.c:112085: `__pyx_1' undeclared (first use in this function)
src/lxml/lxml.etree.c:112085: (Each undeclared identifier is reported only once
src/lxml/lxml.etree.c:112085: for each function it appears in.)
src/lxml/lxml.etree.c:112106: `__pyx_2' undeclared (first use in this function)
src/lxml/lxml.etree.c:112124: `__pyx_3' undeclared (first use in this function)
src/lxml/lxml.etree.c:112127: `__pyx_4' undeclared (first use in this function)
src/lxml/lxml.etree.c:112136: `__pyx_5' undeclared (first use in this function)
src/lxml/lxml.etree.c:112139: `__pyx_6' undeclared (first use in this function)
src/lxml/lxml.etree.c:112343: `__pyx_7' undeclared (first use in this function)
src/lxml/lxml.etree.c:113493: `__pyx_8' undeclared (first use in this function)
src/lxml/lxml.etree.c:113565: `__pyx_9' undeclared (first use in this function)
src/lxml/lxml.etree.c:113574: `__pyx_10' undeclared (first use in this function)
src/lxml/lxml.etree.c:113575: `__pyx_11' undeclared (first use in this function)
src/lxml/lxml.etree.c:113662: `__pyx_12' undeclared (first use in this function)
src/lxml/lxml.etree.c:113663: `__pyx_13' undeclared (first use in this function)
error: command 'gcc' failed with exit status 1

I'd say this is due to variables being declared not _only_ at the start of the function,
which old (gcc) compilers are pretty anal about:

 112049 PyMODINIT_FUNC init2etree(void); /*proto*/
 112050 PyMODINIT_FUNC init2etree(void) {
 112051 static int __Pyx_unique = 0;
 112052 if (__Pyx_unique==1) return;
 112053 __Pyx_unique = 1;
 112054 PyObject *__pyx_1 = 0;
 112055 PyObject *__pyx_2 = 0;
 112056 int __pyx_3;

Holger

Revision history for this message
Holger Joukl (jholg) wrote :
Download full text (8.4 KiB)

While I *think* this should be a trivial fix for the problem:

diff -r e005b58d83b8 Cython/Compiler/ModuleNode.py
--- a/Cython/Compiler/ModuleNode.py Tue Apr 08 01:25:09 2008 -0700
+++ b/Cython/Compiler/ModuleNode.py Tue Apr 15 14:22:51 2008 +0200
@@ -1443,10 +1443,10 @@ class ModuleNode(Nodes.Node, Nodes.Block
         header = "PyMODINIT_FUNC init2%s(void)" % env.module_name
         code.putln("%s; /*proto*/" % header)
         code.putln("%s {" % header)
+ code.put_var_declarations(env.temp_entries)
         code.putln("static int __Pyx_unique = 0;")
         code.putln("if (__Pyx_unique==1) return;")
         code.putln("__Pyx_unique = 1;")
- code.put_var_declarations(env.temp_entries)
         code.putln("/*--- Execution code ---*/")
         code.mark_pos(None)
         self.body.generate_execution_code(code)

... I currently cannot test this, as I then run into other lxml compilation problems, see below.
However, I see these other problems also with gcc 4.2.1, so they don't seem related
to the compiler version, but rather be either an lxml-specific or a more general cython
problem.

gcc -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/apps/prod//include -I/apps/prod//include/libxml2 -I/apps/prod/include/libxml2 -I/apps/prod/include -I/apps/pydev/include/python2.4 -c src/lxml/lxml.objectify.c -o build/temp.solaris-2.8-sun4u-2.4/src/lxml/lxml.objectify.o -w
In file included from src/lxml/lxml.objectify.c:52:
src/lxml/lxml.etree_api.h: In function `import_lxml__etree':
src/lxml/lxml.etree_api.h:219: sizeof applied to an incomplete type
src/lxml/lxml.etree_api.h:220: sizeof applied to an incomplete type
src/lxml/lxml.etree_api.h:221: sizeof applied to an incomplete type
src/lxml/lxml.etree_api.h:222: sizeof applied to an incomplete type
src/lxml/lxml.etree_api.h:223: sizeof applied to an incomplete type
src/lxml/lxml.etree_api.h:224: sizeof applied to an incomplete type
src/lxml/lxml.etree_api.h:225: sizeof applied to an incomplete type
src/lxml/lxml.etree_api.h:226: sizeof applied to an incomplete type
src/lxml/lxml.objectify.c: At top level:
src/lxml/lxml.objectify.c:248: field `__pyx_base' has incomplete type
src/lxml/lxml.objectify.c:260: field `__pyx_base' has incomplete type
src/lxml/lxml.objectify.c:274: field `__pyx_base' has incomplete type
src/lxml/lxml.objectify.c:286: field `__pyx_base' has incomplete type
src/lxml/lxml.objectify.c:310: field `__pyx_base' has incomplete type
src/lxml/lxml.objectify.c:322: field `__pyx_base' has incomplete type
src/lxml/lxml.objectify.c:334: field `__pyx_base' has incomplete type
src/lxml/lxml.objectify.c: In function `__pyx_pf_4lxml_9objectify_18ObjectifiedElement_8__dict_____get__':
src/lxml/lxml.objectify.c:1150: dereferencing pointer to incomplete type
src/lxml/lxml.objectify.c:1150: dereferencing pointer to incomplete type
src/lxml/lxml.objectify.c:1165: dereferencing pointer to incomplete type
src/lxml/lxml.objectify.c:1216: dereferencing pointer to incomplete type
src/lxml/lxml.objectify.c: In function `__pyx_pf_4lxml_9objectify_18ObjectifiedElement___setattr__':
src/lxml/lxml.objectify.c:1714: dereferencing pointer to incomplete type
src/lx...

Read more...

Revision history for this message
scoder (scoder) wrote :

Ah, sorry this has been fixed by reverting the patch that introduced this (and a couple of other) problems. Try 0.9.6.12 for now, or the latest developer version of Cython.

http://hg.cython.org/cython-devel/

Changed in cython:
importance: Undecided → Medium
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.