[go: nahoru, domu]

Skip to content
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

Feature request: Allow the build to use the system-installed protobuf lib #16104

Open
svenstaro opened this issue Jan 13, 2018 · 17 comments
Open
Labels
stat:contribution welcome Status - Contributions welcome

Comments

@svenstaro
Copy link
Contributor

Describe the problem

Currently, it's impossible to use the system-installed protobuf library because the tensorflow build always uses the protobuf_archive version. There should be an option to use the one installed in the system.

Background: I package tensorflow for Arch Linux and we run into symbol conflicts if a user wants to use protobuf and tensorflow together in a binary because tensorflow's protobuf symbols conflict with the one installed in the system already.

Original Arch bug report: https://bugs.archlinux.org/task/56943

@svenstaro svenstaro changed the title Allow the build to use the system-installed protobuf lib Feature request: Allow the build to use the system-installed protobuf lib Jan 13, 2018
@tensorflowbutler tensorflowbutler added the stat:awaiting response Status - Awaiting response from author label Jan 14, 2018
@tensorflowbutler
Copy link
Member

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks.
Have I written custom code
OS Platform and Distribution
TensorFlow installed from
TensorFlow version
Bazel version
CUDA/cuDNN version
GPU model and memory
Exact command to reproduce

@svenstaro
Copy link
Contributor Author

sigh for this kind of issue, it really doesn't matter but for the sake of automation, here I go:

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): yes
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Arch Linux
  • TensorFlow installed from (source or binary): source
  • TensorFlow version (use command below): 1.4.1
  • Python version: 3.6
  • Bazel version (if compiling from source): 0.9.0
  • GCC/Compiler version (if compiling from source): 7.2.1
  • CUDA/cuDNN version: 9.1.85/7.0.5
  • GPU model and memory: 1080 TI with 11711807488 bytes
  • Exact command to reproduce: N/A

@tensorflowbutler tensorflowbutler removed the stat:awaiting response Status - Awaiting response from author label Jan 25, 2018
@drpngx
Copy link
Contributor
drpngx commented Jan 30, 2018

I think there was a similar question but can't seem to find it.

@gunan what's our position here?

@gunan
Copy link
Contributor
gunan commented Jan 31, 2018

Eventually, we would like to enable this.
Maybe we can control this using environment variables just like we do for MKL?

@drpngx drpngx added the stat:contribution welcome Status - Contributions welcome label Jan 31, 2018
@dbarnes
Copy link
dbarnes commented Feb 18, 2018

@drpngx could it be this question I posted a while ago #8403 ? I'd be very interested as well if any progress is made on this!

@drpngx
Copy link
Contributor
drpngx commented Feb 18, 2018

@danbarnes333 yes that's right on.

Maybe a stepping stone would be to allow people to link against the system protobuf during the configure step, via some environment variable or a configure flag. I think that would be a good contribution.

We should also consider, at some point, distributing pip packages that are dependent on a libprotobuf package.

CC @allenlavoie @skye

@RichDubielzig
Copy link
RichDubielzig commented Feb 22, 2018

This would be useful to us as well. We are currently stuck in a situation where the protobuf symbols in libtensorflow_framework.so are being clobbered by symbols in a custom libprotobuf from a different API revision that is being loaded to support the operations of our custom backend to TensorFlow.

In other words, we have this library dependency tree right now:

  • _pywrap_tensorflow_internal.so
    • libtensorflow_framework.so (contains protobuf 3.4 library)
    • our_high_level_library.so
      • our_device_library.so
        • libprotobuf.so (version 3.x)

@RichDubielzig
Copy link

We found a workaround by forcing bazel to use a protobuf version that matched the one used elsewhere on the system. Here is a patch that will force usage of the 3.4.0 library, but one can also point to any other archive tag on github.
patch.tar.gz

@dbarnes
Copy link
dbarnes commented Mar 9, 2018

@RichDubielzig that is what we have been doing, as well as hiding more symbols in the tensorflow shared library, and has been working ok. However @drpngx mentioned on my original issue that this isnt completely safe unless I misunderstood (about halfway down #8403) but perhaps things have changed since then. Either way simply building against the system protobuf would be great.

@muyue1238
Copy link

@RichDubielzig Do you mind to tell more detail about how to use the file you gave? Like where should I put it and how can I make it work? Thanks alot.

@rowillia
Copy link

If this ever gets picked up you'll probably need protobuf to enable dynamic linking as well - protocolbuffers/protobuf#8291

rowillia pushed a commit to rowillia/protobuf that referenced this issue Feb 25, 2021
@gnossen gave a great overview in grpc/grpc#24992 of the overall problem.

If a python process using both protobuf _and_ another native library linking in libprotobuf
frequently can cause crashes.  This seems to frequently affect tensorflow as well:

tensorflow/tensorflow#8394,
tensorflow/tensorflow#9525 (comment)
tensorflow/tensorflow#24976,
tensorflow/tensorflow#35573,
https://github.com/tensorflow/tensorflow/blob/v2.0.0/tensorflow/contrib/makefile/rename_protobuf.sh,
tensorflow/tensorflow#16104

Testing locally this fixes both crashes when linking in multiple versions of protobuf
and fixes `DescriptorPool` clashes as well (e.g. Python and Native code import different versions of the same message).
TeBoring pushed a commit to protocolbuffers/protobuf that referenced this issue Apr 24, 2021
@gnossen gave a great overview in grpc/grpc#24992 of the overall problem.

If a python process using both protobuf _and_ another native library linking in libprotobuf
frequently can cause crashes.  This seems to frequently affect tensorflow as well:

tensorflow/tensorflow#8394,
tensorflow/tensorflow#9525 (comment)
tensorflow/tensorflow#24976,
tensorflow/tensorflow#35573,
https://github.com/tensorflow/tensorflow/blob/v2.0.0/tensorflow/contrib/makefile/rename_protobuf.sh,
tensorflow/tensorflow#16104

Testing locally this fixes both crashes when linking in multiple versions of protobuf
and fixes `DescriptorPool` clashes as well (e.g. Python and Native code import different versions of the same message).
acozzette pushed a commit to acozzette/protobuf that referenced this issue Jan 22, 2022
@gnossen gave a great overview in grpc/grpc#24992 of the overall problem.

If a python process using both protobuf _and_ another native library linking in libprotobuf
frequently can cause crashes.  This seems to frequently affect tensorflow as well:

tensorflow/tensorflow#8394,
tensorflow/tensorflow#9525 (comment)
tensorflow/tensorflow#24976,
tensorflow/tensorflow#35573,
https://github.com/tensorflow/tensorflow/blob/v2.0.0/tensorflow/contrib/makefile/rename_protobuf.sh,
tensorflow/tensorflow#16104

Testing locally this fixes both crashes when linking in multiple versions of protobuf
and fixes `DescriptorPool` clashes as well (e.g. Python and Native code import different versions of the same message).
acozzette added a commit to protocolbuffers/protobuf that referenced this issue Jan 25, 2022
@gnossen gave a great overview in grpc/grpc#24992 of the overall problem.

If a python process using both protobuf _and_ another native library linking in libprotobuf
frequently can cause crashes.  This seems to frequently affect tensorflow as well:

tensorflow/tensorflow#8394,
tensorflow/tensorflow#9525 (comment)
tensorflow/tensorflow#24976,
tensorflow/tensorflow#35573,
https://github.com/tensorflow/tensorflow/blob/v2.0.0/tensorflow/contrib/makefile/rename_protobuf.sh,
tensorflow/tensorflow#16104

Testing locally this fixes both crashes when linking in multiple versions of protobuf
and fixes `DescriptorPool` clashes as well (e.g. Python and Native code import different versions of the same message).

Co-authored-by: Roy Williams <roy.williams.iii@gmail.com>
@github-actions
Copy link

This issue is stale because it has been open for 180 days with no activity. It will be closed if no further activity occurs. Thank you.

@github-actions github-actions bot added the stale This label marks the issue/pr stale - to be closed automatically if no activity label Mar 28, 2023
@svenstaro
Copy link
Contributor Author

This is definitely still valid.

@google-ml-butler google-ml-butler bot removed the stale This label marks the issue/pr stale - to be closed automatically if no activity label Mar 28, 2023
@github-actions
Copy link

This issue is stale because it has been open for 180 days with no activity. It will be closed if no further activity occurs. Thank you.

@github-actions github-actions bot added the stale This label marks the issue/pr stale - to be closed automatically if no activity label Sep 25, 2023
@svenstaro
Copy link
Contributor Author

It's still relevant.

@google-ml-butler google-ml-butler bot removed the stale This label marks the issue/pr stale - to be closed automatically if no activity label Sep 25, 2023
Copy link

This issue is stale because it has been open for 180 days with no activity. It will be closed if no further activity occurs. Thank you.

@github-actions github-actions bot added the stale This label marks the issue/pr stale - to be closed automatically if no activity label Mar 24, 2024
@svenstaro
Copy link
Contributor Author

It's still a problem.

@google-ml-butler google-ml-butler bot removed the stale This label marks the issue/pr stale - to be closed automatically if no activity label Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:contribution welcome Status - Contributions welcome
Projects
None yet
Development

No branches or pull requests

8 participants