Re: Pybind11 ver 3.0.2 errors

Ryan Volz <[email protected]> Fri, 6 Mar 2026 15:27:02 -0500
Newsgroups gmane.comp.gnu.radio.general
Message-ID <[email protected]>
On 3/6/26 2:22 PM, Gisle Vanem wrote:
> Hi folks.
> 
> I upgraded my Python from 3.10.5 with a pybind11
> version 3.0.1 that has worked fine with GnuRadio
> for years.
> 
> Then yesterday I upgraded my Python to 3.14.2 with
> a fresh 'py -3 -m pip install pybind11' which is
> version 3.0.2.
> 
> This has causes a lot of troubles in building some
> GnuRadio .PYDs. Like when compiling
> gr-digital/python/digital/bindings/ofdm_serializer_vcc_python.cc:
> 
> In file included from ofdm_serializer_vcc_python.cc:20:
> In file included from F:/gv/Python314/Lib/site-packages/pybind11/ 
> include\pybind11/complex.h:12:
> In file included from F:/gv/Python314/Lib/site-packages/pybind11/ 
> include\pybind11\pybind11.h:12:
> In file included from F:/gv/Python314/Lib/site-packages/pybind11/ 
> include\pybind11\detail/class.h:12:
> In file included from F:/gv/Python314/Lib/site-packages/pybind11/ 
> include\pybind11/attr.h:13:
> In file included from F:/gv/Python314/Lib/site-packages/pybind11/ 
> include\pybind11\detail/common.h:225:
> f:\gv\VC_2026\VC\Tools\MSVC\14.50.35717\include\memory(2028,23): error: 
> cannot cast 'gr::basic_block *' to 'typename 
> shared_ptr<gr::digital::ofdm_carrier_allocator_cvc>::element_type *'
> (aka 'gr::digital::ofdm_carrier_allocator_cvc *') via virtual base 
> 'gr::tagged_stream_block'
>   2028 |     const auto _Ptr = static_cast<typename 
> shared_ptr<_Ty1>::element_type*>(_Other.get());
>        |                       
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> F:/gv/Python314/Lib/site-packages/pybind11/include\pybind11\detail/ 
> holder_caster_foreign_helpers.h(40,32): note: in instantiation of
>        function template specialization 
> 'std::static_pointer_cast<gr::digital::ofdm_carrier_allocator_cvc, 
> gr::basic_block>' requested here
>     40 |             *holder_out = 
> std::static_pointer_cast<type>(existing);
>        |                                ^
> ...
> 
> ofdm_serializer_vcc_python.cc(57,10): note: in instantiation of function 
> template specialization
>        'pybind11::class_<gr::digital::ofdm_serializer_vcc, 
> gr::tagged_stream_block,
>        
> std::shared_ptr<gr::digital::ofdm_serializer_vcc>>::def<std::shared_ptr<gr::digital::ofdm_serializer_vcc> (*)(const std::shared_ptr<gr::digital::ofdm_carrier_allocator_cvc> &, const std::basic_string<char> &,
>     int, const std::basic_string<char> &, bool),
>     pybind11::detail::void_type (*)(), 
> std::shared_ptr<gr::digital::ofdm_serializer_vcc> (
>     const std::shared_ptr<gr::digital::ofdm_carrier_allocator_cvc> &, 
> const std::basic_string<char> &,
>     int, const std::basic_string<char> &, bool), 
> pybind11::detail::void_type (), pybind11::arg,
>     pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, 
> const char *>'
> requested here
>     57 |         .def(py::init((std::shared_ptr<ofdm_serializer_vcc>(*)(
>        |          ^
> 1 error generated.
> 
> ------------------------
> 
> So I ended up with:
>    pip3 uninstall pybind11
>    pip3 install pybind11==3.0.1
> 
> Has anybody else seen such issues with pybind11 3.0.2?
> 
> 

Hi,

I have seen the same recently in building the `gnuradio` package for 
conda-forge. It seems to be an upstream bug:
https://github.com/pybind/pybind11/issues/5989

For now I have also fallen back to building with pybind11 3.0.1 and hope 
the pybind11 developers will address it in the next release.

Cheers,
Ryan