From: bmwiedemann (@bmwiedemann) <noreply+bmwiedemann@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: [pgvector/pgvector] PR #764: Avoid -march=native when reproducible build is wanted
Date: Fri, 24 Jan 2025 03:13:21 +0000
Message-ID: <gh-pgvector-pgvector-764@github.com> (raw)
With this patch, compilation will avoid `-march=native` when a reproducible build is wanted.
See https://reproducible-builds.org/ for why this is good.
Without this patch, compiling on different machines produced different binaries, which made verification of results difficult.
This patch was done while working on reproducible builds for openSUSE.
inline patch 1: Makefile (+5/-1 lines) download inline-1.patchdiff --git a/Makefile b/Makefileindex 7a4b88caf..4681d0f7e 100644--- a/Makefile+++ b/Makefile@@ -12,7 +12,11 @@ REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS))
REGRESS_OPTS = --inputdir=test --load-extension=$(EXTENSION)
# To compile for portability, run: make OPTFLAGS=""
-OPTFLAGS = -march=native+ifdef SOURCE_DATE_EPOCH+ OPTFLAGS =+else+ OPTFLAGS = -march=native+endif
# Mac ARM doesn't always support -march=native
ifeq ($(shell uname -s), Darwin)