Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ build --host_cxxopt=-std=c++17
# copy-on-write semantics of std::strings of the older ABI.
build --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=0

build --workspace_status_command=/proc/self/cwd/tools/gen_status_stamp.sh
build --workspace_status_command=tools/gen_status_stamp.sh

build --experimental_repo_remote_exec

Expand All @@ -96,7 +96,17 @@ build --define=use_tensorflow_io=1

# TensorFlow Decision Forests does not use Absl concurrency primitives on MacOs.
# Reason: TensorFlow/ABSL ODR violation (b/214189609) # copybara:strip
build:macos --define std_synchronization_primitives=1
# DISABLED for native macOS build due to C++20 std::latch compatibility issues
# build:macos --define std_synchronization_primitives=1

# macOS-specific build configuration for native compilation
build:macos --cxxopt=-mmacosx-version-min=10.13
build:macos --cxxopt=-faligned-allocation
build:macos --host_cxxopt=-mmacosx-version-min=10.13
build:macos --host_cxxopt=-faligned-allocation
# Disable C++ modules to avoid indirect dependency issues
build:macos --features=-use_module_maps
build:macos --features=-layering_check

# Taken from https://github.com/openxla/xla/blob/99559d7a4f7c55490f46385ad29a3cbf9c3911af/warnings.bazelrc#L6
# We silence warnings for code in `external`.
Expand All @@ -111,3 +121,15 @@ build --copt=-Wno-unused-but-set-variable # due to `ifdefs` in ml_dtypes
# and disable Bzlmod.
common --enable_bzlmod=false
common --noincompatible_enable_cc_toolchain_resolution

# Increase timeout for repository fetches (especially for Boost with submodules)
fetch --repository_cache_hardlinks=false
fetch --http_timeout_scaling=10.0
common --experimental_repository_downloader_retries=3
common --experimental_scale_timeouts=10.0

# macOS: Use system tools instead of conda environment tools
build:macos --action_env AR=/usr/bin/ar
build:macos --action_env LD=/usr/bin/ld
build:macos --action_env LIBTOOL=/usr/bin/libtool
build:macos --action_env NM=/usr/bin/nm
30 changes: 30 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: tf-serving-build

# Bazelisk is the recommended way to manage Bazel versions (automatically downloads and uses the right version).
# To install Bazelisk:
# 1. Create directory: mkdir -p ~/.local/bin
# 2. Download: curl -L https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-darwin-arm64 -o ~/.local/bin/bazel
# (use bazelisk-darwin-amd64 for Intel Macs)
# 3. Make executable: chmod +x ~/.local/bin/bazel
# 4. Add to PATH: export PATH="$HOME/.local/bin:$PATH" (add to ~/.zshrc or ~/.bash_profile)
# 5. Optional: Set specific Bazel version with export USE_BAZEL_VERSION=x.y.z
# 6. Verify: bazel --version

channels:
- conda-forge
- defaults
dependencies:
- python=3.11
- automake
- autoconf
- libtool
- make
- cmake
- git
- pkg-config
- wget
- curl
- patch
- unzip
- zip
- clang=18.1.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason for not adding bazel?

bazel>=7.4.1

Copy link
Author

@czgdp1807 czgdp1807 Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The best way to manage bazel is using bazelisk and then setting the USE_BAZEL_VERSION to the appropriate version. Let me add a comment in this .yml file with the steps to install and use bazel via bazelisk.

Also, AFAIK, bazel executables on conda are corrupt for some of its released versions. That's why bazelisk is the best version manager for bazel.

2 changes: 1 addition & 1 deletion tensorflow_serving/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,6 @@ def tf_serving_workspace():
commit = "b7b1371294b4bdfc8d85e49236ebced114bc1d8f", # boost-1.75.0
build_file = "//third_party/boost:BUILD",
init_submodules = True,
recursive_init_submodules = True,
recursive_init_submodules = False, # Disabled to avoid timeout - Boost submodules don't have nested submodules
remote = "https://github.com/boostorg/boost",
)