@@ -148,28 +148,29 @@ jobs:
148148 # 2) Clang build(s) (as implemented in ci_build.sh)
149149 if [ "${{ inputs.toolchain_clang }}" = "true" ]; then
150150
151- # Provide Newlib + GCC internal headers to clang (cross).
152- # This is required for stdlib.h, stdint.h, etc. in bare-metal builds.
151+ # Provide Newlib + GCC internal headers to clang (cross).
152+ # This is required for stdlib.h, stdint.h, etc. in bare-metal builds.
153153
154- NEWLIB_STDLIB="$(arm-none-eabi-gcc -print-file-name=stdlib.h)"
155- NEWLIB_INC="$(dirname "${NEWLIB_STDLIB}")"
156- GCC_INC="$(arm-none-eabi-gcc -print-file-name=include)"
154+ GCC_INC="$(arm-none-eabi-gcc -print-file-name=include)"
157155
158- # Fail early with a clear error if paths are missing .
159- test -f "${NEWLIB_STDLIB}"
160- test -d "${NEWLIB_INC} "
161- test -d "${GCC_INC} "
156+ # On Ubuntu runners the Newlib headers are installed by the gcc-arm-none-eabi package .
157+ # We locate the directory containing stdlib.h via dpkg to avoid hardcoded paths.
158+ NEWLIB_STDLIB="$(dpkg -L gcc-arm-none-eabi | grep -E '/include/stdlib\.h$' | head -n 1) "
159+ NEWLIB_INC="$(dirname "${NEWLIB_STDLIB}") "
162160
163- # Makefile will append this to clang flags (see clang0.mak change).
164- export CLANG_SYS_INCLUDES="-isystem ${NEWLIB_INC} -isystem ${GCC_INC}"
165- echo "NEWLIB_INC=${NEWLIB_INC}"
166- echo "GCC_INC=${GCC_INC}"
167- echo "CLANG_SYS_INCLUDES=${CLANG_SYS_INCLUDES}"
161+ # Fail early with a clear error if paths are missing.
162+ test -d "${GCC_INC}"
163+ test -n "${NEWLIB_STDLIB}"
164+ test -f "${NEWLIB_STDLIB}"
165+ test -d "${NEWLIB_INC}"
166+
167+ # Makefile will append this to clang flags (see clang0.mak change).
168+ export CLANG_SYS_INCLUDES="-isystem ${NEWLIB_INC} -isystem ${GCC_INC}"
169+ echo "NEWLIB_STDLIB=${NEWLIB_STDLIB}"
170+ echo "NEWLIB_INC=${NEWLIB_INC}"
171+ echo "GCC_INC=${GCC_INC}"
172+ echo "CLANG_SYS_INCLUDES=${CLANG_SYS_INCLUDES}"
168173
169- ./ci_build.sh \
170- --toolchain=clang \
171- --trice=on \
172- --configs=none
173174 fi
174175
175176 - name : Upload build artifacts
0 commit comments