Skip to content

[build] build_metal.sh fails on Fedora/RHEL: "which: command not found" #37904

@ivoitovych

Description

@ivoitovych

Component / Area

build system

Issue Type (optional)

Runtime Crash

Observed

build_metal.sh fails on Fedora 40 (and other RHEL-family distros) with:

./build_metal.sh: line 382: which: command not found

Exit code 127. The build aborts immediately.

Expected

build_metal.sh should work on any Linux distribution with a POSIX-compliant shell, without requiring the non-standard which command.

1. Steps (exact commands)

# On a Fedora 40 system (or container) without `which` installed:
./create_venv.sh
source python_env/bin/activate
./build_metal.sh --debug

Alternatively, reproducible via Docker:

# Using a Dockerfile with FROM fedora:40, after running install_dependencies.sh and create_venv.sh:
./build_metal.sh --debug --build-all --enable-ccache

2. Input data / link or description

No special input data required. The issue triggers on any build invocation with Python bindings enabled (default).

3. Frequency

Always — 100% reproducible on Fedora/RHEL-family systems where which is not installed by default.

1. Software Versions

  • OS: Fedora 40 (Docker fedora:40 base image)
  • tt-metal: main branch at ea7b2e1457 (also confirmed on db459ba133)
  • Also affects: RHEL 9, Rocky Linux 9, AlmaLinux 9, CentOS Stream 9

2. Hardware Details

  • Not hardware-specific — this is a build system issue
  • Reproduced in Docker container (no Tenstorrent device required)

Is this a regression?

No — this has likely always been present but was never triggered because the official build environment is Ubuntu, which ships which by default.

Regression Details

N/A

Logs & Diagnostics

Full error context from Fedora 40 Docker build:

#24 0.226 INFO: Export compile commands: OFF
#24 0.226 INFO: Enable ccache: ON
#24 0.226 INFO: Build type: Debug
#24 0.226 INFO: Build directory: build_Debug
#24 0.226 INFO: Install Prefix: build_Debug
#24 0.226 INFO: Build tests: OFF
#24 0.226 INFO: Enable Unity builds: ON
#24 0.226 INFO: Enable Light Metal Trace: ON
#24 0.226 INFO: Enable Distributed: ON
#24 0.226 INFO: With python bindings: ON
#24 0.226 INFO: Enable Tracy: ON
#24 0.226 INFO: Enable LTO: OFF
#24 0.226 ./build_metal.sh: line 382: which: command not found

Root cause: Line 382 of build_metal.sh:

cmake_args+=("-DPython3_EXECUTABLE=$(which python3)")

which is not a POSIX standard command. Fedora/RHEL minimal images don't include it. The POSIX alternative command -v is already used in 40+ places across the tt-metal codebase (e.g., install_dependencies.sh, create_venv.sh, scripts/install-uv.sh), making this the only inconsistent usage.

Priority

P3

Impact

Blocks building tt-metal on Fedora, RHEL, Rocky Linux, AlmaLinux, and CentOS Stream without installing the optional which package. No impact on Ubuntu (default build platform).

Metadata

Metadata

Labels

Type

Projects

Status

🆕 New

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions