cython 0.9.6.13.1 fails with gcc 2.95.2 (compiling lxml)
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/
running build
running build_py
writing byte-compilation script '/tmp/tmpAQK0Ye.py'
/apps/pydev/
removing /tmp/tmpAQK0Ye.py
running build_ext
building 'lxml.etree' extension
gcc -fno-strict-
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
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
While I *think* this should be a trivial fix for the problem:
diff -r e005b58d83b8 Cython/ Compiler/ ModuleNode. py Compiler/ ModuleNode. py Tue Apr 08 01:25:09 2008 -0700 Compiler/ ModuleNode. py Tue Apr 15 14:22:51 2008 +0200 Nodes.Node, Nodes.Block
code. putln(" %s; /*proto*/" % header)
code. putln(" %s {" % header) var_declaration s(env.temp_ entries)
code. putln(" static int __Pyx_unique = 0;")
code. putln(" if (__Pyx_unique==1) return;")
code. putln(" __Pyx_unique = 1;") var_declaration s(env.temp_ entries)
code. putln(" /*--- Execution code ---*/")
code. mark_pos( None)
self. body.generate_ execution_ code(code)
--- a/Cython/
+++ b/Cython/
@@ -1443,10 +1443,10 @@ class ModuleNode(
header = "PyMODINIT_FUNC init2%s(void)" % env.module_name
+ code.put_
- code.put_
... 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 lxml.objectify. c:52: lxml.etree_ api.h: In function `import_ lxml__etree' : lxml.etree_ api.h:219: sizeof applied to an incomplete type lxml.etree_ api.h:220: sizeof applied to an incomplete type lxml.etree_ api.h:221: sizeof applied to an incomplete type lxml.etree_ api.h:222: sizeof applied to an incomplete type lxml.etree_ api.h:223: sizeof applied to an incomplete type lxml.etree_ api.h:224: sizeof applied to an incomplete type lxml.etree_ api.h:225: sizeof applied to an incomplete type lxml.etree_ api.h:226: sizeof applied to an incomplete type lxml.objectify. c: At top level: lxml.objectify. c:248: field `__pyx_base' has incomplete type lxml.objectify. c:260: field `__pyx_base' has incomplete type lxml.objectify. c:274: field `__pyx_base' has incomplete type lxml.objectify. c:286: field `__pyx_base' has incomplete type lxml.objectify. c:310: field `__pyx_base' has incomplete type lxml.objectify. c:322: field `__pyx_base' has incomplete type lxml.objectify. c:334: field `__pyx_base' has incomplete type lxml.objectify. c: In function `__pyx_ pf_4lxml_ 9objectify_ 18ObjectifiedEl ement_8_ _dict__ ___get_ _': lxml.objectify. c:1150: dereferencing pointer to incomplete type lxml.objectify. c:1150: dereferencing pointer to incomplete type lxml.objectify. c:1165: dereferencing pointer to incomplete type lxml.objectify. c:1216: dereferencing pointer to incomplete type lxml.objectify. c: In function `__pyx_ pf_4lxml_ 9objectify_ 18ObjectifiedEl ement__ _setattr_ _': lxml.objectify. c:1714: dereferencing pointer to incomplete type
In file included from src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lxml/
src/lx...