Skip to content

Build errors in pybind11_protobuf with Protobuf 35.1 #5254

Description

@kiefernforst

What version of OR-Tools and what language are you using?

98c165a
GCC 15.2.1
probotuf 35.1
pybind 2.13.6 (if used)
Python 3.10

CMake options:

    -DBUILD_SHARED_LIBS=TRUE \
    -DCMAKE_CXX_STANDARD=17 \
    -DBUILD_CXX=ON \
    -DCMAKE_CXX_FLAGS="-Wno-format-security" \
    -DBUILD_CXX_EXAMPLES=OFF \
    -DBUILD_CXX_SAMPLES=OFF \
    -DBUILD_DOTNET=OFF \
    -DBUILD_JAVA=OFF \
    -DBUILD_PYTHON=ON \
    -DBUILD_SAMPLES=OFF \
    -DBUILD_DEPS=OFF \
    -DBUILD_pybind11_abseil=ON \
    -DBUILD_pybind11_protobuf=ON \
    -DUSE_CPLEX=OFF \
    -DUSE_COINOR=ON \
    -DUSE_GLPK=ON \
    -DUSE_HIGHS=OFF \
    -DUSE_SCIP=ON \
    -DUSE_SYSTEM_ABSEIL=ON \
    -DUSE_SYSTEM_PROTOBUF=ON \
    -DUSE_SYSTEM_PYBIND=ON \
    -DVENV_USE_SYSTEM_SITE_PACKAGES=ON \
    -DGENERATE_PYTHON_STUB=OFF \
    -Wno-dev

leads to:

./build/_deps/pybind11_protobuf-src/pybind11_protobuf/proto_cast_util.cc:358:10: error: 'bool pybind11_protobuf::{anonymous}::PythonDescriptorPoolWrapper::DescriptorPoolDatabase::FindFileByName(const std::string&, google::protobuf::FileDescriptorProto*)' marked 'override', but does not override
  358 |     bool FindFileByName(const std::string& filename,
      |          ^~~~~~~~~~~~~~
./build/_deps/pybind11_protobuf-src/pybind11_protobuf/proto_cast_util.cc:374:10: error: 'bool pybind11_protobuf::{anonymous}::PythonDescriptorPoolWrapper::DescriptorPoolDatabase::FindFileContainingSymbol(const std::string&, google::protobuf::FileDescriptorProto*)' marked 'override', but does not override
  374 |     bool FindFileContainingSymbol(const std::string& symbol_name,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
./build/_deps/pybind11_protobuf-src/pybind11_protobuf/proto_cast_util.cc:392:10: error: 'bool pybind11_protobuf::{anonymous}::PythonDescriptorPoolWrapper::DescriptorPoolDatabase::FindFileContainingExtension(const std::string&, int, google::protobuf::FileDescriptorProto*)' marked 'override', but does not override
  392 |     bool FindFileContainingExtension(const std::string& containing_type,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/15.2.1/memory:80,
                 from /usr/include/pybind11/detail/common.h:318,
                 from /usr/include/pybind11/attr.h:13,
                 from /usr/include/pybind11/detail/class.h:12,
                 from /usr/include/pybind11/pybind11.h:13,
                 from ./build/_deps/pybind11_protobuf-src/pybind11_protobuf/proto_cast_util.h:6,
                 from ./build/_deps/pybind11_protobuf-src/pybind11_protobuf/proto_cast_util.cc:1:
/usr/include/c++/15.2.1/bits/unique_ptr.h: In instantiation of 'std::__detail::__unique_ptr_t<_Tp> std::make_unique(_Args&& ...) [with _Tp = pybind11_protobuf::{anonymous}::PythonDescriptorPoolWrapper::DescriptorPoolDatabase; _Args = {pybind11::object}; __detail::__unique_ptr_t<_Tp> = __detail::__unique_ptr_t<pybind11_protobuf::{anonymous}::PythonDescriptorPoolWrapper::DescriptorPoolDatabase>]':
./build/_deps/pybind11_protobuf-src/pybind11_protobuf/proto_cast_util.cc:319:62:   required from here
  319 |     auto database = absl::make_unique<DescriptorPoolDatabase>(
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
  320 |         py::reinterpret_borrow<py::object>(python_pool));
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      
/usr/include/c++/15.2.1/bits/unique_ptr.h:1084:30: error: invalid new-expression of abstract class type 'pybind11_protobuf::{anonymous}::PythonDescriptorPoolWrapper::DescriptorPoolDatabase'
 1084 |     { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./build/_deps/pybind11_protobuf-src/pybind11_protobuf/proto_cast_util.cc:349:9: note:   because the following virtual functions are pure within 'pybind11_protobuf::{anonymous}::PythonDescriptorPoolWrapper::DescriptorPoolDatabase':
  349 |   class DescriptorPoolDatabase : public DescriptorDatabase {
      |         ^~~~~~~~~~~~~~~~~~~~~~
In file included from ./build/_deps/pybind11_protobuf-src/pybind11_protobuf/proto_cast_util.cc:27:
/usr/include/google/protobuf/descriptor_database.h:67:52: note:     'virtual bool google::protobuf::DescriptorDatabase::FindFileByName(std::string_view, google::protobuf::FileDescriptorProto*)'
   67 |   PROTOBUF_FUTURE_ADD_EARLY_NODISCARD virtual bool FindFileByName(
      |                                                    ^~~~~~~~~~~~~~
/usr/include/google/protobuf/descriptor_database.h:74:52: note:     'virtual bool google::protobuf::DescriptorDatabase::FindFileContainingSymbol(std::string_view, google::protobuf::FileDescriptorProto*)'
   74 |   PROTOBUF_FUTURE_ADD_EARLY_NODISCARD virtual bool FindFileContainingSymbol(
      |                                                    ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/google/protobuf/descriptor_database.h:82:52: note:     'virtual bool google::protobuf::DescriptorDatabase::FindFileContainingExtension(std::string_view, int, google::protobuf::FileDescriptorProto*)'
   82 |   PROTOBUF_FUTURE_ADD_EARLY_NODISCARD virtual bool FindFileContainingExtension(
      |                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~

Using instead

-DBUILD_pybind11_protobuf=OFF \

leads to

CMake Error at cmake/system_deps.cmake:128 (find_package):
  By not providing "Findpybind11_protobuf.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "pybind11_protobuf", but CMake did not find one.

  Could not find a package configuration file provided by "pybind11_protobuf"
  with any of the following names:

    pybind11_protobufConfig.cmake
    pybind11_protobuf-config.cmake
[..]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Build: CMakeCMake based build issueDependenciesPull requests that update a dependency fileLang: PythonPython wrapper issue

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions