From ab9c6c4a2e7829dd96c20ea6e7515b1790256c95 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Mon, 27 Jul 2026 15:45:54 +0000 Subject: [PATCH] fix(audio-cpp): build arm64 with gcc-14 for the armv9.2 SME variants The arm64 CPU image failed to build: cc1: error: invalid feature modifier 'sme' in '-march=armv9.2-a+dotprod+fp16+sve+i8mm+sve2+sme' ggml's CPU_ALL_VARIANTS table includes armv9.2 variants compiled with +sme, and Ubuntu Noble's default gcc-13 rejects that feature modifier. Every entry in the table has to compile even though a host only ever dlopens the one its own CPU supports, so a single unbuildable variant fails the whole image. gcc-14 accepts it, which is exactly the fix llama-cpp already carries in .docker/llama-cpp-compile.sh; this is the same problem reached by a different Dockerfile. Applied to every arm64 BUILD_TYPE rather than to the CPU one alone, and that differs from llama-cpp on purpose. llama-cpp needs it only for its pure-CPU image because its GPU builds run llama-cpp-fallback, which builds no variant table. This backend's Makefile turns ENGINE_ENABLE_CPU_ALL_VARIANTS on for every non-Darwin build, GPU included, so an arm64 GPU image would hit the identical error. The matrix has no arm64 GPU entry today, which is precisely why gating on an empty BUILD_TYPE would leave the trap armed for whoever adds the first one. Signed-off-by: Ettore Di Giacinto Assisted-by: Claude:claude-opus-5 [Claude Code] --- backend/Dockerfile.audio-cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/backend/Dockerfile.audio-cpp b/backend/Dockerfile.audio-cpp index 99641076b..993e2e3b6 100644 --- a/backend/Dockerfile.audio-cpp +++ b/backend/Dockerfile.audio-cpp @@ -83,12 +83,33 @@ RUN --mount=type=bind,source=.docker/apt-mirror.sh,target=/usr/local/sbin/apt-mi if [ "${BUILD_TYPE}" = "vulkan" ]; then \ apt-get install -y --no-install-recommends libvulkan-dev glslc; \ fi && \ + if [ "${TARGETARCH}" = "arm64" ]; then \ + apt-get install -y --no-install-recommends gcc-14 g++-14; \ + fi && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* COPY . /LocalAI +# gcc-14 on arm64, for the same reason llama-cpp does it in +# .docker/llama-cpp-compile.sh: ggml's CPU_ALL_VARIANTS table includes armv9.2 +# variants built with -march=...+sme, and Noble's default gcc-13 rejects that +# feature modifier outright ("invalid feature modifier 'sme'"). Every variant in +# the table has to COMPILE even though a host only ever dlopens the one its own +# CPU supports, so one unbuildable variant fails the whole image. +# +# ON EVERY arm64 BUILD_TYPE, which is where this differs from llama-cpp's script +# and why that difference is spelled out rather than assumed. llama-cpp only +# needs gcc-14 for its pure-CPU image because its GPU builds run +# llama-cpp-fallback, which has no variant table at all. This backend's Makefile +# sets ENGINE_ENABLE_CPU_ALL_VARIANTS for every non-Darwin build, GPU included, +# so an arm64 GPU image would hit the identical compile error. Gating this on an +# empty BUILD_TYPE would leave that trap armed for the first arm64 GPU entry +# added to the matrix, which today has none. RUN --mount=type=cache,target=/root/.ccache,id=audio-cpp-ccache-${TARGETARCH}-${BUILD_TYPE},sharing=locked \ + if [ "${TARGETARCH}" = "arm64" ]; then \ + export CC=gcc-14 CXX=g++-14; \ + fi && \ make -C /LocalAI/backend/cpp/audio-cpp BUILD_TYPE=${BUILD_TYPE} \ CUDA_MAJOR_VERSION=${CUDA_MAJOR_VERSION} NATIVE=false grpc-server package