Fix Android cross-compilation failing with unsupported '-mavx' flag

The Linux AVX auto-detection checked the host's /proc/cpuinfo, which
passes on x86 CI runners even when cross-compiling for Android ARM
targets. Skip AVX detection when CC contains 'android'.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Alex Garcia 2026-03-31 01:06:38 -07:00
parent 0de765f457
commit 69ccb2405a

View file

@ -43,11 +43,13 @@ ifndef OMIT_SIMD
CFLAGS += -mcpu=apple-m1 -DSQLITE_VEC_ENABLE_NEON
endif
ifeq ($(shell uname -s),Linux)
ifeq ($(findstring android,$(CC)),)
ifneq ($(filter avx,$(shell grep -o 'avx[^ ]*' /proc/cpuinfo 2>/dev/null | head -1)),)
CFLAGS += -mavx -DSQLITE_VEC_ENABLE_AVX
endif
endif
endif
endif
ifdef USE_BREW_SQLITE
SQLITE_INCLUDE_PATH=-I/opt/homebrew/opt/sqlite/include