Skip to content

Commit e7e8b56

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.
1 parent fbffb62 commit e7e8b56

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
@@ -24,7 +24,7 @@ RUN apk add --no-cache python3 py3-netifaces \
2424
wget -qO- "https://github.com/pgvector/pgvector/archive/refs/tags/v${PGVECTOR_VERSION}.tar.gz" \
2525
| tar -xz -C /tmp; \
2626
cd "/tmp/pgvector-${PGVECTOR_VERSION}" \
27-
&& make PG_CONFIG=/usr/local/bin/pg_config \
27+
&& make CFLAGS="-march=x86-64-v2" PG_CONFIG=/usr/local/bin/pg_config \
2828
&& make install PG_CONFIG=/usr/local/bin/pg_config; \
2929
cd / && rm -rf "/tmp/pgvector-${PGVECTOR_VERSION}"; \
3030
apk del .pgvector-build; \

0 commit comments

Comments
 (0)