PostgreSQL Static Libraries
This extension bundles PostgreSQL 18.4 static libraries built by:
https://github.com/ProjectSky/build-postgresql-library
Use that project to rebuild or update the bundled libraries. It contains the current PostgreSQL version, Linux configure flags, Windows Meson flags, and release packaging details.
Manual Build
The current build uses PostgreSQL 18.4.
-
Install the build dependencies.
Linux requires
build-essential gcc-multilib g++-multilib.Windows requires an MSVC developer shell,
winflexbison3,meson, andninja. -
Download and unpack postgresql-18.4.tar.gz
-
For Linux, create a separate build directory for each architecture and configure with
--without-readline --without-icu --without-zlib.Use
CFLAGS="-fPIC -m32" LDFLAGS="-m32"forlib_linux, orCFLAGS="-fPIC -m64" LDFLAGS="-m64"forlib_linux64. -
Build the Linux static libraries:
make -C src/backend generated-headers
make -C src/port libpgport_shlib.a
make -C src/common libpgcommon_shlib.a
make -C src/interfaces/libpq libpq.a SHLIB_PREREQS=
- For Windows, configure from an MSVC developer shell:
python -m mesonbuild.mesonmain setup build-win64 . --backend=ninja -Dreadline=disabled -Dicu=disabled -Dlibcurl=disabled -Dzlib=disabled -Dssl=none -Db_vscrt=mt
- Build the Windows static libraries:
python -m ninja -C build-win64 src/interfaces/libpq/libpq.a src/common/libpgcommon_shlib.a src/port/libpgport_shlib.a
Use build-win32 from an x86 MSVC shell for lib_win.
- Copy the three static libraries plus
libpq-fe.handpostgres_ext.hinto the matchinglib_*directory. Windows packages rename the.aoutputs to.lib.
Bundled Files
Linux:
lib_linux/libpq.alib_linux/libpgcommon_shlib.alib_linux/libpgport_shlib.alib_linux64/libpq.alib_linux64/libpgcommon_shlib.alib_linux64/libpgport_shlib.a
Windows:
lib_win/libpq.liblib_win/libpgcommon_shlib.liblib_win/libpgport_shlib.liblib_win64/libpq.liblib_win64/libpgcommon_shlib.liblib_win64/libpgport_shlib.lib
Headers:
libpq-fe.hpostgres_ext.h
macOS pgsql builds are not currently supported.