user/protobuf: FTBFS: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
Found on ppc64:
...
creating build/temp.linux-ppc64-cpython-311/google/protobuf/pyext
gcc -DNDEBUG -g -fwrapv -O3 -Wall -O2 -fno-omit-frame-pointer -ggdb -mcpu=970 -mtune=power9 -maltivec -mlong-double-64 -fno-inline-small-functions -g -O2 -fno-omit-frame-pointer -ggdb -mcpu=970 -mtune=power9 -maltivec -mlong-double-64 -fno-inline-small-functions -g -O2 -fno-omit-frame-pointer -ggdb -mcpu=970 -mtune=power9 -maltivec -mlong-double-64 -fno-inline-small-functions -g -DTHREAD_STACK_SIZE=0x100000 -O2 -fno-omit-frame-pointer -ggdb -mcpu=970 -mtune=power9 -maltivec -mlong-double-64 -fno-inline-small-functions -g -L/root/packages/user/protobuf/src/protobuf-3.20.3 -fPIC -I. -I../src -I/usr/include/python3.11 -c google/protobuf/pyext/descriptor.cc -o build/temp.linux-ppc64-cpython-311/google/protobuf/pyext/descriptor.o -Wno-write-strings -Wno-invalid-offsetof -Wno-sign-compare -Wno-unused-variable -std=c++14
google/protobuf/pyext/descriptor.cc: In function ‘bool google::protobuf::python::_CalledFromGeneratedFile(int)’:
google/protobuf/pyext/descriptor.cc:103:18: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
frame = frame->f_back;
^~
In file included from /usr/include/python3.11/Python.h:42,
from ./google/protobuf/pyext/descriptor.h:37,
from google/protobuf/pyext/descriptor.cc:33:
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
typedef struct _frame PyFrameObject;
^~~~~~
google/protobuf/pyext/descriptor.cc:109:12: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
if (frame->f_code->co_filename == nullptr) {
^~
In file included from /usr/include/python3.11/Python.h:42,
from ./google/protobuf/pyext/descriptor.h:37,
from google/protobuf/pyext/descriptor.cc:33:
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
typedef struct _frame PyFrameObject;
^~~~~~
In file included from /usr/include/python3.11/Python.h:44,
from ./google/protobuf/pyext/descriptor.h:37,
from google/protobuf/pyext/descriptor.cc:33:
google/protobuf/pyext/descriptor.cc:114:37: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
if (PyString_AsStringAndSize(frame->f_code->co_filename,
^~
/usr/include/python3.11/object.h:775:59: note: in definition of macro ‘PyType_FastSubclass’
#define PyType_FastSubclass(type, flag) PyType_HasFeature(type, flag)
^~~~
/usr/include/python3.11/object.h:107:28: note: in expansion of macro ‘_Py_CAST’
#define _PyObject_CAST(op) _Py_CAST(PyObject*, (op))
^~~~~~~~
/usr/include/python3.11/object.h:136:31: note: in expansion of macro ‘_PyObject_CAST’
# define Py_TYPE(ob) Py_TYPE(_PyObject_CAST(ob))
^~~~~~~~~~~~~~
/usr/include/python3.11/unicodeobject.h:115:25: note: in expansion of macro ‘Py_TYPE’
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS)
^~~~~~~
google/protobuf/pyext/descriptor.cc:54:4: note: in expansion of macro ‘PyUnicode_Check’
(PyUnicode_Check(ob) \
^~~~~~~~~~~~~~~
google/protobuf/pyext/descriptor.cc:114:7: note: in expansion of macro ‘PyString_AsStringAndSize’
if (PyString_AsStringAndSize(frame->f_code->co_filename,
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/python3.11/Python.h:42,
from ./google/protobuf/pyext/descriptor.h:37,
from google/protobuf/pyext/descriptor.cc:33:
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
typedef struct _frame PyFrameObject;
^~~~~~
google/protobuf/pyext/descriptor.cc:114:37: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
if (PyString_AsStringAndSize(frame->f_code->co_filename,
^~
google/protobuf/pyext/descriptor.cc:56:40: note: in definition of macro ‘PyString_AsStringAndSize’
PyUnicode_AsUTF8AndSize(ob, (sizep)))) == nullptr \
^~
In file included from /usr/include/python3.11/Python.h:42,
from ./google/protobuf/pyext/descriptor.h:37,
from google/protobuf/pyext/descriptor.cc:33:
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
typedef struct _frame PyFrameObject;
^~~~~~
google/protobuf/pyext/descriptor.cc:114:37: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
if (PyString_AsStringAndSize(frame->f_code->co_filename,
^~
google/protobuf/pyext/descriptor.cc:59:34: note: in definition of macro ‘PyString_AsStringAndSize’
: PyBytes_AsStringAndSize(ob, (charpp), (sizep)))
^~
In file included from /usr/include/python3.11/Python.h:42,
from ./google/protobuf/pyext/descriptor.h:37,
from google/protobuf/pyext/descriptor.cc:33:
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
typedef struct _frame PyFrameObject;
^~~~~~
google/protobuf/pyext/descriptor.cc:135:12: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
if (frame->f_globals != frame->f_locals) {
^~
In file included from /usr/include/python3.11/Python.h:42,
from ./google/protobuf/pyext/descriptor.h:37,
from google/protobuf/pyext/descriptor.cc:33:
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
typedef struct _frame PyFrameObject;
^~~~~~
google/protobuf/pyext/descriptor.cc:135:32: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
if (frame->f_globals != frame->f_locals) {
^~
In file included from /usr/include/python3.11/Python.h:42,
from ./google/protobuf/pyext/descriptor.h:37,
from google/protobuf/pyext/descriptor.cc:33:
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
typedef struct _frame PyFrameObject;
^~~~~~
error: command '/usr/local/bin/gcc' failed with exit code 1
>>> ERROR: protobuf: build failed
Due to Python 3.11
.