Skip to content

@com_google_protobuf//:well_known_types_py_pb2_genproto is not in systemlibs #60667

Closed

Description

@njzjz
Click to expand!

Issue Type

Build/Install

Have you reproduced the bug with TF nightly?

Yes

Source

source

Tensorflow Version

2.12.0

Custom Code

No

OS Platform and Distribution

Linux

Mobile device

No response

Python version

3.10

Bazel version

5.3.0

GCC/Compiler version

No response

CUDA/cuDNN version

No response

GPU model and memory

No response

Current Behaviour?

84f4092 adds a new dependency @com_google_protobuf//:well_known_types_py_pb2_genproto as follows:

genproto_deps.append("@com_google_protobuf//:well_known_types_py_pb2_genproto")

However, this target is not added to tensorflow/third_party/systemlibs/protobuf.BUILD. So when building TensorFlow with export TF_SYSTEM_LIBS=com_google_protobuf, the following error occurs:

ERROR: tensorflow/compiler/xla/BUILD:83:17: no such target '@com_google_protobuf//:well_known_types_py_pb2_genproto': target 'well_known_types_py_pb2_genproto' not declared in package '' defined by external/com_google_protobuf/BUILD.bazel and referenced by '//tensorflow/compiler/xla:xla_data_proto_py_genproto'

Standalone code to reproduce the issue

export TF_SYSTEM_LIBS=com_google_protobuf
./configure
bazel build //tensorflow/tools/pip_package:build_pip_package

Relevant log output

ERROR: tensorflow/compiler/xla/BUILD:83:17: no such target '@com_google_protobuf//:well_known_types_py_pb2_genproto': target 'well_known_types_py_pb2_genproto' not declared in package '' defined by external/com_google_protobuf/BUILD.bazel and referenced by '//tensorflow/compiler/xla:xla_data_proto_py_genproto

Activity

  1. added
    TF 2.12
    subtype: ubuntu/linux
    subtype:bazel
    on May 23, 2023
  2. SuryanarayanaY commented on May 24, 2023

    @SuryanarayanaY
    Collaborator

    Hi @njzjz ,

    Thanks for your time in reporting the issue. I have replicated the reported behaviour with current master branch.Attached logs below for reference.

    (tf) suryanarayanay@surya-ubuntu-22-04:~$ export TF_SYSTEM_LIBS=com_google_protobuf
    (tf) suryanarayanay@surya-ubuntu-22-04:~$ cd tensorflow
    (tf) suryanarayanay@surya-ubuntu-22-04:~/tensorflow$ git checkout master
    Updating files: 100% (10666/10666), done.
    Switched to branch 'master'
    Your branch is up to date with 'origin/master'.
    (tf) suryanarayanay@surya-ubuntu-22-04:~/tensorflow$ bazel build //tensorflow/tools/pip_package:build_pip_package
    /bin/bash: /home/suryanarayanay/miniconda3/lib/libtinfo.so.6: no version information available (required by /bin/bash)
    Starting local Bazel server and connecting to it...
    INFO: Options provided by the client:
      Inherited 'common' options: --isatty=1 --terminal_columns=124
    INFO: Reading rc options for 'build' from /home/suryanarayanay/tensorflow/.bazelrc:
      Inherited 'common' options: --experimental_repo_remote_exec
    INFO: Reading rc options for 'build' from /home/suryanarayanay/tensorflow/.bazelrc:
      'build' options: --define framework_shared_object=true --define tsl_protobuf_header_only=true --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --enable_platform_specific_config --define=with_xla_support=true --config=short_logs --config=v2 --define=no_aws_support=true --define=no_hdfs_support=true --experimental_cc_shared_library --experimental_link_static_libraries_once=false --incompatible_enforce_config_setting_visibility
    INFO: Reading rc options for 'build' from /home/suryanarayanay/tensorflow/.tf_configure.bazelrc:
      'build' options: --action_env PYTHON_BIN_PATH=/home/suryanarayanay/miniconda3/envs/bazel2/bin/python3 --action_env PYTHON_LIB_PATH=/home/suryanarayanay/miniconda3/envs/bazel2/lib/python3.9/site-packages --python_path=/home/suryanarayanay/miniconda3/envs/bazel2/bin/python3
    INFO: Reading rc options for 'build' from /home/suryanarayanay/tensorflow/.bazelrc:
      'build' options: --deleted_packages=tensorflow/compiler/mlir/tfrt,tensorflow/compiler/mlir/tfrt/benchmarks,tensorflow/compiler/mlir/tfrt/jit/python_binding,tensorflow/compiler/mlir/tfrt/jit/transforms,tensorflow/compiler/mlir/tfrt/python_tests,tensorflow/compiler/mlir/tfrt/tests,tensorflow/compiler/mlir/tfrt/tests/ir,tensorflow/compiler/mlir/tfrt/tests/analysis,tensorflow/compiler/mlir/tfrt/tests/jit,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_tfrt,tensorflow/compiler/mlir/tfrt/tests/lhlo_to_jitrt,tensorflow/compiler/mlir/tfrt/tests/tf_to_corert,tensorflow/compiler/mlir/tfrt/tests/tf_to_tfrt_data,tensorflow/compiler/mlir/tfrt/tests/saved_model,tensorflow/compiler/mlir/tfrt/transforms/lhlo_gpu_to_tfrt_gpu,tensorflow/core/runtime_fallback,tensorflow/core/runtime_fallback/conversion,tensorflow/core/runtime_fallback/kernel,tensorflow/core/runtime_fallback/opdefs,tensorflow/core/runtime_fallback/runtime,tensorflow/core/runtime_fallback/util,tensorflow/core/tfrt/eager,tensorflow/core/tfrt/eager/backends/cpu,tensorflow/core/tfrt/eager/backends/gpu,tensorflow/core/tfrt/eager/core_runtime,tensorflow/core/tfrt/eager/cpp_tests/core_runtime,tensorflow/core/tfrt/gpu,tensorflow/core/tfrt/run_handler_thread_pool,tensorflow/core/tfrt/runtime,tensorflow/core/tfrt/saved_model,tensorflow/core/tfrt/graph_executor,tensorflow/core/tfrt/saved_model/tests,tensorflow/core/tfrt/tpu,tensorflow/core/tfrt/utils
    INFO: Found applicable config definition build:short_logs in file /home/suryanarayanay/tensorflow/.bazelrc: --output_filter=DONT_MATCH_ANYTHING
    INFO: Found applicable config definition build:v2 in file /home/suryanarayanay/tensorflow/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
    INFO: Found applicable config definition build:linux in file /home/suryanarayanay/tensorflow/.bazelrc: --host_copt=-w --copt=-Wno-all --copt=-Wno-extra --copt=-Wno-deprecated --copt=-Wno-deprecated-declarations --copt=-Wno-ignored-attributes --copt=-Wno-array-bounds --copt=-Wunused-result --copt=-Werror=unused-result --copt=-Wswitch --copt=-Werror=switch --copt=-Wno-error=unused-but-set-variable --define=PREFIX=/usr --define=LIBDIR=$(PREFIX)/lib --define=INCLUDEDIR=$(PREFIX)/include --define=PROTOBUF_INCLUDE_PATH=$(PREFIX)/include --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 --config=dynamic_kernels --distinct_host_configuration=false --experimental_guard_against_concurrent_changes
    INFO: Found applicable config definition build:dynamic_kernels in file /home/suryanarayanay/tensorflow/.bazelrc: --define=dynamic_loaded_kernels=true --copt=-DAUTOLOAD_DYNAMIC_KERNELS
    ERROR: /home/suryanarayanay/tensorflow/tensorflow/core/function/trace_type/BUILD:140:17: no such target '@com_google_protobuf//:well_known_types_py_pb2_genproto': target 'well_known_types_py_pb2_genproto' not declared in package '' defined by /home/suryanarayanay/.cache/bazel/_bazel_suryanarayanay/e93ef42332b258ebf8397106d59e39e3/external/com_google_protobuf/BUILD.bazel and referenced by '//tensorflow/core/function/trace_type:default_types_proto_py_genproto'
    INFO: Repository typing_extensions_archive instantiated at:
      /home/suryanarayanay/tensorflow/WORKSPACE:15:14: in <toplevel>
      /home/suryanarayanay/tensorflow/tensorflow/workspace2.bzl:966:21: in workspace
      /home/suryanarayanay/tensorflow/tensorflow/workspace2.bzl:391:20: in _tf_repositories
      /home/suryanarayanay/tensorflow/third_party/repo.bzl:136:21: in tf_http_archive
    Repository rule _tf_http_archive defined at:
      /home/suryanarayanay/tensorflow/third_party/repo.bzl:89:35: in <toplevel>
    INFO: Repository wrapt instantiated at:
      /home/suryanarayanay/tensorflow/WORKSPACE:15:14: in <toplevel>
      /home/suryanarayanay/tensorflow/tensorflow/workspace2.bzl:966:21: in workspace
      /home/suryanarayanay/tensorflow/tensorflow/workspace2.bzl:875:20: in _tf_repositories
      /home/suryanarayanay/tensorflow/third_party/repo.bzl:136:21: in tf_http_archive
    Repository rule _tf_http_archive defined at:
      /home/suryanarayanay/tensorflow/third_party/repo.bzl:89:35: in <toplevel>
    INFO: Repository dill_archive instantiated at:
      /home/suryanarayanay/tensorflow/WORKSPACE:15:14: in <toplevel>
      /home/suryanarayanay/tensorflow/tensorflow/workspace2.bzl:966:21: in workspace
      /home/suryanarayanay/tensorflow/tensorflow/workspace2.bzl:431:20: in _tf_repositories
      /home/suryanarayanay/tensorflow/third_party/repo.bzl:136:21: in tf_http_archive
    Repository rule _tf_http_archive defined at:
      /home/suryanarayanay/tensorflow/third_party/repo.bzl:89:35: in <toplevel>
    ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted: 
    INFO: Elapsed time: 24.342s
    INFO: 0 processes.
    FAILED: Build did NOT complete successfully (131 packages loaded, 168 targets configured)
        currently loading: tensorflow/python/compiler/tensorrt/test ... (4 packages)
        Fetching @rules_python; fetching
        Fetching ...python; Extracting /home/suryanarayanay/.cache/bazel/_bazel_suryanarayanay/e93ef42332b258ebf8397106d59e39e\
    3/external/rules_python/temp12165787461814660505/rules_python-0.0.1.tar.gz
        Fetching https://storage.googleapis.com/mirror.tensorflow.org/github.com/GrahamDumpleton/wrapt/archive/1.14.1.tar.gz
        Fetching https://storage.googleapis.com/.../github.com/uqfoundation/dill/releases/download/dill-0.3.6/dill-0.3.6.zip
    (tf) suryanarayanay@surya-ubuntu-22-04:~/tensorflow$ 
    

    If you are willing to contribute to fix this please feel free to raise a PR.

    Thanks!

  3. added
    stat:awaiting response
    on May 24, 2023
  4. njzjz commented on May 25, 2023

    @njzjz
    ContributorAuthor

    If you are willing to contribute to fix this please feel free to raise a PR.

    Sorry, I am not an expert in protobuf and am not sure how to fix this. That's the reason I submit the issue.

    Below is what I tried to do

    diff --git a/third_party/systemlibs/protobuf.BUILD b/third_party/systemlibs/protobuf.BUILD
    index 4d05ab28d12..0bae75daa1d 100644
    --- a/third_party/systemlibs/protobuf.BUILD
    +++ b/third_party/systemlibs/protobuf.BUILD
    @@ -111,3 +111,11 @@ py_library(
         visibility = ["//visibility:public"],
         deps = [dep + "_proto" for dep in proto[1][1]],
     ) for proto in WELL_KNOWN_PROTO_MAP.items()]
    +
    +py_proto_library(
    +    name = "well_known_types_py_pb2",
    +    include = ".",
    +    srcs = [proto[1][0] for proto in WELL_KNOWN_PROTO_MAP.items()],
    +    visibility = ["//visibility:public"],
    +)
    +

    But I got this error:

    # Execution platform: @local_execution_config_platform//:platform
    In file included from ./tensorflow/tsl/platform/status.h:37,
                     from ./tensorflow/tsl/c/tsl_status_internal.h:19,
                     from ./tensorflow/c/tf_status_internal.h:19,
                     from tensorflow/c/tf_status.cc:18:
    bazel-out/k8-opt/bin/tensorflow/tsl/protobuf/error_codes.pb.h:10:10: fatal error: google/protobuf/port_def.inc: No such file or directory
       10 | #include <google/protobuf/port_def.inc>
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    
  5. removed
    stat:awaiting response
    on May 25, 2023
  6. SuryanarayanaY commented on May 29, 2023

    @SuryanarayanaY
    Collaborator
  7. added
    stat:awaiting tensorflower
    on May 29, 2023
  8. vam-google commented on May 30, 2023

    @vam-google
    Collaborator

    Hi @njzjz
    Building with systemlibs is not officially supported. We neither support it nore have any jobs which test them. I would also strongly discourage anyone relying on those to perform a build. Also we are planning even bigger changes soon (like hermetic python) which will break systemlibs build path even further.

    Supporting those was purely on community (i believe @perfinion should know the most about it).

    The following is just my personal opinion, not an official statement from TF team.
    I don't think we can/should maintain systemlibs build path, as it is against hermetic philosophy of our build and prevents us from doing major changes in a build to simplify it (tensorflow build definitely needs a simplification). Also, we simply do not have any CI jobs to verify them, so they can break any time on any change. There is also no clear business need to have them.

    I would strongly consider moving systemlibs to a separate fork and maintain it there, if it is possible to maintain, or drop otherwise. One of the reasons why it was not causing many problems before was that were were not making many updates in our deps before (protobuf dependency was 3 years old).

  9. vam-google commented on May 30, 2023

    @vam-google
    Collaborator

    I will close this ticket as it is related to not officially supported feature. Feel free to reopen, if you believe it should be supported (in that case, please also clarify a reason).

  10. google-ml-butler commented on May 30, 2023

    @google-ml-butler

    Are you satisfied with the resolution of your issue?
    Yes
    No

  11. h-vetinari commented on May 30, 2023

    @h-vetinari
    Contributor

    I don't think we can/should maintain systemlibs build path, as it is against hermetic philosophy of our build and prevents us from doing major changes in a build to simplify it (tensorflow build definitely needs a simplification)

    I agree that the build needs simplification, but removing the possibility to build against systemlibs is very hostile to any redistribution effort. Tensorflow is already a beast, and just requiring that it revendors the world is neither a feasible nor reasonable strategy (from the packaging POV).

  12. chuckatkins commented on Aug 28, 2023

    @chuckatkins

    In a world where tensorflow was a stand-alone application that would be fine. But as a library that gets used in other applications, not supporting external dependencies is problematic at best. Especially when it comes to building custom operators against the the TF C++ library that have to use external dependencies, an inherent conflict exist with libtensorflow using its "vendored" deps via bazel while the operator has to pull in code linked to other versions of said dependencies. It's already difficult enough as it is use external deps but I think making that work much better is far more conducive to TensorFlow "playing well with others" in an ecosystem where it doesn't control the entire stack than simply abandoning it entirely.

    If it's a matter of build jobs and CI resources, I'd be happy to have a discussion out-of-band on providing that for the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

TF 2.12stat:awaiting tensorflowersubtype: ubuntu/linuxsubtype:bazeltype:build/install

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions