-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure Drake's fork of pybind11
does not interfere with downstream users
#7856
Comments
@clalancette @basicNew @mikaelarguedas From looking at the discussion in #7805, it looks like you may be part of situation (b). Can I ask if you have ran into any of these such issues? |
My concern is that they then have the same issue as the original problem with consuming Drake as a Bazel external: they now must ensure that they are in lock-step with Drake's version of That being said, I'd be OK with a CMake macro that says "give me Drake's version of If there are complications in providing that macro, then I feel we should provide it as part of the Bazel install. |
Effectively upgrading pybind11 automatically with drake may introduce instabilities in their Python bindings, so really you end up choosing one instability over the other. |
@EricCousineau-TRI Right, delphyne did run into the problem that now that drake doesn't install the pybind11 headers, we can no longer consume them. For now, I have a PR open to vendor |
If Drake is being consumed directly (which I believe is the case for (b)-style situations), then I would prefer instability from upgrading - because without these upgrades, interfacing a downstream C++ library with Drake C++, and have that work with In making my fork, I ensure that I do not break any previous unittests on Linux (Windows is another story, but that can be fixed if need be);
Gotcha. I would like it if y'all didn't have to ensure that you monitored and bumped the version yourself, if you don't need to fork off of what Drake is using. |
Agreed. While I understand the point of view that Drake shouldn't necessarily be providing everything that any project might need to build, I think this might be a case where things are pretty intimate between drake and its consumers. For instance, what would happen if Drake were using pybind11-version1 for the Drake bindings, and Delphyne were using pybind11-version2 for its own bindings (which called into the drake bindings)? Would that continue to work OK if version2 had some ABI-incompatible changes? I'm guessing it would have problems, but I don't really know the details here. |
The other issue, given that |
@RussTedrake mentioned wanting to start adding some custom C++ code to the |
He just needs to use |
Sorry, to clarify, I meant that for increasing stability, it'd be nice if they could use CMake variables, rather than manually synchronize it with |
With caching of find_package results and the fact that ExternalProject_Add executes during the build rather than the configure, that is not likely to work well. |
Is there a way to overcome that? (That seems like a pretty bad defect to me.) |
Not really, you don't want to search around the whole file system every time you run CMake.
That would not trigger a rebuild of a pybind11 external project, only a parent project. Moreover, in the (fairly common) case that drake is pulled in as an external project too, the variable would be a parallel (instead of parent) scope anyway, so would not be useful. |
I'm not sure if I fully understood all of your points, so I hacked together these two PRs: I had meant that there'd be a macro that'd be Even if it doesn't properly invalidate the external project based on Drake's version information, I'm fine if a clean build provides the correct results, and if we tackle hermiticity in CMake later. |
@EricCousineau-TRI Sorry I didn't see this earlier. To be totally clear, even if this functionality is available in drake, delphyne probably will not use it. We are currently using https://github.com/dirk-thomas/vcstool to manage our dependencies, not CMake |
No worries! If anything, it is possible to write a quick script to compare your vcs config file, and ensure it's consistent with |
@EricCousineau-TRI Good idea. I've opened an issue on our issue tracker about it: maliput/delphyne#267 |
@sloretz might've hit this here: From Slack:
Dunno the best solution in the case of ROS (where ideally we don't have to rebuild too much...), but at a minimum, Drake's fork should perturb the internal |
We shouldn't have a fork anyway. Duplicate of #5842. |
Per conversation with @gizatt and @jamiesnape:
Two situations that may affect downstream users (see examples below for illustration):
(a) there may be an ABI incompatibility between our
pybind11
version and any upstream versions that could cause segfaults, and(b) downstream C++ libraries (which use Drake C++ in its public interface) that want to generate Python bindings should use our version of
pybind11
.pybind11
is robust against loading bindings that use differentpybind11
versions, but do not mix C++ APIs.I've asked a quick question on
pybind11
's Gitter (may transform it to an issue) on how well different versions ofpybind11
play with each other when being loaded by the interpreter:https://gitter.im/pybind/Lobby?at=5a69f79ac95f22546de3e53c
(It would really suck to force all libraries using
pybind11
be compiled with the same version, if their C++ APIs do not mix.)UPDATE: If
pybind11
s version does not matter, and the combination of internals version + type is truly the only indicator of the structure of the internals, then the solution is for me to ensure our fork uses a different number thanpybind11
.TheA solution to (b) is to redistribute our fork ofResolved by exposing the information in Python at runtime. Alternative is to parsepybind11
, reverting Do not install pybind11 headers #7805. The motivating factor is less convenience, and more that there should be no incompatibility..../pybind11/repository.bzl
.Ultimately, this would not be an issue if we can use upstream
pybind11
, either by:pybind11
at its present state - I do not believe this is an option at the moment.Example of (a)
A user has their own library
custom
(which does not consume Drake C++) that they've writtenpybind11
bindings for, naming itpycustom
. They want to write a Python script that consumes bothpycustom
andpydrake
.There may be a possibility that they get a segfault, due to ABI incompatibility in
pybind11
s internals; they're being penalized for things they didn't even care about in the first place.Example of (b)
A
spartan
user wants to write Python bindings of C++ functionality which consumes Drake in its public interface.In this case, they must consume the same version of
pybind11
, such that they can access the registered C++ types to mix Drake C++,pydrake
, their library's C++ API, and their Python bindings.The text was updated successfully, but these errors were encountered: