From 299e27b95b1baf557353207eb700e73bad025889 Mon Sep 17 00:00:00 2001 From: SilvioC2C Date: Wed, 14 Oct 2026 11:33:28 +0200 Subject: [PATCH] Build pgvector without -march=native pgvector's Makefile defaults to OPTFLAGS = -march=native. The builder stage compiles vector.so on whatever machine builds the image, so the binary may use instructions (e.g. AVX-512) that the CPU running the image does not have. In that case the backend is killed with SIGILL as soon as the extension is created: server process (PID n) was terminated by signal 4: Illegal instruction Failed process was running: CREATE EXTENSION IF NOT EXISTS vector ... Pass OPTFLAGS="" to make and make install so vector.so is built for generic x86-64 and runs on any host CPU, as documented in the pgvector README. --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 159ff59..b4b3832 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,7 +41,9 @@ RUN wget https://github.com/pgvector/pgvector/archive/refs/tags/v${PGVECTOR_VERS mv pgvector-${PGVECTOR_VERSION} pgvector WORKDIR /tmp/pgvector -RUN make && make DESTDIR=/pgvector_install install +# Build w/ OPTFLAGS="" for generic x86-64: the default -march=native would tie +# the binary to the CPU of the machine building the image. +RUN make OPTFLAGS="" && make OPTFLAGS="" DESTDIR=/pgvector_install install ARG BASE_TAG FROM postgres:${BASE_TAG}-trixie