Skip to content

Commit eb93f2e

Browse files
committed
Patch FLINT to not include immintrin.h
1 parent acdc74b commit eb93f2e

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

bin/build_dependencies_unix.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ SKIP_GMP=no
2020
SKIP_MPFR=no
2121
PATCH_GMP_C23=no
2222
PATCH_LDD=no
23+
PATCH_IMMINTRIN=no
2324
GMP_FAT_ARG="--enable-fat"
2425
HOST_ARG=
2526

@@ -44,6 +45,7 @@ do
4445
echo " --skip-mpfr - skip building MPFR"
4546
echo " --disable-fat - disable building fat binaries"
4647
echo " --patch-ldd - patch flint shared linking for mingw on arm64"
48+
echo " --patch-immintrin - patch flint arm64 msvc header to avoid immintrin.h"
4749
echo
4850
echo "Legacy options:"
4951
echo " --gmp gmp - build based on GMP (default)"
@@ -111,6 +113,11 @@ do
111113
PATCH_LDD=yes
112114
shift
113115
;;
116+
--patch-immintrin)
117+
# Needed only for the FLINT headers consumed by MSVC on Windows arm64.
118+
PATCH_IMMINTRIN=yes
119+
shift
120+
;;
114121
--use-gmp-github-mirror)
115122
USE_GMP_GITHUB_MIRROR=yes
116123
shift
@@ -333,6 +340,13 @@ cd flint-$FLINTVER
333340
echo --------------------------------------------
334341
patch -N -Z -p1 < ../../../bin/patch-flint-windows-arm64-link.diff
335342
fi
343+
if [ "$PATCH_IMMINTRIN" = "yes" ]; then
344+
echo
345+
echo --------------------------------------------
346+
echo " patching FLINT"
347+
echo --------------------------------------------
348+
patch -N -Z -p1 < ../../../bin/patch-flint-windows-arm64-immintrin.diff
349+
fi
336350
./bootstrap.sh
337351
./configure --prefix=$PREFIX\
338352
--host=$HOST_ARG\

bin/cibw_before_all_windows_arm64.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ bin/build_dependencies_unix.sh \
2121
--host aarch64-w64-mingw32\
2222
--patch-C23\
2323
--patch-ldd\
24+
--patch-immintrin\
2425
#
2526

2627
mkdir -p .local/lib
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/src/longlong_msc_arm64.h b/src/longlong_msc_arm64.h
2+
index 44d96f03f..6ade48289 100644
3+
--- a/src/longlong_msc_arm64.h
4+
+++ b/src/longlong_msc_arm64.h
5+
@@ -14,7 +14,6 @@
6+
7+
#include <stdlib.h>
8+
#include <intrin.h>
9+
-#include <immintrin.h>
10+
11+
/* Trailing and leading zeros */
12+
# define flint_clz _CountLeadingZeros64

0 commit comments

Comments
 (0)