openrave icon indicating copy to clipboard operation
openrave copied to clipboard

Gain compatibility with the stock Pybind11 (2.9.2)

Open cielavenir opened this issue 3 years ago • 4 comments

Historically, we were discussing boost-1.65 compatibility in https://github.com/rdiankov/openrave/pull/625 but we forgot it after pybind11 version. So openrave cannot be built on boost::python on latest Debian even if we are able to get py2 binary.

The thing is that py::object operator[] does not accept int not size_t in the stock pybind11. So we have to use patched pybind11, which is not user-friendly. I personally wrote the build guide to make pybind11 version somewhat user-friendly, but it caused some internal problems.

Now I tried to build openrave using the stock pybind11. It is like that casting all integer indexing by py::to_object.

I did test the compilation on both bullseye (pybind11) and stretch (boost::python), so it works at least.

However, it surely costs the readability a lot. Please reconsider about the guide availability. Removing the guide is not good idea at all.

cielavenir avatar Jun 08 '22 09:06 cielavenir

tried to add this but operator[] cannot be global...

pybind11::detail::item_accessor operator[](const pybind11::object &o, int key) {
    return o[pybind11::to_object(key)];
}

pybind11::detail::item_accessor operator[](const pybind11::object &o, size_t key) {
    return o[pybind11::to_object(key)];
}

cielavenir avatar Jun 08 '22 22:06 cielavenir

There seems like a pybind11 issue open for years https://github.com/pybind/pybind11/issues/1309

cielavenir avatar Jun 10 '22 05:06 cielavenir

sorry guys I'm tired, about discussion about this matter, please don't come to my desk directly and please check with @lazydroid first.

cielavenir avatar Jun 10 '22 05:06 cielavenir

let @woodychow and @tgn3000 know this matter

cielavenir avatar Jun 10 '22 06:06 cielavenir

just to mention that https://github.com/pybind/pybind11/pull/4004 will deprecate this pull request (clarify: I want to close this #1125 without merging)

cielavenir avatar Dec 27 '22 02:12 cielavenir

thanks, for now, let's gain compatibility with stock.

rdiankov avatar Jan 03 '23 01:01 rdiankov