Skip to content

Commit 89cd20c

Browse files
committed
fix(pgvector): target x86-64-v2 for CPU portability
Without explicit CFLAGS, make detects the host CPU features (e.g. AVX-512) and generates a .so that crashes with "signal 4: Illegal instruction" on older x86-64 CPUs. Pinning -march=x86-64-v2 ensures compatibility with any x86-64 processor from the last ~15 years. Without this patch, for example you cannot install PGVector if your server runs an Intel® i9-13900 processor. ARM64 builds are not affected. @moduon MT-14612
1 parent e79329a commit 89cd20c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ RUN apk add --no-cache python3 py3-netifaces \
2727
wget -qO- "https://github.com/pgvector/pgvector/archive/refs/tags/v${PGVECTOR_VERSION}.tar.gz" \
2828
| tar -xz -C /tmp; \
2929
cd "/tmp/pgvector-${PGVECTOR_VERSION}" \
30-
&& make PG_CONFIG=/usr/local/bin/pg_config \
30+
&& make $(if [ "$(uname -m)" = "x86_64" ]; then echo 'CFLAGS=-march=x86-64-v2'; fi) PG_CONFIG=/usr/local/bin/pg_config \
3131
&& make install PG_CONFIG=/usr/local/bin/pg_config; \
3232
cd / && rm -rf "/tmp/pgvector-${PGVECTOR_VERSION}"; \
3333
apk del .pgvector-build; \

0 commit comments

Comments
 (0)