python-poppler icon indicating copy to clipboard operation
python-poppler copied to clipboard

Does not build with libpoppler-cpp 25.03.0

Open gollux opened this issue 3 months ago • 1 comments

When I try building python_poppler-0.4.1 on Debian Trixie, which has libpoppler-cpp 25.03.0, I am getting the following error:

      [1/26] Compiling C++ object src/cpp/image.cpython-313-x86_64-linux-gnu.so.p/image.cpp.o
      FAILED: src/cpp/image.cpython-313-x86_64-linux-gnu.so.p/image.cpp.o
      c++ -Isrc/cpp/image.cpython-313-x86_64-linux-gnu.so.p -Isrc/cpp -I../src/cpp -I../subprojects/pybind11-2.10.3/include -I/usr/include/poppler/cpp -I/usr/include/poppler -I/usr/include/python3.13 -I/usr/include/x86_64-linux-gnu/python3.13 -fvisibility=hidden -fvisibility-inlines-hidden -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++11 -O3 -fPIC -MD -MQ src/cpp/image.cpython-313-x86_64-linux-gnu.so.p/image.cpp.o -MF src/cpp/image.cpython-313-x86_64-linux-gnu.so.p/image.cpp.o.d -o src/cpp/image.cpython-313-x86_64-linux-gnu.so.p/image.cpp.o -c ../src/cpp/image.cpp
      ../src/cpp/image.cpp: In function ‘void poppler::set_data(image&, char*)’:
      ../src/cpp/image.cpp:32:11: warning: variable ‘img_data’ set but not used [-Wunused-but-set-variable]
         32 |     char *img_data = img.data();
            |           ^~~~~~~~
      In file included from ../src/cpp/image.cpp:20:
      ../subprojects/pybind11-2.10.3/include/pybind11/pybind11.h: In instantiation of ‘void pybind11::cpp_function::initialize(Func&&, Return (*)(Args ...), const Extra& ...) [with Func = pybind11::cpp_function::cpp_function<poppler::image, poppler::image, pybind11::name, pybind11::is_method, pybind11::sibling, pybind11::arg_v>(poppler::image (poppler::image::*)() const, const pybind11::name&, const pybind11::is_method&, const pybind11::sibling&, const pybind11::arg_v&)::<lambda(const poppler::image*)>; Return = poppler::image; Args = {const poppler::image*}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling, pybind11::arg_v}]’:
      ../subprojects/pybind11-2.10.3/include/pybind11/pybind11.h:131:19:   required from ‘pybind11::cpp_function::cpp_function(Return (Class::*)(Arg ...) const, const Extra& ...) [with Return = poppler::image; Class = poppler::image; Arg = {}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling, pybind11::arg_v}]’
        131 |         initialize([f](const Class *c,
            |         ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
        132 |                        Arg... args) -> Return { return (c->*f)(std::forward<Arg>(args)...); },
            |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        133 |                    (Return(*)(const Class *, Arg...)) nullptr,
            |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        134 |                    extra...);
            |                    ~~~~~~~~~
      ../subprojects/pybind11-2.10.3/include/pybind11/pybind11.h:1568:22:   required from ‘pybind11::class_<type_, options>& pybind11::class_<type_, options>::def(const char*, Func&&, const Extra& ...) [with Func = poppler::image (poppler::image::*)() const; Extra = {pybind11::arg_v}; type_ = poppler::image; options = {}]’
       1568 |         cpp_function cf(method_adaptor<type>(std::forward<Func>(f)),
            |                      ^~
      ../src/cpp/image.cpp:105:13:   required from here
         98 |     py::class_<image>(m, "image", py::buffer_protocol())
            |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         99 |         .def(py::init<>())
            |         ~~~~~~~~~~~~~~~~~~
        100 |         .def_buffer(&image_buffer_info)
            |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        101 |         .def(py::init<char *, int, int, image::format_enum>(), py::arg("idata"), py::arg("iwidth"), py::arg("iheight"), py::arg("iformat"))
            |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        102 |         .def(py::init<int, int, image::format_enum>(), py::arg("iwidth"), py::arg("iheight"), py::arg("iformat"))
            |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        103 |         .def("bytes_per_row", &image::bytes_per_row)
            |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        104 |         // .def("const_data", &image::const_data)
            |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        105 |         .def("copy", &image::copy, py::arg("rect") = rect())
            |         ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ../subprojects/pybind11-2.10.3/include/pybind11/pybind11.h:218:40: error: static assertion failed: The number of argument annotations does not match the number of function arguments
        218 |             expected_num_args<Extra...>(
            |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        219 |                 sizeof...(Args), cast_in::args_pos >= 0, cast_in::has_kwargs),
            |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ../subprojects/pybind11-2.10.3/include/pybind11/pybind11.h:218:40: note: ‘pybind11::detail::expected_num_args<pybind11::name, pybind11::is_method, pybind11::sibling, pybind11::arg_v>(1, (((int)pybind11::detail::argument_loader<const poppler::image*>::args_pos) >= 0), ((int)((bool)pybind11::detail::argument_loader<const poppler::image*>::has_kwargs)))’ evaluates to false
      [2/26] Compiling C++ object src/cpp/embedded_file.cpython-313-x86_64-linux-gnu.so.p/embedded_file.cpp.o
      [3/26] Compiling C++ object src/cpp/version.cpython-313-x86_64-linux-gnu.so.p/version.cpp.o
      [4/26] Compiling C++ object src/cpp/toc.cpython-313-x86_64-linux-gnu.so.p/toc.cpp.o
      [5/26] Compiling C++ object src/cpp/rectangle.cpython-313-x86_64-linux-gnu.so.p/rectangle.cpp.o
      [6/26] Compiling C++ object src/cpp/destination.cpython-313-x86_64-linux-gnu.so.p/destination.cpp.o
      [7/26] Compiling C++ object src/cpp/font.cpython-313-x86_64-linux-gnu.so.p/font.cpp.o
      [8/26] Compiling C++ object src/cpp/page_transition.cpython-313-x86_64-linux-gnu.so.p/page_transition.cpp.o
      [9/26] Compiling C++ object src/cpp/page_renderer.cpython-313-x86_64-linux-gnu.so.p/page_renderer.cpp.o
      [10/26] Compiling C++ object src/cpp/global_.cpython-313-x86_64-linux-gnu.so.p/global.cpp.o
      [11/26] Compiling C++ object src/cpp/global.cpython-313-x86_64-linux-gnu.so.p/global.cpp.o
      [12/26] Compiling C++ object src/cpp/document.cpython-313-x86_64-linux-gnu.so.p/document.cpp.o
      [13/26] Compiling C++ object src/cpp/page.cpython-313-x86_64-linux-gnu.so.p/page.cpp.o
      ninja: build stopped: subcommand failed.
      [end of output]

It builds correctly with poppler-cpp 22.12.0 from Debian Bookworm.

The reason is probably that image::copy() used to have an optional rect argument, but it no longer has.

gollux avatar Aug 21 '25 16:08 gollux