Skip to content

Commit b38428b

Browse files
committed
Include stdatomic.h from clang
1 parent 17d66e1 commit b38428b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

cpython-unix/build-cpython.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,22 @@ if [ "${CC}" = "musl-clang" ]; then
401401
done
402402
fi
403403

404+
# To enable mimalloc (which is hard requirement for free-threaded versions, but preferred in
405+
# general), we need `stdatomic.h` which is not provided by musl. It's are part of the include files
406+
# that are part of clang. But musl-clang eliminates them from the default include path. So copy it
407+
# into place.
408+
if [[ "${CC}" = "musl-clang" && -n "${PYTHON_MEETS_MINIMUM_VERSION_3_13}" ]]; then
409+
for h in /tools/${TOOLCHAIN}/lib/clang/*/include/stdatomic.h; do
410+
filename=$(basename "$h")
411+
if [ -e "/tools/host/include/${filename}" ]; then
412+
echo "${filename} already exists; don't need to copy!"
413+
exit 1
414+
fi
415+
cp "$h" /tools/host/include/
416+
done
417+
fi
418+
419+
404420
if [ -n "${CPYTHON_STATIC}" ]; then
405421
CFLAGS="${CFLAGS} -static"
406422
CPPFLAGS="${CPPFLAGS} -static"

0 commit comments

Comments
 (0)