Skip to content

Fails to build with pybind11 3.0.2 #238

@StefanBruens

Description

@StefanBruens

The netgen code is incorrect, and now pybind detects the problem and rejects the code:

pybind/pybind11#5533

[  108s] In file included from /home/abuild/rpmbuild/BUILD/netgen-6.2.2602-build/netgen-6.2.2602/libsrc/core/python_ngcore.hpp:5:
[  108s] /usr/include/pybind11/pybind11.h: In instantiation of ‘pybind11::class_<type_, options>& pybind11::class_<type_, options>::def_property_static(const char*, const pybind11::cpp_function&, const pybind11::cpp_function&, const Extra& ...) [with Extra = {pybind11::is_method, pybind11::return_value_policy, pybind11::keep_alive<0, 1>}; type_ = netgen::Mesh; options = {std::shared_ptr<netgen::Mesh>}]’:
[  108s] /usr/include/pybind11/pybind11.h:2438:35:   required from ‘pybind11::class_<type_, options>& pybind11::class_<type_, options>::def_property(const char*, const pybind11::cpp_function&, const pybind11::cpp_function&, const Extra& ...) [with Extra = {pybind11::return_value_policy, pybind11::keep_alive<0, 1>}; type_ = netgen::Mesh; options = {std::shared_ptr<netgen::Mesh>}]’
[  108s]  2438 |         return def_property_static(name, fget, fset, is_method(*this), extra...);
[  108s]       |                ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  108s] /usr/include/pybind11/pybind11.h:2417:28:   required from ‘pybind11::class_<type_, options>& pybind11::class_<type_, options>::def_property(const char*, const Getter&, const Setter&, const Extra& ...) [with Getter = pybind11::cpp_function; Setter = std::nullptr_t; Extra = {pybind11::return_value_policy, pybind11::keep_alive<0, 1>}; type_ = netgen::Mesh; options = {std::shared_ptr<netgen::Mesh>}]’
[  108s]  2417 |         return def_property(
[  108s]       |                ~~~~~~~~~~~~^
[  108s]  2418 |             name, fget, cpp_function(method_adaptor<type>(fset), is_setter()), extra...);
[  108s]       |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  108s] /usr/include/pybind11/pybind11.h:2394:28:   required from ‘pybind11::class_<type_, options>& pybind11::class_<type_, options>::def_property_readonly(const char*, const pybind11::cpp_function&, const Extra& ...) [with Extra = {pybind11::return_value_policy, pybind11::keep_alive<0, 1>}; type_ = netgen::Mesh; options = {std::shared_ptr<netgen::Mesh>}]’
[  108s]  2394 |         return def_property(name, fget, nullptr, extra...);
[  108s]       |                ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  108s] /usr/include/pybind11/pybind11.h:2384:37:   required from ‘pybind11::class_<type_, options>& pybind11::class_<type_, options>::def_property_readonly(const char*, const Getter&, const Extra& ...) [with Getter = ExportNetgenMeshing(pybind11::module&)::<lambda(netgen::Mesh&)>; Extra = {pybind11::keep_alive<0, 1>}; type_ = netgen::Mesh; options = {std::shared_ptr<netgen::Mesh>}]’
[  108s]  2384 |         return def_property_readonly(name,
[  108s]       |                ~~~~~~~~~~~~~~~~~~~~~^~~~~~
[  108s]  2385 |                                      cpp_function(method_adaptor<type>(fget)),
[  108s]       |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  108s]  2386 |                                      return_value_policy::reference_internal,
[  108s]       |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  108s]  2387 |                                      extra...);
[  108s]       |                                      ~~~~~~~~~
[  108s] /home/abuild/rpmbuild/BUILD/netgen-6.2.2602-build/netgen-6.2.2602/libsrc/meshing/python_mesh.cpp:975:27:   required from here
[  108s]   734 |   py::class_<Mesh,shared_ptr<Mesh>>(m, "Mesh")
[  108s]       |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

...

[  108s] /usr/include/pybind11/pybind11.h:2462:25: error: static assertion failed: def_property family does not currently support keep_alive. Use a py::cpp_function instead.
[  108s]  2462 |         static_assert(0 == detail::constexpr_sum(detail::is_keep_alive<Extra>::value...),
[  108s]       |                       ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  108s] /usr/include/pybind11/pybind11.h:2462:25: note: the comparison reduces to ‘(0 == 1)’
[  108s] make[2]: *** [CMakeFiles/nglib.dir/build.make:1111: CMakeFiles/nglib.dir/libsrc/meshing/python_mesh.cpp.o] Error 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions