Skip to content

Commit 4f68d0b

Browse files
authored
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.
1 parent 6e52a1a commit 4f68d0b

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

build_common.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,21 @@ function install_tensorflow() {
6262
"${PYTHON_BIN_PATH}" -c 'import tensorflow as tf; print(tf.version.VERSION)'
6363
}
6464

65+
function build_dynamic_libraries() {
66+
# Explicitly build the dynamic library targets that are needed for the wheel.
67+
# These are required by the stamp_wheel function.
68+
bazel build //struct2tensor/ops:_decode_proto_map_op.so || exit 1;
69+
bazel build //struct2tensor/ops:_decode_proto_sparse_op.so || exit 1;
70+
bazel build //struct2tensor/ops:_run_length_before_op.so || exit 1;
71+
bazel build //struct2tensor/ops:_equi_join_any_indices_op.so || exit 1;
72+
bazel build //struct2tensor/ops:_equi_join_indices_op.so || exit 1;
73+
bazel build //struct2tensor/ops:_parquet_dataset_op.so || exit 1;
74+
75+
RUNFILES_DIR=$(pwd)
76+
cp -f bazel-bin/struct2tensor/ops/*.so ${RUNFILES_DIR}/struct2tensor/ops/
77+
78+
}
79+
6580
set -x
6681

6782
for i in "$@"; do
@@ -116,6 +131,8 @@ if [[ ("${TF_VERSION}" == "NIGHTLY_TF") || ("${TF_VERSION}" == "NIGHTLY_TF_2") ]
116131

117132
fi
118133

134+
build_dynamic_libraries
135+
119136
# :build_pip_package builds and links struct2tensor ops against a TF
120137
# installation and packages the result dynamic libraries.
121138
bazel run -c opt \

struct2tensor/tools/docker_build/build_manylinux.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,3 @@ set -x
117117
setup_environment && \
118118
bazel_build && \
119119
stamp_wheel
120-

0 commit comments

Comments
 (0)