ImageMagick / PythonMagick

PythonMagick
Other
61 stars 20 forks source link

seems not to compile with boost 1.60 #1

Closed chrys87 closed 7 years ago

chrys87 commented 8 years ago

pythonmagick does not compile with lib-boost/boost 1.60 see comments here: https://aur.archlinux.org/packages/pythonmagick/

gagern commented 8 years ago

See also Gentoo bug 579848. Error report for me looks like this:

In file included from /usr/include/boost/python/object/make_instance.hpp:10:0,
                 from /usr/include/boost/python/object/make_ptr_instance.hpp:8,
                 from /usr/include/boost/python/to_python_indirect.hpp:11,
                 from /usr/include/boost/python/converter/arg_to_python.hpp:10,
                 from /usr/include/boost/python/call.hpp:15,
                 from /usr/include/boost/python/object_core.hpp:14,
                 from /usr/include/boost/python/args.hpp:25,
                 from /usr/include/boost/python.hpp:11,
                 from /var/tmp/portage/dev-python/pythonmagick-0.9.12/work/PythonMagick-0.9.12/pythonmagick_src/_Blob.cpp:3:
/usr/include/boost/python/converter/registered.hpp: In instantiation of ‘const boost::python::converter::registration& boost::python::converter::detail::registry_lookup1(boost::type<Target>) [with T = void]’:
/usr/include/boost/python/converter/registered.hpp:104:80:   required from ‘const boost::python::converter::registration& boost::python::converter::detail::registered_base<void>::converters’
/usr/include/boost/python/converter/arg_from_python.hpp:269:61:   required from ‘boost::python::converter::pointer_arg_from_python<T>::pointer_arg_from_python(PyObject*) [with T = void*; PyObject = _object]’
/usr/include/boost/python/arg_from_python.hpp:70:18:   required from ‘boost::python::arg_from_python<T>::arg_from_python(PyObject*) [with T = void*; PyObject = _object]’
/usr/include/boost/preprocessor/iteration/detail/local.hpp:37:9:   required from ‘PyObject* boost::python::detail::caller_arity<3u>::impl<F, Policies, Sig>::operator()(PyObject*, PyObject*) [with F = void (*)(Magick::Blob&, void*, long unsigned int); Policies = boost::python::default_call_policies; Sig = boost::mpl::vector4<void, Magick::Blob&, void*, long unsigned int>; PyObject = _object]’
/usr/include/boost/python/object/py_function.hpp:38:33:   required from ‘PyObject* boost::python::objects::caller_py_function_impl<Caller>::operator()(PyObject*, PyObject*) [with Caller = boost::python::detail::caller<void (*)(Magick::Blob&, void*, long unsigned int), boost::python::default_call_policies, boost::mpl::vector4<void, Magick::Blob&, void*, long unsigned int> >; PyObject = _object]’
/var/tmp/portage/dev-python/pythonmagick-0.9.12/work/PythonMagick-0.9.12/pythonmagick_src/_Blob.cpp:44:1:   required from here
/usr/include/boost/python/converter/registered.hpp:93:30: error: no matching function for call to ‘registry_lookup2(void (*)())’
       return registry_lookup2((T(*)())0);
                              ^
/usr/include/boost/python/converter/registered.hpp:83:3: note: candidate: template<class T> const boost::python::converter::registration& boost::python::converter::detail::registry_lookup2(T& (*)())
   registry_lookup2(T&(*)())
   ^
/usr/include/boost/python/converter/registered.hpp:83:3: note:   template argument deduction/substitution failed:
/usr/include/boost/python/converter/registered.hpp:93:30: note:   mismatched types ‘T&’ and ‘void’
       return registry_lookup2((T(*)())0);
                              ^
Makefile:625: recipe for target 'libpymagick_la-_Blob.lo' failed
make[1]: *** [libpymagick_la-_Blob.lo] Error 1

In _Blob.cpp the following two lines are the problematic ones, and disabling them makes things compile:

    scope* Magick_Blob_scope = new scope(
    class_< Magick::Blob >("Blob", init<  >())
//-->   .def(init< const void*, size_t >())
        .def(init< const Magick::Blob& >())
        .def("base64", (void (Magick::Blob::*)(const std::string) )&Magick::Blob::base64)
        .def("base64", (std::string (Magick::Blob::*)() )&Magick::Blob::base64)
        .def("update", &update_wrapper)
//-->   .def("updateNoCopy", &Magick::Blob::updateNoCopy, Magick_Blob_updateNoCopy_overloads_2_3())
        .def("length", &Magick::Blob::length)
    );

There are other, similar issues in _Image.cpp, perhaps in other files as well.

I must confess that I fail to see the intended use case of these method bindings. How would one provide a void* from within Python? I can see how it might be convenient to allow using buffers to specify the content for some chunk of memory, but I haven't found any indication in the Boost manual that boost::python could do auto-conversion of buffers to void* and size_t pairs.

So as it stands, I'd guess that these methods are currently not usable in any way, and therefore can be removed. They might be replaced at a later time with something using buffers, but that would require more code. Do you agree?

mikayla-grace commented 8 years ago

Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/PythonMagick later today.