-
Notifications
You must be signed in to change notification settings - Fork 36
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
How to integrate this in a CMake project? #60
Comments
Edit: after downloading the header and placing it where it can be found, I get an undefined reference to an absl object when importing:
|
Edit: I managed to make this work by linking against linking Would you be open to adding a CMakeLists.txt for this project? I can prepare a PR |
Hi @maxnoe, I put together a cmake build for a project to provide bindings for some of the ignition robotics libraries. The I'd also be keen to see cmake support included in the repo. |
@srmainwaring Thanks! This is looking good. I see that you only include the protobuf library for the one header I also mentioned above. I opened this issue here, to get it included in the python package: protocolbuffers/protobuf#9464 If I understand it correctly, that header should be part of the python packge and probably some utility method to get it's location. |
Yes, having the headers in a place that doesn't require bringing in I used submodules to include the various dependencies, but that does present some problems (i.e. conflicts) when this package is included in larger projects, so it may be better to use cmake's I don't have a strong view either way, but please use any changes in my branch if they are helpful - and I'll be happy to help with testing. |
In a nutshell: open yes, staffed no. The main problem is that we're not set up to accept external PRs. The reasons are purely technical. It's a fairly big project to enable the workflow needed. But, if you're ok doing things manually for now, the process would be:
I believe this could work ok for adding cmake support (assuming there will mostly or even purely be additional files; it would probably be a lot less practical for core code changes). Let's give it a shot and see how it goes? |
A am a bit confused now. Why is this under the pybind organisation if this is still an internal google project? |
This repo grew organically and was never staffed as an official project.
Contributing to core pybind11 is now staffed. I'm hoping to build support
for expanding the scope in the future. In the meantime I can only offer
what's known as "best effort". (That's more common than one might think.)
…On Thu, Feb 3, 2022 at 00:26 Maximilian Nöthe ***@***.***> wrote:
A am a bit confused now. Why is this under the pybind organisation if this
is still an internal google project?
—
Reply to this email directly, view it on GitHub
<#60 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFUZACYSRP5M32PYE6KZGTUZI33VANCNFSM5NMM7ZTA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID:
***@***.***>
|
cc @joelynch |
So it appears there's no hope for pybind11 due to protocol buffer support for python taking a drastic turn away from being able to support cmake and their new UPB thing? |
I don't understand this comment at all TBH. Did you see that @srmainwaring contributed cmake support? Merged via #110 on Mar 9, 2023, fixes by @lopsided98 merged via #129 on Aug 25, 2023. If that does not work for you, please provide exact details (ideally a reproducer). |
@kyranf My understanding is that if you use pybind11 to create python bindings to C++ protobuf objects, you won't use the python protobuf module at all. |
if I take @srmainwaring 's gz-python project which uses pybind11 and for python to use the protobufs as a dependency, it cannot compile with cmake as it cannot find one of the headers. This is a known issue right now on that project. |
If you see: https://github.com/google/or-tools/blob/870edf6f7bff6b8ff0d267d936be7e331c5b8c2d/patches/protobuf-v26.1.patch#L59-L68 |
I am very interested in getting this to run in a CMake project and possibly contributing to make that happen.
I have this repo cloned as a submodule inside a small test project, but cannot get this to compile / run without linker errors.
This is my current setup:
Files
Person.proto
:fastproto.cpp
CMakeLists.txt
Or use the repo here: https://github.com/maxnoe/pybind_protobuf_test
Experimenting with this, I had several issues. However now in this version including the sources my main problem is that a protobuf header is not found:
It seems to be this one:
https://github.com/protocolbuffers/protobuf/blob/master/python/google/protobuf/proto_api.h
But that seems not to be part of an installed protobuf.
Any help on getting this to run would be appreciated.
The text was updated successfully, but these errors were encountered: