Skip to content

Add tools/build.sh to automatically apply XLA/GCC compatibility patches - #4145

Open
Phoebus-Liu wants to merge 1 commit into
tensorflow:masterfrom
Phoebus-Liu:fix/issue-4108-Error-building-TF-Serving-from-source
Open

Add tools/build.sh to automatically apply XLA/GCC compatibility patches#4145
Phoebus-Liu wants to merge 1 commit into
tensorflow:masterfrom
Phoebus-Liu:fix/issue-4108-Error-building-TF-Serving-from-source

Conversation

@Phoebus-Liu

Copy link
Copy Markdown

Description

This PR fixes #4108 by adding a tools/build.sh convenience wrapper that automatically applies known compatibility patches before invoking run_in_docker.sh.

Problem

When building TF Serving from source with newer GCC versions (e.g., GCC 11/12/13), the build fails in external/local_xla/xla/shape.cc with:

error: function 'xla::Shape::Shape(xla::Shape&&)' defaulted on its redeclaration with an exception-specification that differs from the implicit exception-specification 'noexcept(false)'

This is caused by noexcept annotations on the move constructor/assignment that conflict with the implicit exception specification inferred by newer GCC/libstdc++.

Solution

  • Add tools/build.sh which:
    1. Runs bazel fetch inside Docker to ensure external/ dependencies are present
    2. Applies sed patches to xla/shape.cc and xla/shape.h to remove the conflicting noexcept on move operations
    3. Forwards to tools/run_in_docker.sh for the actual build

Usage

./tools/build.sh -c opt tensorflow_serving/model_servers:tensorflow_model_server

Why not patch run_in_docker.sh directly?

run_in_docker.sh is a generic command runner. Adding build-specific patches there would couple the general Docker launcher to a specific dependency workaround. A dedicated build.sh is cleaner and avoids surprising users who run non-build commands.

Fixes

Fixes #4108

### Commit Message

```bash
git add tools/build.sh
git commit -m "Add build.sh wrapper to fix XLA/GCC noexcept compatibility

Adds a dedicated build wrapper that automatically applies sed patches
for the XLA Shape move-ctor noexcept mismatch seen with GCC 11+.
This avoids modifying the generic run_in_docker.sh tool.

Fixes #4108"

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error building TF Serving from source

1 participant