pg.ddx.io pgvector/pgvector GitHub issues and pull requestshelp / color / mirror / Atom feed
[pgvector/pgvector] issue #932: doc: How to build with relocatable postgres 3+ messages / 2 participants [nested] [flat]
* [pgvector/pgvector] issue #932: doc: How to build with relocatable postgres @ 2025-12-02 22:14 "coolaj86 (@coolaj86)" <noreply+coolaj86@github.com> 0 siblings, 0 replies; 3+ messages in thread From: coolaj86 (@coolaj86) @ 2025-12-02 22:14 UTC (permalink / raw) To: pgvector/pgvector <noreply+pgvector-pgvector@github.com> I'm not a C/C++ developer, so although this is probably obvious to many who build postgres extensions regularly, figuring out these few steps took an embarrassing amount of time, so I'm documenting this here for my future self and others equally ignorant to myself. If any of the maintainers care to drop in their knowledge about how to do this in a simpler way (i.e. getting a relocatable distributable using the postgres source without fully compiling it first), that would be great. # 1. Building postgres I won't go through all of the steps here, but suffice it to say that: - this is the official tarball: https://ftp.postgresql.org/pub/source/v18.1/postgresql-18.1.tar.gz - and the official build docs: https://www.postgresql.org/docs/current/install-make.html ```sh wget -c https://ftp.postgresql.org/pub/source/v18.1/postgresql-18.1.tar.gz tar -xvf postgresql-18.1.tar.gz # ... a bunch of stuff to compile and build in relocatable fashion ... ``` - but I'm using [pg-build-linux](https://github.com/bnnanet/pg-essentials/blob/main/pg-build-linux) and [pg-build-macos](https://github.com/bnnanet/pg-essentials/blob/main/pg-build-macos) from [pg-essentials](https://webinstall.dev/pg-essentials) which builds a relocatable postgres, which is not officially supported and took me _days_ to figure out a year or so ago ```sh curl https://webi.sh/pg-essentials | sh . ~/.config/envman/PATH.env # this will install all necessary build tooling (make, llvm, etc) on Debian and alpine (musl) systems pg-build 'custom+pgvector' 18.1 ``` ``` tar xvf ./postgres-18.1.0-x86_64-linux-gnu.tar.gz ``` It's important that the `include` folder isn't trimmed because the source generated for this through the build process is _NOT_ the same as what's in the original source. One mistake that I made was trying to use the source's `include`. # 2. Set `PG_CONFIG` and build To get `$HOME/postgres-18.1.0-x86_64-linux-gnu/src/include/server` instead of failing to find the one that doesn't exist in `/usr/include`, `PG_CONFIG` must be set: ```sh export PG_CONFIG="$HOME/postgres-18.1.0-x86_64-linux-gnu/bin/pg_config" ``` ```sh git clone https://github.com/pgvector/pgvector.git pushd ./pgvector/ make make install ``` `pgvector` will be installed to: ```sh $HOME/postgres-18.1.0-x86_64-linux-gnu/include/server/extension/vector $HOME/postgres-18.1.0-x86_64-linux-gnu/lib/bitcode/vector $HOME/postgres-18.1.0-x86_64-linux-gnu/lib/bitcode/vector.index.bc $HOME/postgres-18.1.0-x86_64-linux-gnu/lib/vector.so $HOME/postgres-18.1.0-x86_64-linux-gnu/share/extension/vector--0.1.0--0.1.1.sql $HOME/postgres-18.1.0-x86_64-linux-gnu/share/extension/vector--[...].sql $HOME/postgres-18.1.0-x86_64-linux-gnu/share/extension/vector--0.8.1.sql $HOME/postgres-18.1.0-x86_64-linux-gnu/share/extension/vector.control ``` # 3. Relocate The resulting folder can be relocated anywhere (e.g. `/home/user1/.local/opt/postgres`) and will function correctly and `CREATE EXTENSION vector;` will work. My guess is that the bitcode is tied to the version of llvm used (`llvm-19` is stable for Debian Trixie and Ubuntu 24.04). I imagine those individual files could be put into a tarball and extracted into any postgres folder that matches the installed versions of `glibc`, `llvm`, and `postgres`. ^ permalink raw [nested|flat] 3+ messages in thread
* Re: [pgvector/pgvector] issue #932: doc: How to build with relocatable postgres @ 2025-12-02 22:52 "ankane (@ankane)" <noreply+ankane@github.com> 1 sibling, 0 replies; 3+ messages in thread From: ankane (@ankane) @ 2025-12-02 22:52 UTC (permalink / raw) To: pgvector/pgvector <noreply+pgvector-pgvector@github.com> Hi @coolaj86, thanks for sharing. ^ permalink raw [nested|flat] 3+ messages in thread
* Re: [pgvector/pgvector] issue #932: doc: How to build with relocatable postgres @ 2025-12-02 22:52 "ankane (@ankane)" <noreply+ankane@github.com> 1 sibling, 0 replies; 3+ messages in thread From: ankane (@ankane) @ 2025-12-02 22:52 UTC (permalink / raw) To: pgvector/pgvector <noreply+pgvector-pgvector@github.com> @ankane closed this. ^ permalink raw [nested|flat] 3+ messages in thread
end of thread, other threads:[~2025-12-02 22:52 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2025-12-02 22:14 [pgvector/pgvector] issue #932: doc: How to build with relocatable postgres "coolaj86 (@coolaj86)" <noreply+coolaj86@github.com> 2025-12-02 22:52 ` "ankane (@ankane)" <noreply+ankane@github.com> 2025-12-02 22:52 ` "ankane (@ankane)" <noreply+ankane@github.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox