This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Can't Built libxml2 When Using Python 3.9.x
Type: compile error Stage: resolved
Components: C API Versions: Python 3.9
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: boom0192
Priority: normal Keywords:

Created on 2021-01-05 23:53 by boom0192, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (7)
msg384443 - (view) Author: Michael L. Boom (boom0192) Date: 2021-01-05 23:53
When building libxml2 using Python 3.9.0 or Python 3.9.1 and gcc 10.2.0 I get the below error.  Others are having this problem according to my Google search.
make[4]: Entering directory '/local/users/michael.l.boom/gits/scoring_engine/git/aae_tmp_dir/libxml2-2.9.10/python'
  CC       libxml.lo
  CC       libxml2-py.lo
  CC       types.lo
In file included from /local/users/michael.l.boom/gits/scoring_engine/git/aae_build_python_3.9.1/include/python3.9/pytime.h:6,
                 from /local/users/michael.l.boom/gits/scoring_engine/git/aae_build_python_3.9.1/include/python3.9/Python.h:85,
                 from libxml_wrap.h:1,
                 from types.c:9:
types.c: In function ‘libxml_xmlXPathObjectPtrConvert’:
/local/users/michael.l.boom/gits/scoring_engine/git/aae_build_python_3.9.1/include/python3.9/object.h:633:41: error: expected ‘(’ before ‘PyType_HasFeature’
  633 | #define PyType_FastSubclass(type, flag) PyType_HasFeature(type, flag)
      |                                         ^~~~~~~~~~~~~~~~~
/local/users/michael.l.boom/gits/scoring_engine/git/aae_build_python_3.9.1/include/python3.9/longobject.h:15:9: note: in expansion of macro ‘PyType_FastSubclass’
   15 |         PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS)
      |         ^~~~~~~~~~~~~~~~~~~
types.c:607:15: note: in expansion of macro ‘PyLong_Check’
  607 |     } else if PyLong_Check(obj) {
      |               ^~~~~~~~~~~~
types.c:607:33: error: expected ‘;’ before ‘{’ token
  607 |     } else if PyLong_Check(obj) {
      |                                 ^
libxml.c: In function ‘xmlPythonFileCloseRaw’:
libxml.c:259:5: warning: ‘PyEval_CallMethod’ is deprecated [-Wdeprecated-declarations]
  259 |     ret = PyEval_CallMethod(file, (char *) "close", (char *) "()");
      |     ^~~
In file included from /local/users/michael.l.boom/gits/scoring_engine/git/aae_build_python_3.9.1/include/python3.9/Python.h:145,
                 from libxml.c:14:
/local/users/michael.l.boom/gits/scoring_engine/git/aae_build_python_3.9.1/include/python3.9/ceval.h:28:43: note: declared here
   28 | Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyEval_CallMethod(
      |                                           ^~~~~~~~~~~~~~~~~
libxml.c: In function ‘xmlPythonFileReadRaw’:
libxml.c:289:5: warning: ‘PyEval_CallMethod’ is deprecated [-Wdeprecated-declarations]
  289 |     ret = PyEval_CallMethod(file, (char *) "read", (char *) "(i)", len);
      |     ^~~
In file included from /local/users/michael.l.boom/gits/scoring_engine/git/aae_build_python_3.9.1/include/python3.9/Python.h:145,
                 from libxml.c:14:
/local/users/michael.l.boom/gits/scoring_engine/git/aae_build_python_3.9.1/include/python3.9/ceval.h:28:43: note: declared here
   28 | Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyEval_CallMethod(
      |                                           ^~~~~~~~~~~~~~~~~
In file included from /local/users/michael.l.boom/gits/scoring_engine/git/aae_build_python_3.9.1/include/python3.9/pytime.h:6,
                 from /local/users/michael.l.boom/gits/scoring_engine/git/aae_build_python_3.9.1/include/python3.9/Python.h:85,
                 from libxml.c:14:
/local/users/michael.l.boom/gits/scoring_engine/git/aae_build_python_3.9.1/include/python3.9/object.h:633:41: error: expected ‘(’ before ‘PyType_HasFeature’
  633 | #define PyType_FastSubclass(type, flag) PyType_HasFeature(type, flag)
      |                                         ^~~~~~~~~~~~~~~~~
/local/users/michael.l.boom/gits/scoring_engine/git/aae_build_python_3.9.1/include/python3.9/unicodeobject.h:115:18: note: in expansion of macro ‘PyType_FastSubclass’
  115 |                  PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS)
      |                  ^~~~~~~~~~~~~~~~~~~
libxml.c:297:15: note: in expansion of macro ‘PyUnicode_Check’
  297 |     } else if PyUnicode_Check (ret) {
      |               ^~~~~~~~~~~~~~~
libxml.c:297:37: error: expected ‘;’ before ‘{’ token
  297 |     } else if PyUnicode_Check (ret) {
      |                                     ^
libxml.c: In function ‘xmlPythonFileRead’:
libxml.c:354:5: warning: ‘PyEval_CallMethod’ is deprecated [-Wdeprecated-declarations]
  354 |     ret = PyEval_CallMethod(file, (char *) "io_read", (char *) "(i)", len);
      |     ^~~
In file included from /local/users/michael.l.boom/gits/scoring_engine/git/aae_build_python_3.9.1/include/python3.9/Python.h:145,
                 from libxml.c:14:
/local/users/michael.l.boom/gits/scoring_engine/git/aae_build_python_3.9.1/include/python3.9/ceval.h:28:43: note: declared here
   28 | Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyEval_CallMethod(
      |                                           ^~~~~~~~~~~~~~~~~
In file included from /local/users/michael.l.boom/gits/scoring_engine/git/aae_build_python_3.9.1/include/python3.9/pytime.h:6,
                 from /local/users/michael.l.boom/gits/scoring_engine/git/aae_build_python_3.9.1/include/python3.9/Python.h:85,
                 from libxml.c:14:
/local/users/michael.l.boom/gits/scoring_engine/git/aae_build_python_3.9.1/include/python3.9/object.h:633:41: error: expected ‘(’ before ‘PyType_HasFeature’
  633 | #define PyType_FastSubclass(type, flag) PyType_HasFeature(type, flag)
      |                                         ^~~~~~~~~~~~~~~~~
/local/users/michael.l.boom/gits/scoring_engine/git/aae_build_python_3.9.1/include/python3.9/unicodeobject.h:115:18: note: in expansion of macro ‘PyType_FastSubclass’
  115 |                  PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS)
      |                  ^~~~~~~~~~~~~~~~~~~
libxml.c:362:15: note: in expansion of macro ‘PyUnicode_Check’
  362 |     } else if PyUnicode_Check (ret) {
      |               ^~~~~~~~~~~~~~~
libxml.c:362:37: error: expected ‘;’ before ‘{’ token
  362 |     } else if PyUnicode_Check (ret) {
      |                                     ^
msg384451 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2021-01-06 00:11
Have you approached the libxml2 developers with this problem?
msg384457 - (view) Author: Michael L. Boom (boom0192) Date: 2021-01-06 00:35
I thought the problem was in a Python file.  Perhaps I am mistaken.  The libxml2 builds fine when using Python 3.8.x.
msg384460 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2021-01-06 00:55
Maybe libxml is using a deprecated API or an invalid combination of command line flags. I don't feel like debugging this until there's a clearer indication of who's at fault.
msg384468 - (view) Author: Michael L. Boom (boom0192) Date: 2021-01-06 04:41
The gcc 10.x thinks that the right side of the expression on incoude/python3.9/object.h should be in parentheses.  It seems like a Python bug.  Perhaps earlier versions of gcc didn't have a problem with this.

/local/users/michael.l.boom/gits/scoring_engine/git/aae_build_python_3.9.1/include/python3.9/object.h:633:41: error: expected ‘(’ before ‘PyType_HasFeature’
  633 | #define PyType_FastSubclass(type, flag) PyType_HasFeature(type, flag)
msg384471 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2021-01-06 05:18
Looks to me like this line is at fault:

  607 |     } else if PyLong_Check(obj) {

That's not valid C. In the GitHub mirror this line has been corrected.
msg384473 - (view) Author: Michael L. Boom (boom0192) Date: 2021-01-06 05:29
The gcc 10.x seems to think this is also a bug:

/local/users/michael.l.boom/gits/scoring_engine/git/aae_build_python_3.9.1/include/python3.9/object.h:633:41: error: expected ‘(’ before ‘PyType_HasFeature’
  633 | #define PyType_FastSubclass(type, flag) PyType_HasFeature(type, flag)
History
Date User Action Args
2022-04-11 14:59:39adminsetgithub: 87001
2021-01-06 05:34:58gvanrossumsetnosy: - gvanrossum
2021-01-06 05:29:59boom0192setmessages: + msg384473
2021-01-06 05:18:02gvanrossumsetstatus: open -> closed
resolution: third party
messages: + msg384471

stage: resolved
2021-01-06 04:41:22boom0192setmessages: + msg384468
2021-01-06 00:55:46gvanrossumsetmessages: + msg384460
2021-01-06 00:35:15boom0192setmessages: + msg384457
2021-01-06 00:11:06gvanrossumsetnosy: + gvanrossum
messages: + msg384451
2021-01-05 23:53:31boom0192create