Bug 2103645

Summary: nextpnr: FTBFS in Fedora Rawhide: Outdated bundled pybind11 does not work with Python 3.11
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: nextpnrAssignee: Gabriel Somlo <somlo>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: lkundrak, mhroncok, somlo
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nextpnr-1-9.20220705git86396c4.fc36 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-07-14 01:45:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2016048, 2045102    

Description Tomáš Hrnčiar 2022-07-04 10:46:05 UTC
Description of problem:
Package nextpnr fails to build from source in Fedora Rawhide.

Version-Release number of selected component (if applicable):
1-8.20220611giteac864e.fc37

Steps to Reproduce:
koji build --scratch f37 nextpnr-1-8.20220611giteac864e.fc37.src.rpm

Additional info:
/builddir/build/BUILD/nextpnr-eac864ebdcdf7cf366e0dcbd5497e3c5cce3c479/3rdparty/pybind11/include/pybind11/cast.h: In function 'std::string pybind11::detail::error_string()':
/builddir/build/BUILD/nextpnr-eac864ebdcdf7cf366e0dcbd5497e3c5cce3c479/3rdparty/pybind11/include/pybind11/cast.h:446:36: error: invalid use of incomplete type 'PyFrameObject' {aka 'struct _frame'}
  446 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
      |                                    ^~
In file included from /usr/include/python3.11/Python.h:42,
                 from /builddir/build/BUILD/nextpnr-eac864ebdcdf7cf366e0dcbd5497e3c5cce3c479/common/kernel/pybindings.h:24:
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of 'PyFrameObject' {aka 'struct _frame'}
   22 | typedef struct _frame PyFrameObject;
      |                ^~~~~~
/builddir/build/BUILD/nextpnr-eac864ebdcdf7cf366e0dcbd5497e3c5cce3c479/3rdparty/pybind11/include/pybind11/cast.h:446:75: error: expected primary-expression before '>' token
  446 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
      |                                                                           ^
/builddir/build/BUILD/nextpnr-eac864ebdcdf7cf366e0dcbd5497e3c5cce3c479/3rdparty/pybind11/include/pybind11/cast.h:446:77: error: expected primary-expression before ')' token
  446 |                 "  " + handle(frame->f_code->co_filename).cast<std::string>() +
      |                                                                             ^
/builddir/build/BUILD/nextpnr-eac864ebdcdf7cf366e0dcbd5497e3c5cce3c479/3rdparty/pybind11/include/pybind11/cast.h:448:29: error: invalid use of incomplete type 'PyFrameObject' {aka 'struct _frame'}
  448 |                 handle(frame->f_code->co_name).cast<std::string>() + "\n";
      |                             ^~
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of 'PyFrameObject' {aka 'struct _frame'}
   22 | typedef struct _frame PyFrameObject;
      |                ^~~~~~
/builddir/build/BUILD/nextpnr-eac864ebdcdf7cf366e0dcbd5497e3c5cce3c479/3rdparty/pybind11/include/pybind11/cast.h:448:64: error: expected primary-expression before '>' token
  448 |                 handle(frame->f_code->co_name).cast<std::string>() + "\n";
      |                                                                ^
/builddir/build/BUILD/nextpnr-eac864ebdcdf7cf366e0dcbd5497e3c5cce3c479/3rdparty/pybind11/include/pybind11/cast.h:448:66: error: expected primary-expression before ')' token
  448 |                 handle(frame->f_code->co_name).cast<std::string>() + "\n";
      |                                                                  ^
/builddir/build/BUILD/nextpnr-eac864ebdcdf7cf366e0dcbd5497e3c5cce3c479/3rdparty/pybind11/include/pybind11/cast.h:449:26: error: invalid use of incomplete type 'PyFrameObject' {aka 'struct _frame'}
  449 |             frame = frame->f_back;
      |                          ^~
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of 'PyFrameObject' {aka 'struct _frame'}
   22 | typedef struct _frame PyFrameObject;
      |                ^~~~~~
/builddir/build/BUILD/nextpnr-eac864ebdcdf7cf366e0dcbd5497e3c5cce3c479/3rdparty/pybind11/include/pybind11/pybind11.h: In function 'pybind11::function pybind11::detail::get_type_override(const void*, const type_info*, const char*)':
/builddir/build/BUILD/nextpnr-eac864ebdcdf7cf366e0dcbd5497e3c5cce3c479/3rdparty/pybind11/include/pybind11/pybind11.h:2218:49: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'frame'; did you mean 'cframe'?
 2218 |     PyFrameObject *frame = PyThreadState_Get()->frame;
      |                                                 ^~~~~
      |                                                 cframe
/builddir/build/BUILD/nextpnr-eac864ebdcdf7cf366e0dcbd5497e3c5cce3c479/3rdparty/pybind11/include/pybind11/pybind11.h:2219:41: error: invalid use of incomplete type 'PyFrameObject' {aka 'struct _frame'}
 2219 |     if (frame && (std::string) str(frame->f_code->co_name) == name &&
      |                                         ^~
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of 'PyFrameObject' {aka 'struct _frame'}
   22 | typedef struct _frame PyFrameObject;
      |                ^~~~~~
/builddir/build/BUILD/nextpnr-eac864ebdcdf7cf366e0dcbd5497e3c5cce3c479/3rdparty/pybind11/include/pybind11/pybind11.h:2220:14: error: invalid use of incomplete type 'PyFrameObject' {aka 'struct _frame'}
 2220 |         frame->f_code->co_argcount > 0) {
      |              ^~
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of 'PyFrameObject' {aka 'struct _frame'}
   22 | typedef struct _frame PyFrameObject;
      |                ^~~~~~
/builddir/build/BUILD/nextpnr-eac864ebdcdf7cf366e0dcbd5497e3c5cce3c479/3rdparty/pybind11/include/pybind11/pybind11.h:2223:18: error: invalid use of incomplete type 'PyFrameObject' {aka 'struct _frame'}
 2223 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
      |                  ^~
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of 'PyFrameObject' {aka 'struct _frame'}
   22 | typedef struct _frame PyFrameObject;
      |                ^~~~~~
In file included from /usr/include/python3.11/Python.h:35:
/builddir/build/BUILD/nextpnr-eac864ebdcdf7cf366e0dcbd5497e3c5cce3c479/3rdparty/pybind11/include/pybind11/pybind11.h:2223:52: error: invalid use of incomplete type 'PyFrameObject' {aka 'struct _frame'}
 2223 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
      |                                                    ^~
/usr/include/python3.11/tupleobject.h:27:18: note: in expansion of macro 'PyType_FastSubclass'
   27 |                  PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS)
      |                  ^~~~~~~~~~~~~~~~~~~
/usr/include/python3.11/object.h:107:28: note: in expansion of macro '_Py_CAST'
  107 | #define _PyObject_CAST(op) _Py_CAST(PyObject*, (op))
      |                            ^~~~~~~~
/usr/include/python3.11/object.h:136:31: note: in expansion of macro '_PyObject_CAST'
  136 | #  define Py_TYPE(ob) Py_TYPE(_PyObject_CAST(ob))
      |                               ^~~~~~~~~~~~~~
/usr/include/python3.11/tupleobject.h:27:38: note: in expansion of macro 'Py_TYPE'
   27 |                  PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS)
      |                                      ^~~~~~~
/usr/include/python3.11/cpython/tupleobject.h:18:13: note: in expansion of macro 'PyTuple_Check'
   18 |     (assert(PyTuple_Check(op)), _Py_CAST(PyTupleObject*, (op)))
      |             ^~~~~~~~~~~~~
/usr/include/python3.11/cpython/tupleobject.h:30:38: note: in expansion of macro '_PyTuple_CAST'
   30 | #define PyTuple_GET_ITEM(op, index) (_PyTuple_CAST(op)->ob_item[index])
      |                                      ^~~~~~~~~~~~~
/builddir/build/BUILD/nextpnr-eac864ebdcdf7cf366e0dcbd5497e3c5cce3c479/3rdparty/pybind11/include/pybind11/pybind11.h:2223:30: note: in expansion of macro 'PyTuple_GET_ITEM'
 2223 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
      |                              ^~~~~~~~~~~~~~~~
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of 'PyFrameObject' {aka 'struct _frame'}
   22 | typedef struct _frame PyFrameObject;
      |                ^~~~~~
In file included from /usr/include/python3.11/Python.h:38:
/builddir/build/BUILD/nextpnr-eac864ebdcdf7cf366e0dcbd5497e3c5cce3c479/3rdparty/pybind11/include/pybind11/pybind11.h:2223:52: error: invalid use of incomplete type 'PyFrameObject' {aka 'struct _frame'}
 2223 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
      |                                                    ^~
/usr/include/python3.11/pyport.h:65:52: note: in definition of macro '_Py_CAST'
   65 | #  define _Py_CAST(type, expr) _Py_CAST_impl<type>(expr)
      |                                                    ^~~~
/usr/include/python3.11/cpython/tupleobject.h:30:38: note: in expansion of macro '_PyTuple_CAST'
   30 | #define PyTuple_GET_ITEM(op, index) (_PyTuple_CAST(op)->ob_item[index])
      |                                      ^~~~~~~~~~~~~
/builddir/build/BUILD/nextpnr-eac864ebdcdf7cf366e0dcbd5497e3c5cce3c479/3rdparty/pybind11/include/pybind11/pybind11.h:2223:30: note: in expansion of macro 'PyTuple_GET_ITEM'
 2223 |             frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
      |                              ^~~~~~~~~~~~~~~~
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of 'PyFrameObject' {aka 'struct _frame'}
   22 | typedef struct _frame PyFrameObject;
      |                ^~~~~~

The problem comes from bundled pybind11. This was already fixed so updating bundled pybind11 should help.

Comment 2 Gabriel Somlo 2022-07-04 21:58:16 UTC
Submitted upstream PR: https://github.com/YosysHQ/nextpnr/pull/1002

Will submit for build once I get feedback on the above.

Comment 3 Fedora Update System 2022-07-05 19:25:38 UTC
FEDORA-2022-0dbe79fe63 has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-0dbe79fe63

Comment 4 Fedora Update System 2022-07-06 02:16:14 UTC
FEDORA-2022-0dbe79fe63 has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-0dbe79fe63`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-0dbe79fe63

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 5 Fedora Update System 2022-07-14 01:45:56 UTC
FEDORA-2022-0dbe79fe63 has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.