Title: Detect pybind11 version mismatches · Issue #130 · sofa-framework/SofaPython3 · GitHub
Open Graph Title: Detect pybind11 version mismatches · Issue #130 · sofa-framework/SofaPython3
X Title: Detect pybind11 version mismatches · Issue #130 · sofa-framework/SofaPython3
Description: Thanks to @coolteemf who reported this issue. When we are creating our own bindings inside an external plugin, class inheritance against a base class defined in SofaPython3 is possible if and only if the pybind11 version is the same for ...
Open Graph Description: Thanks to @coolteemf who reported this issue. When we are creating our own bindings inside an external plugin, class inheritance against a base class defined in SofaPython3 is possible if and only ...
X Description: Thanks to @coolteemf who reported this issue. When we are creating our own bindings inside an external plugin, class inheritance against a base class defined in SofaPython3 is possible if and only ...
Opengraph URL: https://github.com/sofa-framework/SofaPython3/issues/130
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Detect pybind11 version mismatches","articleBody":"Thanks to @coolteemf who reported this issue.\r\n\r\nWhen we are creating our own bindings inside an external plugin, class inheritance against a base class defined in SofaPython3 is possible _if and only if_ the pybind11 version is the same for both projects. \r\n\r\nFrom pybind11 [documentation](https://pybind11.readthedocs.io/en/stable/advanced/misc.html#partitioning-code-over-multiple-extension-modules):\r\n\r\n\u003e Note also that it is possible (although would rarely be required) to share arbitrary C++ objects between extension modules at runtime. Internal library data is shared between modules using capsule machinery 1 which can be also utilized for storing, modifying and accessing user-defined data. Note that an extension module will “see” other extensions’ data if and only if they were built with the same pybind11 version.\r\n\r\nFor example, the following:\r\n\r\n```\r\n┌─────────────────┐ ┌────────────────────────┐\r\n│ MyPlugin │ │ SofaPython3 │\r\n│ │ │ │\r\n│ Mycamera \u003c-------------- BaseCamera │\r\n│ │ │ │\r\n│ │ └────────────────────────┘\r\n└─────────────────┘\r\n```\r\n\r\n``` python\r\nfrom Sofa.Core import Camera\r\nfrom MyPlugin import MyCamera\r\n```\r\n\r\nis only possible if SofaPython3 and MyPlugin is compiled using exactly the same pybind11 version. Else, the following will happen:\r\n\r\n``` python\r\n\u003e\u003e\u003e from Sofa.Core import Camera\r\n\u003e\u003e\u003e from MyPlugin import MyCamera\r\n[ERROR] [SofaRuntime] ImportError: generic_type: type \"MyCamera\" referenced unknown base type \"sofa::component::visualmodel::BaseCamera\"\r\nTraceback (most recent call last):\r\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\r\n```\r\n\r\nThis error is not so trivial to debug, and we could easily detect it at the CMake stage by verifying pybind11 version match. We could, for example, insert the current pybind11 version inside an exported CMake's target property. @guparan, do you think this could be feasible?","author":{"url":"https://github.com/jnbrunet","@type":"Person","name":"jnbrunet"},"datePublished":"2021-03-29T12:37:41.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/130/SofaPython3/issues/130"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5f42b404-1630-0674-7df6-fc5c292054b4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A696:324E5B:B0CC36:DDA3B9:697F0408 |
| html-safe-nonce | 1ed81f152e2878b79a4256eaed66e8ee88011bf188ce90f1bd2111bf71618019 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjk2OjMyNEU1QjpCMENDMzY6RERBM0I5OjY5N0YwNDA4IiwidmlzaXRvcl9pZCI6IjkxMzM0Njk3MjMwNTUyOTM0NDkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 46b25a87ba2bedb467b24b8c1b899c528622704c5b6400b26d064e88b593bd41 |
| hovercard-subject-tag | issue:843328079 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/sofa-framework/SofaPython3/130/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d34d21930bd1c2604bc4957a9176ae16ce16d77fc2dabb309343f9adb1b46ea2/sofa-framework/SofaPython3/issues/130 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d34d21930bd1c2604bc4957a9176ae16ce16d77fc2dabb309343f9adb1b46ea2/sofa-framework/SofaPython3/issues/130 |
| og:image:alt | Thanks to @coolteemf who reported this issue. When we are creating our own bindings inside an external plugin, class inheritance against a base class defined in SofaPython3 is possible if and only ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jnbrunet |
| hostname | github.com |
| expected-hostname | github.com |
| None | 60279d4097367e16897439d16d6bbe4180663db828c666eeed2656988ffe59f6 |
| turbo-cache-control | no-preview |
| go-import | github.com/sofa-framework/SofaPython3 git https://github.com/sofa-framework/SofaPython3.git |
| octolytics-dimension-user_id | 11028508 |
| octolytics-dimension-user_login | sofa-framework |
| octolytics-dimension-repository_id | 260159147 |
| octolytics-dimension-repository_nwo | sofa-framework/SofaPython3 |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 260159147 |
| octolytics-dimension-repository_network_root_nwo | sofa-framework/SofaPython3 |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7c85641c598ad130c74f7bcc27f58575cac69551 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width