build(deps): always build sqlite-vec, not gated on PROXYSQLGENAI

Step 7 of the GenAI plugin carve-out made the sqlite-vec call site
in core unconditional (lib/proxy_sqlite3_symbols.cpp:58 includes
"sqlite-vec.h"; src/Makefile linkages $(SQLITE_VEC_OBJ) into
libproxysql.a unconditionally).  But deps/Makefile still gated the
ACTUAL build of vec.o + sqlite-vec.h on PROXYSQLGENAI=1, so
non-genai builds (debian12-dbg, ubuntu22-tap on the CI matrix)
failed at the lib step:

    proxy_sqlite3_symbols.cpp:58:10: fatal error: sqlite-vec.h:
        No such file or directory

Always pull sqlite-vec into the deps build (the existing
`sqlite-vec: sqlite3/sqlite3/vec.o` target stays for callers that
explicitly request it).  Per the design intent documented next to
$(SQLITE_VEC_OBJ) in src/Makefile: vec.o is always linked into
proxysql so the genai plugin (when dlopen'd) can call
sqlite3_vec_init on the same SQLite that core links against;
without the plugin loaded, the extension is dead code that doesn't
hurt non-genai installs.
Rene Cannao 2 months ago
parent ff3bcec5fa
commit d7a5eb463d

25
deps/Makefile vendored

@ -49,9 +49,15 @@ ifeq ($(PROXYSQLCLICKHOUSE),1)
targets += clickhouse-cpp
endif
ifeq ($(PROXYSQLGENAI),1)
targets += sqlite-vec
endif
# sqlite-vec: vector similarity search extension. Originally gated
# behind PROXYSQLGENAI; Step 7 of the carve-out made the call site in
# core (lib/proxy_sqlite3_symbols.cpp + lib/Admin_Bootstrap.cpp)
# unconditional so the genai plugin (when dlopen'd) can call
# sqlite3_vec_init on the same SQLite that proxysql linked against.
# That requires vec.o + sqlite-vec.h to exist regardless of
# PROXYSQLGENAI; otherwise non-genai dbg/release builds fail at
# `#include "sqlite-vec.h"`. Always build it.
targets += sqlite-vec
default: $(targets)
.PHONY: default
@ -281,13 +287,16 @@ sqlite3/sqlite3/vec.o: sqlite3/sqlite3/sqlite3.o
cd sqlite3/sqlite3 && cp ../sqlite-vec-source/sqlite-vec.c . && cp ../sqlite-vec-source/sqlite-vec.h .
cd sqlite3/sqlite3 && ${CC} ${MYCFLAGS} -fPIC -c -o vec.o sqlite-vec.c -DSQLITE_CORE -DSQLITE_VEC_STATIC -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_DLL=1
ifeq ($(PROXYSQLGENAI),1)
# Step 7: vec.o is unconditionally linked into proxysql (see
# src/Makefile $(SQLITE_VEC_OBJ)), so we always build it as part of
# the sqlite3 target — no longer gated on PROXYSQLGENAI. Without
# this, non-genai dbg builds find sqlite-vec.h missing when
# lib/proxy_sqlite3_symbols.cpp tries to `#include "sqlite-vec.h"`.
sqlite3: sqlite3/sqlite3/sqlite3.o sqlite3/sqlite3/vec.o
else
sqlite3: sqlite3/sqlite3/sqlite3.o
endif
# sqlite-vec: Vector similarity search extension (for GenAI)
# sqlite-vec: Vector similarity search extension. Kept as a separate
# target name so existing callers (top-level Makefile, packaging
# entrypoints) keep working; sqlite3 above already pulls in vec.o.
sqlite-vec: sqlite3/sqlite3/vec.o

Loading…
Cancel
Save