From c7b3c0fa4f355d6125bfc3c748698231e86d1e36 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Fri, 6 Feb 2026 17:28:50 +0530 Subject: [PATCH] Build and stage dynamic op libraries before wheel creation 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. --- build_common.sh | 17 +++++++++++++++++ .../tools/docker_build/build_manylinux.sh | 1 - 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/build_common.sh b/build_common.sh index a2081e8..1fe1475 100755 --- a/build_common.sh +++ b/build_common.sh @@ -62,6 +62,21 @@ function install_tensorflow() { "${PYTHON_BIN_PATH}" -c 'import tensorflow as tf; print(tf.version.VERSION)' } +function build_dynamic_libraries() { + # Explicitly build the dynamic library targets that are needed for the wheel. + # These are required by the stamp_wheel function. + bazel build //struct2tensor/ops:_decode_proto_map_op.so || exit 1; + bazel build //struct2tensor/ops:_decode_proto_sparse_op.so || exit 1; + bazel build //struct2tensor/ops:_run_length_before_op.so || exit 1; + bazel build //struct2tensor/ops:_equi_join_any_indices_op.so || exit 1; + bazel build //struct2tensor/ops:_equi_join_indices_op.so || exit 1; + bazel build //struct2tensor/ops:_parquet_dataset_op.so || exit 1; + + RUNFILES_DIR=$(pwd) + cp -f bazel-bin/struct2tensor/ops/*.so ${RUNFILES_DIR}/struct2tensor/ops/ + +} + set -x for i in "$@"; do @@ -116,6 +131,8 @@ if [[ ("${TF_VERSION}" == "NIGHTLY_TF") || ("${TF_VERSION}" == "NIGHTLY_TF_2") ] fi +build_dynamic_libraries + # :build_pip_package builds and links struct2tensor ops against a TF # installation and packages the result dynamic libraries. bazel run -c opt \ diff --git a/struct2tensor/tools/docker_build/build_manylinux.sh b/struct2tensor/tools/docker_build/build_manylinux.sh index 6120da3..2a6a37c 100755 --- a/struct2tensor/tools/docker_build/build_manylinux.sh +++ b/struct2tensor/tools/docker_build/build_manylinux.sh @@ -117,4 +117,3 @@ set -x setup_environment && \ bazel_build && \ stamp_wheel -