Skip to content

Commit e91027a

Browse files
committed
fix: don't pass -march=native into the vendored pgvector build (riscv64)
All four riscv64 build legs failed identically after 30+ minutes, partway through compiling pgvector (fetched and built by pgserver's own pgbuild/Makefile): GCC on manylinux_2_39_riscv64 rejects `-march=native` outright ("ISA string must begin with rv32 or rv64"), which pgvector's Makefile passes unconditionally except for Mac ARM and ppc64. Add patches/pgserver/0.1.4/0002-*.patch, overriding OPTFLAGS to empty on the pgbuild/Makefile invocations that build pgvector, the same way pgvector's own Makefile already blanks it for architectures that reject -march=native. Verified the patch applies cleanly (alone and together with the existing 0001 licensing patch) against a fresh v0.1.4 checkout. check_commit_messages was failing on an older run (35966092162) but passes on the current HEAD's latest run; no commit-message change needed.
1 parent a1c86b5 commit e91027a

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
From 728980fe6d03379af74d1bb4f04fab977d5039d9 Mon Sep 17 00:00:00 2001
2+
From: Ludovic Henry <git@ludovic.dev>
3+
Date: Thu, 24 Sep 2026 11:26:36 +0000
4+
Subject: [PATCH] Do not pass -march=native to the pgvector build
5+
6+
pgvector's Makefile sets `OPTFLAGS = -march=native` unconditionally,
7+
with hand-written exceptions only for Mac ARM and ppc64 (neither of
8+
which supports -march=native either). On the manylinux_riscv64
9+
(quay.io/pypa/manylinux_2_39_riscv64) image, GCC's -march=native
10+
self-detection produces an empty/invalid ISA string on riscv64 and
11+
the build fails outright:
12+
13+
gcc: error: '-march=native': ISA string must begin with rv32 or rv64
14+
15+
pgvector is fetched and built by pgserver's own pgbuild/Makefile at
16+
build time (not vendored in this checkout), so the fix lives here
17+
rather than as a patch to a downloaded tarball: override OPTFLAGS to
18+
empty on the two `make -C $(PGVECTOR_DIR)` invocations, the same way
19+
pgvector's own Makefile already blanks OPTFLAGS for architectures
20+
that reject -march=native. pgvector still gets the auto-vectorization
21+
flags (-ftree-vectorize etc.) at the baseline rv64gc ISA; only the
22+
native/RVV-specific tuning is dropped.
23+
24+
Upstream-Status: Inappropriate [riscv64/CI-infra-specific override of
25+
a downstream build script; pgvector's own -march=native default is
26+
correct for every architecture it targets]
27+
---
28+
pgbuild/Makefile | 4 ++--
29+
1 file changed, 2 insertions(+), 2 deletions(-)
30+
31+
diff --git a/pgbuild/Makefile b/pgbuild/Makefile
32+
index d6f8b13..f9ecbb4 100644
33+
--- a/pgbuild/Makefile
34+
+++ b/pgbuild/Makefile
35+
@@ -55,8 +55,8 @@ $(PGVECTOR_DIR)/Makefile: $(PGVECTOR_DIR).tar.gz
36+
$(INSTALL_PREFIX)/lib/vector.so: $(PGVECTOR_DIR)/Makefile $(INSTALL_PREFIX)/bin/postgres
37+
unset MAKELEVEL && unset MAKEFLAGS && unset MFLAGS \
38+
&& export PG_CONFIG=$(INSTALL_PREFIX)/bin/pg_config \
39+
- && $(MAKE) -C $(PGVECTOR_DIR) -j \
40+
- && $(MAKE) -C $(PGVECTOR_DIR) install
41+
+ && $(MAKE) -C $(PGVECTOR_DIR) -j OPTFLAGS= \
42+
+ && $(MAKE) -C $(PGVECTOR_DIR) install OPTFLAGS=
43+
44+
.PHONY: pgvector
45+
pgvector: postgres $(INSTALL_PREFIX)/lib/vector.so
46+
--
47+
2.43.0
48+

0 commit comments

Comments
 (0)