Skip to content

Commit b0a8565

Browse files
roxellbhcopeland
authored andcommitted
docker: fix gcc symlinks when base image has newer gcc
The unversioned symlinks was not created when the base image already had a gcc installed (e.g. gcc-14 on Debian Trixie), which made gcc-13 image use wrong compiler version. Also skip the symlink step completely for clang images since they don't need it. Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
1 parent dbadc5f commit b0a8565

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

support/docker/Dockerfile.build

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,12 @@ RUN set -x; \
198198

199199
# For gcc images, symlink all binaries with unversioned names into $PATH
200200
ARG TOOLCHAIN_VERSION
201-
RUN for bin in $(ls -1 /usr/bin/*-${TOOLCHAIN_VERSION} | xargs -n 1 basename); do \
202-
unver=${bin%-[0-9]*}; \
203-
if [ ! -x /usr/bin/${unver} ]; then \
201+
RUN if [ -x /usr/bin/gcc-${TOOLCHAIN_VERSION} ]; then \
202+
for bin in $(ls -1 /usr/bin/*-${TOOLCHAIN_VERSION} | xargs -n 1 basename); do \
203+
unver=${bin%-[0-9]*}; \
204204
ln -sfv /usr/bin/$bin /usr/local/bin/${unver}; \
205-
fi; \
206-
done
205+
done; \
206+
fi
207207

208208
# For clang images, symlink all the binaries in $PATH
209209
RUN if [ -d /usr/lib/llvm-*/bin ]; then ln -sfv /usr/lib/llvm-*/bin/* /usr/local/bin/; fi

0 commit comments

Comments
 (0)