Uh oh!
There was an error while loading. Please reload this page.
Fix Bazel build errors for OSS environment - #50
Conversation
- Add py_proto_library macro for OSS compatibility - Replace gunit_main with googletest gtest_main - Comment out Google-internal dependencies and missing test files - Fix proto import to use workspace-relative path - Remove invalid third_party load statements Fixes build errors when running `bazel build //...` in OSS environment.
czgdp1807
commented
Feb 5, 2026
Here are the build logs, (s2t-env) czgdp1807@qgpu3:~/struct2tensor$ bazel build /...
INFO: Build option --action_env has changed, discarding analysis cache.
WARNING: /home/czgdp1807/.cache/bazel/_bazel_czgdp1807/38445803433c11c40285b6c944f811b3/external/local_config_tf/BUILD:20551:8: target 'libtensorflow_framework.so' is both a rule and a file; please choose another name for the rule
INFO: Analyzed 173 targets (199 packages loaded, 12848 targets configured).
INFO: Found 173 targets...
INFO: From Compiling snappy-sinksource.cc:
cc1plus: warning: command-line option '-Wno-implicit-function-declaration' is valid for C/ObjC but not for C++
INFO: From Compiling snappy-stubs-internal.cc:
cc1plus: warning: command-line option '-Wno-implicit-function-declaration' is valid for C/ObjC but not for C++
INFO: From Compiling snappy.cc:
cc1plus: warning: command-line option '-Wno-implicit-function-declaration' is valid for C/ObjC but not for C++
INFO: From Compiling src/google/protobuf/compiler/rust/relative_path.cc [for tool]:
external/com_google_protobuf/src/google/protobuf/compiler/rust/relative_path.cc: In member function'std::string google::protobuf::compiler::rust::RelativePath::Relative(const google::protobuf::compiler::rust::RelativePath&) const':external/com_google_protobuf/src/google/protobuf/compiler/rust/relative_path.cc:66:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::basic_string_view<char>>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 66 | for (int i = 0; i < current_segments.size(); ++i) { | ~~^~~~~~~~~~~~~~~~~~~~~~~~~INFO: From Compiling src/google/protobuf/arena.cc [for tool]:external/com_google_protobuf/src/google/protobuf/arena.cc: In member function 'void* google::protobuf::internal::SerialArena::AllocateAlignedFallback(size_t)':external/com_google_protobuf/src/google/protobuf/arena.cc:200:10: warning: 'ret' may be used uninitialized [-Wmaybe-uninitialized] 200 | return ret; | ^~~external/com_google_protobuf/src/google/protobuf/arena.cc:197:9: note: 'ret' was declared here 197 | void* ret; | ^~~INFO: From Compiling snappy-sinksource.cc [for tool]:cc1plus: warning: command-line option '-Wno-implicit-function-declaration' is valid for C/ObjC but not for C++INFO: From Compiling src/google/protobuf/message_lite.cc [for tool]:external/com_google_protobuf/src/google/protobuf/message_lite.cc: In member function 'int google::protobuf::MessageLite::GetCachedSize() const':external/com_google_protobuf/src/google/protobuf/message_lite.cc:69:70: warning: 'int google::protobuf::MessageLite::ByteSize() const' is deprecated: Please use ByteSizeLong() instead [-Wdeprecated-declarations] 69 | if (PROTOBUF_PREDICT_FALSE(cached_size == nullptr)) return ByteSize(); | ~~~~~~~~^~In file included from external/com_google_protobuf/src/google/protobuf/message_lite.cc:13:bazel-out/k8-opt-exec-50AE0418/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/protobuf_lite/google/protobuf/message_lite.h:454:59: note: declared here 454 | [[deprecated("Please use ByteSizeLong() instead")]] int ByteSize() const { | ^~~~~~~~INFO: From Compiling snappy-stubs-internal.cc [for tool]:cc1plus: warning: command-line option '-Wno-implicit-function-declaration' is valid for C/ObjC but not for C++INFO: From Compiling snappy.cc [for tool]:cc1plus: warning: command-line option '-Wno-implicit-function-declaration' is valid for C/ObjC but not for C++INFO: From Compiling src/google/protobuf/generated_message_tctable_lite.cc [for tool]:In file included from bazel-out/k8-opt-exec-50AE0418/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/protobuf_lite/google/protobuf/generated_message_tctable_decl.h:22, from external/com_google_protobuf/src/google/protobuf/generated_message_tctable_lite.cc:22:bazel-out/k8-opt-exec-50AE0418/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/protobuf_lite/google/protobuf/parse_context.h:1125:1: warning: 'always_inline' function might not be inlinable [-Wattributes] 1125 | ParseContext::ParseLengthDelimitedInlined(const char* ptr, const Func& func) { | ^~~~~~~~~~~~bazel-out/k8-opt-exec-50AE0418/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/protobuf_lite/google/protobuf/parse_context.h:1125:1: warning: 'always_inline' function might not be inlinable [-Wattributes]external/com_google_protobuf/src/google/protobuf/generated_message_tctable_lite.cc:830:36: warning: 'always_inline' function might not be inlinable [-Wattributes] 830 | PROTOBUF_ALWAYS_INLINE const char* TcParser::FastVarintS1( | ^~~~~~~~external/com_google_protobuf/src/google/protobuf/generated_message_tctable_lite.cc:830:36: warning: 'always_inline' function might not be inlinable [-Wattributes]external/com_google_protobuf/src/google/protobuf/generated_message_tctable_lite.cc:753:29: warning: 'always_inline' function might not be inlinable [-Wattributes] 753 | PROTOBUF_ALWAYS_INLINE bool EnumIsValidAux(int32_t val, uint16_t xform_val, | ^~~~~~~~~~~~~~external/com_google_protobuf/src/google/protobuf/generated_message_tctable_lite.cc:741:29: warning: 'always_inline' function might not be inlinable [-Wattributes] 741 | PROTOBUF_ALWAYS_INLINE void PrefetchEnumData(uint16_t xform_val, | ^~~~~~~~~~~~~~~~INFO: From ProtoCompile external/com_google_protobuf/python/google/protobuf/any_pb2.py:external/com_google_protobuf/.: warning: directory does not exist.INFO: From ProtoCompile external/com_google_protobuf/python/google/protobuf/descriptor_pb2.py:external/com_google_protobuf/.: warning: directory does not exist.INFO: From ProtoCompile external/com_google_protobuf/python/google/protobuf/compiler/plugin_pb2.py:external/com_google_protobuf/.: warning: directory does not exist.INFO: From ProtoCompile external/com_google_protobuf/python/google/protobuf/duration_pb2.py:external/com_google_protobuf/.: warning: directory does not exist.INFO: From ProtoCompile external/com_google_protobuf/python/google/protobuf/empty_pb2.py:external/com_google_protobuf/.: warning: directory does not exist.INFO: From ProtoCompile external/com_google_protobuf/python/google/protobuf/api_pb2.py:external/com_google_protobuf/.: warning: directory does not exist.INFO: From ProtoCompile external/com_google_protobuf/python/google/protobuf/field_mask_pb2.py:external/com_google_protobuf/.: warning: directory does not exist.INFO: From ProtoCompile external/com_google_protobuf/python/google/protobuf/struct_pb2.py:external/com_google_protobuf/.: warning: directory does not exist.INFO: From ProtoCompile external/com_google_protobuf/python/google/protobuf/source_context_pb2.py:external/com_google_protobuf/.: warning: directory does not exist.INFO: From ProtoCompile external/com_google_protobuf/python/google/protobuf/type_pb2.py:external/com_google_protobuf/.: warning: directory does not exist.INFO: From ProtoCompile external/com_google_protobuf/python/google/protobuf/timestamp_pb2.py:external/com_google_protobuf/.: warning: directory does not exist.INFO: From ProtoCompile external/com_google_protobuf/python/google/protobuf/wrappers_pb2.py:external/com_google_protobuf/.: warning: directory does not exist.INFO: From Generating Descriptor Set proto_library @com_github_tensorflow_metadata//tensorflow_metadata/proto/v0:metadata_v0_proto:tensorflow_metadata/proto/v0/metric.proto:23:1: warning: Import tensorflow_metadata/proto/v0/path.proto is unused.tensorflow_metadata/proto/v0/problem_statement.proto:20:1: warning: Import google/protobuf/struct.proto is unused.INFO: From Generating proto_library @com_github_tensorflow_metadata//tensorflow_metadata/proto/v0:metadata_v0_proto:tensorflow_metadata/proto/v0/metric.proto:23:1: warning: Import tensorflow_metadata/proto/v0/path.proto is unused.tensorflow_metadata/proto/v0/problem_statement.proto:20:1: warning: Import google/protobuf/struct.proto is unused.INFO: From Compiling tsl/platform/status.cc [for tool]:external/local_tsl/tsl/platform/status.cc: In function 'std::vector<tsl::StackFrame> tsl::errors::GetStackTrace(const absl::lts_20230802::Status&)':external/local_tsl/tsl/platform/status.cc:146:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char>>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 146 | for (int i = 0; i < split.size() / 3; ++i) { | ~~^~~~~~~~~~~~~~~~~~INFO: Elapsed time: 154.236s, Critical Path: 146.36sINFO: 2151 processes: 503 internal, 1648 processwrapper-sandbox.INFO: Build completed successfully, 2151 total actions |
czgdp1807
commented
Feb 5, 2026
@vkarampudi If you want anything to be uncommented please let me know. I will see what I can do. There are a few things which I concluded to be Google-internal. My reasoning may be wrong, so please let me know in that case. Thank you. |
Uh oh!
There was an error while loading. Please reload this page.
* Struct2Tensor 0.48.0 Release PiperOrigin-RevId: 743712449 * Build documentation with `mkdocs` (#38) * Add minimum viable mkdocs configuration * Add examples section * Add links to api docs and overviews * Get api docs up and running * Add `__all__` to `__init__.py` files to include correct classes This is just a first step to including the correct items in the api docs * Exclude test modules from docs * Use correct module * Add docs deployment workflow * Include all correct modules/classes/functions * Fix button rendering * Fix formatting, including admonitions * Fix broken link * Use README.md as homepage for docs * Fix links * Remove debug triggers from docs deployment workflow * Remove deprecated api docs * Fix triggers * Move docs requirements to common location * Only trigger on pushes to master * Remove unnecessary newline characters * Move docs location to default `docs` directory * only internal visibility change, no external change PiperOrigin-RevId: 755419474 * Automated Code Change PiperOrigin-RevId: 796979132 * Automated Code Change PiperOrigin-RevId: 803375108 * no-op PiperOrigin-RevId: 809038483 * Added pytype None checks to calculate.py PiperOrigin-RevId: 845226580 * Replace unicode escaped characters in ipynb files PiperOrigin-RevId: 856192266 * Fixes that needs to be available in the main branch in order to cherry-pick into Release branch (#49) * Update WORKSPACE * Update workspace.bzl * Migrate to Protobuf 4.23.4: custom Bazel rule for Python proto generation Protobuf 4.x removed py_proto_library and changed proto_library behavior. This commit: - Creates _py_proto_library_rule: a custom Bazel rule that accepts ProtoInfo or PyInfo, runs protoc to generate Python _pb2.py files, and provides PyInfo for Python deps - Replaces deprecated py_proto_library calls with custom rule implementation - Configures protoc proto_path to include workspace dirs and external dependencies - Adds local any.proto copies to bypass sandbox limitations in proto imports - Applies compatibility patches to TensorFlow and TensorFlow Metadata dependencies - Updates all s2t_proto_library_py calls to work with new implementation Fixes: Protobuf 4.23.4 compatibility for struct2tensor build system * Add compatibility patches for older Abseil and Protobuf 4.x This patch extends tensorflow.patch with changes to support: 1. Abseil backward compatibility: - Add absl_base_prefetch.h compatibility shim for older Abseil versions that lack absl/base/prefetch.h - Update prefetch includes across TensorFlow/TSL to use the shim - Add inline implementation of NullTerminatedMessage for older Abseil versions without StatusMessageAsCStr 2. Protobuf 4.x support: - Refactor cc_proto_library to use native proto_library and cc_proto_library rules instead of custom proto_gen - Implement custom _tsl_py_proto_library_rule to replace the built-in py_proto_library removed in Protobuf 4.x - Update proto library generation to depend on generated cc_proto_library targets 3. Build cleanup: - Remove unused absl/strings:string_view dependency - Update BUILD files to reflect new dependency structure These changes enable building struct2tensor with older Abseil versions while supporting Protobuf 4.x, improving compatibility across different dependency versions. * chore: upgrade Protobuf dependency from 4.23.4 to 4.25.6 * Move TFMD patch to tfmd.patch; Protobuf 4.x compatibility Remove vendored google/protobuf/any.proto and obsolete third_party/README.md * fix: Use native prefix for Bazel rules in macros Prefix cc_binary and cc_library with native. in struct2tensor.bzl * Update Dockerfile * Fix struct2tensor integration in TensorFlow Serving Docker build Apply rules_cc patch before adding struct2tensor local repository to ensure proper Bazel configuration. * Update RELEASE.md to sync with main branch * Update version.py --------- Co-authored-by: Gagandeep Singh <gdp.1807@gmail.com> * docs(release): Update RELEASE.md and version for 0.48.0 * Update Dockerfile to build with serving version 2.17.1 * Build and stage dynamic op libraries before wheel creation (#51) Add explicit build and copy steps for dynamic op libraries (.so files) in build_common.sh. This ensures all six dynamic library targets are built and copied to struct2tensor/ops/ before the wheel is packaged. Previously, the stamp_wheel step in build_manylinux.sh would fail with patchelf errors ("No such file or directory") because the .so files were expected in struct2tensor/ops/ but were not being copied from bazel-bin. This fix: - Explicitly builds each dynamic library target - Copies the built .so files from bazel-bin to the staging directory - Runs before bazel run :build_pip_package to ensure files are present Fixes the missing _decode_proto_map_op.so, _decode_proto_sparse_op.so and related dynamic library warnings during wheel packaging. * Enable OSS Bazel builds by fixing dependencies and proto paths (#50) - Add py_proto_library macro for OSS compatibility - Replace gunit_main with googletest gtest_main - Comment out Google-internal dependencies and missing test files - Fix proto import to use workspace-relative path - Remove invalid third_party load statements Fixes build errors when running `bazel build //...` in OSS environment. Co-authored-by: Madhur Karampudi <142544288+vkarampudi@users.noreply.github.com> --------- Co-authored-by: struct2tensor-team <tensorflow-extended-nonhuman@googlegroups.com> Co-authored-by: Gagandeep Singh <gdp.1807@gmail.com>
Summary
This PR addresses multiple build failures when running
bazel build //...in the open-source environment by removing Google-internal dependencies and fixing proto import paths.Changes Made
Proto Library Support:
py_proto_librarymacro tostruct2tensor.bzlfor OSS compatibility with protobuf 4.xtest_any.prototo use workspace-relative path (struct2tensor/test/any.proto)third_party/protobuf/bazelandtools/build_defs/proto/cpppathsTest Framework:
gunit_mainwith OSS-compatible@com_google_googletest//:gtest_mainin parquet testskernels/parquet/BUILD:parent_indices_builder_test.ccparquet_reader_test.ccparquet_reader_util_test.ccserialization_benchmarkthat depends on internal benchmark frameworkDependencies:
//testing/pybaseand//testing/pybase:parameterized//file/colossus/public:cns//third_party/py/cpuinfo,//third_party/py/psutil,//third_party/py/yaml//third_party/py/tensorflow_docs//third_party/py/absl:appInvestigation Process
Build error analysis: Bazel errors explicitly indicated missing packages:
Workspace verification: Checked
third_party/directory structure and confirmed these paths don't exist in the OSS repositoryDependency pattern recognition: Distinguished internal vs OSS dependencies:
//path/to/internal(workspace-relative paths that don't exist)@external_repo//path(external dependencies like@absl_py//,@com_google_protobuf//)Iterative testing: Confirmed by progressively commenting out suspected internal dependencies and verifying build progress
Testing
bazel build //...completes successfully in OSS build environmentImpact