fix: pre-set CMAKE_HIP_COMPILER="" for CPU build to prevent HIP detection

This commit is contained in:
2026-05-09 23:50:26 -04:00
parent 32df546550
commit 208bfd4612

View File

@@ -42,12 +42,13 @@ ENV CMAKE_GENERATOR=Ninja
ENV LDFLAGS=-s ENV LDFLAGS=-s
# Step 1: Build CPU backends with GCC (no ROCm preset) # Step 1: Build CPU backends with GCC (no ROCm preset)
# Remove /opt/rocm from PATH to prevent check_language(HIP) from # Pre-set CMAKE_HIP_COMPILER="" to prevent check_language(HIP) from
# finding a HIP compiler, which would trigger the HIP block that # finding a HIP compiler (it searches /opt/rocm even without PATH).
# requires find_package(hip) with proper CMAKE_PREFIX_PATH. # Remove /opt/rocm from PATH to prevent find_program from finding hipcc.
RUN mkdir -p build-cpu && cd build-cpu && \ RUN mkdir -p build-cpu && cd build-cpu && \
PATH=/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ PATH=/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
cmake .. -DCMAKE_BUILD_TYPE=Release && \ cmake .. -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_HIP_COMPILER="" && \
cmake --build . --target ggml-cpu -- -l $(nproc) && \ cmake --build . --target ggml-cpu -- -l $(nproc) && \
cmake --install . --component CPU --strip --prefix /build/dist cmake --install . --component CPU --strip --prefix /build/dist