-
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
Unable to use without proto_api despite enable_pyproto_api_setting
unset
#127
Comments
@laramiel do you have suggestions?
That code might not be all the interesting externally (outside the Google environment). Do you get further by ifdef-ing that out as well?
I don't have a lot of domain specific knowledge (my domain is core pybind11).
|
What and where do you have in mind? To me it looks rather like a bugfix to an existing feature than something new as that option already exists.
Shouldn't that already exist? |
I don't know, I can only offer general ideas here since this isn't my domain (see above). You're ifdef-ing out this include:
We have GitHub Actions testing that runs with that include present (it uses the sources as you see on main AFAIK): https://github.com/pybind/pybind11_protobuf/actions/runs/5869972208/job/15916046871 So something is different apparently between what we have and what you need. My understanding isn't deep enough to know what that could be. I look around a bit to see if we're doing anything special with Could you add a new GHA workflow that is representative if your environment and only works with your changes? That would make things more concrete (for me, anyway). Your workflow could use bazel instead of cmake. You may have to piece together the commands to setup bazel instead of cmake. Maybe useful as a starting point, not sure: https://github.com/pybind/pybind11_abseil/tree/master/scripts I also found this, which runs on an internal build server:
Hope this helps. |
Thanks a lot for your replies. However I run into a dead end for now in the use case I intended this for: Compiling TF with a preinstalled protobuf. After patching pybind11_protobuf (linked in the original description) it failed at the end with a protobuf issue I don't see a solution for: tensorflow/tensorflow#61593 I'll come back to this if there is a solution later on for that but until then it doesn't seem to be worth the effort.
FTR: I do like CMake more then Bazel especially as it doesn't require downloading stuff at build time but reusing what is already installed, e.g. at pybind11_protobuf/cmake/dependencies/CMakeLists.txt Lines 18 to 19 in b2e7687
So thanks for adding CMake support here! |
FYI, I have an approved PR to make proto_api public but haven't had cycles to track down why it would cause CI to fail. |
- pybind#127 Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>
Does anyone have any good idea how to get pybind11_protobuf working again without depending on an in-tree source copy of protobuf? Unfortunately, upstream protobuf developers seem not to care if they break downstream users, as the promised code has not appeared for 2 years now ... |
One dirty solution, would be that pybind11_protobuf directly provide (and install?) the |
In case `PYBIND11_PROTOBUF_ENABLE_PYPROTO_API` is not defined, the py_proto_api_ member of the GlobalState singleton is never changed from its default nullptr value. Any code protected by a `GlobalState::instance()->py_proto_api()` check can thus also be made dependent on the `PYPROTO_API` define. This allows to remove the dependency on the proto_api.h header file. As the call to check_unknown_fields::CheckRecursively is also protected by the `py_proto_api()` it can be stubbed out. See pybind#127.
Managed to build google-or-tools with distribution packaged protobuf, abseil, pybind11_protobuf and pybind11_abseil. Have just submitted the first corresponding MR here. |
In case `PYBIND11_PROTOBUF_ENABLE_PYPROTO_API` is not defined, the py_proto_api_ member of the GlobalState singleton is never changed from its default nullptr value. Any code protected by a `GlobalState::instance()->py_proto_api()` check can thus also be made dependent on the `PYPROTO_API` define. This allows to remove the dependency on the proto_api.h header file. As the call to check_unknown_fields::CheckRecursively is also protected by the `py_proto_api()` it can be stubbed out. See pybind#127.
In case `PYBIND11_PROTOBUF_ENABLE_PYPROTO_API` is not defined, the py_proto_api_ member of the GlobalState singleton is never changed from its default nullptr value. Any code protected by a `GlobalState::instance()->py_proto_api()` check can thus also be made dependent on the `PYPROTO_API` define. This allows to remove the dependency on the proto_api.h header file. As the call to check_unknown_fields::CheckRecursively is also protected by the `py_proto_api()` it can be stubbed out. See pybind#127.
In case `PYBIND11_PROTOBUF_ENABLE_PYPROTO_API` is not defined, the py_proto_api_ member of the GlobalState singleton is never changed from its default nullptr value. Any code protected by a `GlobalState::instance()->py_proto_api()` check can thus also be made dependent on the `PYPROTO_API` define. This allows to remove the dependency on the proto_api.h header file. As the call to check_unknown_fields::CheckRecursively is also protected by the `py_proto_api()` it can be stubbed out. See pybind#127.
I wanted to use this in an environment where the pyext for proto_api wasn't build/installed and as
enable_pyproto_api_setting
is disabled by default I assumed this would work.However the build failed already due to an unconditional dependency on
@com_google_protobuf//:proto_api
and include ofpython/google/protobuf/proto_api.h
I made a couple changes such that it builds with the version TF 2.13.0 uses: Flamefire@f49bc41
However on current main it seems to be much harder as now
check_unknown_fields
depends on that too which makes it look like it may not work that easily anymore.Is there interest in getting this fixed/done? Any feedback on the feasibility of the above change/commit?
The usecase was to compile TensorFlow with a pre-installed protobuf to avoid conflicts when using potentially different versions in one environment.
The text was updated successfully, but these errors were encountered: