Skip to content

Commit d335fbf

Browse files
committed
Include stdatomic.h from clang
1 parent 5020456 commit d335fbf

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
@@ -407,6 +407,22 @@ if [ "${CC}" = "musl-clang" ]; then
407407
done
408408
fi
409409

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

0 commit comments

Comments
 (0)