zeek / broker

Zeek's Messaging Library

Home Page:https://docs.zeek.org/projects/broker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update pybind11 for compatibility with Python 3.11

davide125 opened this issue · comments

Building zeek when using Python 3.11 currently fails with

[ 22%] Building CXX object auxil/broker/bindings/python/CMakeFiles/_broker.dir/_broker.cpp.o
cd /builddir/build/BUILD/zeek-4.2.0/redhat-linux-build/auxil/broker/bindings/python && /usr/lib64/ccache/g++ -DDOCTEST_CONFIG_DISABLE -D_broker_EXPORTS -I/builddir/build/BUILD/zeek-4.2.0/auxil/broker/3rdparty -I/builddir/build/BUILD/zeek-4.2.0/auxil/broker/include -I/builddir/build/BUILD/zeek-4.2.0/redhat-linux-build/auxil/broker/caf/libcaf_test -I/builddir/build/BUILD/zeek-4.2.0/auxil/broker/caf/libcaf_test -I/builddir/build/BUILD/zeek-4.2.0/redhat-linux-build/auxil/broker/caf/libcaf_openssl -I/builddir/build/BUILD/zeek-4.2.0/auxil/broker/caf/libcaf_openssl -I/builddir/build/BUILD/zeek-4.2.0/redhat-linux-build/auxil/broker/caf/libcaf_io -I/builddir/build/BUILD/zeek-4.2.0/auxil/broker/caf/libcaf_io -I/builddir/build/BUILD/zeek-4.2.0/redhat-linux-build/auxil/broker/caf/libcaf_core -I/builddir/build/BUILD/zeek-4.2.0/auxil/broker/caf/libcaf_core -I/builddir/build/BUILD/zeek-4.2.0/redhat-linux-build/auxil/broker/include -I/builddir/build/BUILD/zeek-4.2.0/auxil/broker/bindings/python/3rdparty/pybind11/include -I/usr/include/python3.11 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wall -Wno-unused -Wno-register -Werror=vla -O2 -g -DNDEBUG -fPIC   -msse2 -fvisibility=hidden -flto -MD -MT auxil/broker/bindings/python/CMakeFiles/_broker.dir/_broker.cpp.o -MF CMakeFiles/_broker.dir/_broker.cpp.o.d -o CMakeFiles/_broker.dir/_broker.cpp.o -c /builddir/build/BUILD/zeek-4.2.0/auxil/broker/bindings/python/_broker.cpp
In file included from /builddir/build/BUILD/zeek-4.2.0/auxil/broker/bindings/python/3rdparty/pybind11/include/pybind11/attr.h:13,
                 from /builddir/build/BUILD/zeek-4.2.0/auxil/broker/bindings/python/3rdparty/pybind11/include/pybind11/pybind11.h:45,
                 from /builddir/build/BUILD/zeek-4.2.0/auxil/broker/bindings/python/3rdparty/pybind11/include/pybind11/functional.h:12,
                 from /builddir/build/BUILD/zeek-4.2.0/auxil/broker/bindings/python/_broker.cpp:13:
/builddir/build/BUILD/zeek-4.2.0/auxil/broker/bindings/python/3rdparty/pybind11/include/pybind11/cast.h: In function 'std::string pybind11::detail::error_string()':
/builddir/build/BUILD/zeek-4.2.0/auxil/broker/bindings/python/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/zeek-4.2.0/auxil/broker/bindings/python/3rdparty/pybind11/include/pybind11/detail/common.h:122,
                 from /builddir/build/BUILD/zeek-4.2.0/auxil/broker/bindings/python/3rdparty/pybind11/include/pybind11/pytypes.h:12,
                 from /builddir/build/BUILD/zeek-4.2.0/auxil/broker/bindings/python/3rdparty/pybind11/include/pybind11/cast.h:13:
/usr/include/python3.11/pytypedefs.h:22:16: note: forward declaration of 'PyFrameObject' {aka 'struct _frame'}
   22 | typedef struct _frame PyFrameObject;
      |                ^~~~~~
/builddir/build/BUILD/zeek-4.2.0/auxil/broker/bindings/python/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/zeek-4.2.0/auxil/broker/bindings/python/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/zeek-4.2.0/auxil/broker/bindings/python/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/zeek-4.2.0/auxil/broker/bindings/python/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/zeek-4.2.0/auxil/broker/bindings/python/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/zeek-4.2.0/auxil/broker/bindings/python/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/zeek-4.2.0/auxil/broker/bindings/python/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/zeek-4.2.0/auxil/broker/bindings/python/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/zeek-4.2.0/auxil/broker/bindings/python/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/zeek-4.2.0/auxil/broker/bindings/python/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/zeek-4.2.0/auxil/broker/bindings/python/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:38:
/builddir/build/BUILD/zeek-4.2.0/auxil/broker/bindings/python/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/zeek-4.2.0/auxil/broker/bindings/python/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 /builddir/build/BUILD/zeek-4.2.0/auxil/broker/caf/libcaf_core/caf/actor_config.hpp:14,
                 from /builddir/build/BUILD/zeek-4.2.0/auxil/broker/caf/libcaf_core/caf/actor_system.hpp:21,
                 from /builddir/build/BUILD/zeek-4.2.0/auxil/broker/caf/libcaf_core/caf/actor_factory.hpp:11,
                 from /builddir/build/BUILD/zeek-4.2.0/auxil/broker/caf/libcaf_core/caf/actor_system_config.hpp:15,
                 from /builddir/build/BUILD/zeek-4.2.0/auxil/broker/include/broker/configuration.hh:3,
                 from /builddir/build/BUILD/zeek-4.2.0/auxil/broker/bindings/python/_broker.cpp:21:
/builddir/build/BUILD/zeek-4.2.0/auxil/broker/caf/libcaf_core/caf/input_range.hpp: At global scope:
/builddir/build/BUILD/zeek-4.2.0/auxil/broker/caf/libcaf_core/caf/input_range.hpp:24:32: warning: 'template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> struct std::iterator' is deprecated [-Wdeprecated-declarations]
   24 |   class iterator : public std::iterator<std::input_iterator_tag, T> {
      |                                ^~~~~~~~
In file included from /usr/include/c++/12/string:45,
                 from /builddir/build/BUILD/zeek-4.2.0/auxil/broker/bindings/python/_broker.cpp:5:
/usr/include/c++/12/bits/stl_iterator_base_types.h:127:34: note: declared here
  127 |     struct _GLIBCXX17_DEPRECATED iterator
      |                                  ^~~~~~~~
gmake[2]: Leaving directory '/builddir/build/BUILD/zeek-4.2.0/redhat-linux-build'
gmake[1]: Leaving directory '/builddir/build/BUILD/zeek-4.2.0/redhat-linux-build'
gmake[2]: *** [auxil/broker/bindings/python/CMakeFiles/_broker.dir/build.make:79: auxil/broker/bindings/python/CMakeFiles/_broker.dir/_broker.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:3070: auxil/broker/bindings/python/CMakeFiles/_broker.dir/all] Error 2
gmake: *** [Makefile:159: all] Error 2

This is an issue in pybind11 that should be already fixed upstream, consider updating it to the latest version (2.9.2 as of this time).

Sorry for the late response and thank you for filing an issue! I'll take a look whether updating pybind breaks anything.