Subject: Are compression requirements needed when building only libraries?

From: Uilian Ries <[email-masked]>
Date: Thu, 9 Oct 2025 13:10:05 +0200

Greetings!

I'm building PostgreSQL 17.5 locally, on Ubuntu 22.04, and using a CPU
architecture x86_64.

I noted the meson_options.txt file contains a few optional dependencies,
like zstd, zlib, lz4, libxml, and libxslt, which mostly seem to be related
to compression.

However, even when I build all libraries using those options enabled, I
can't see them listed as a dependency of the libraries:

conan@ae7c3785243c:~/project$ ldd
/home/conan/.conan2/p/b/libpqa632efa337a6e/p/lib/libpgtypes.so.3.17
linux-vdso.so.1 => (0x00007ffe83592000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x0000765dc9754000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x0000765dc938a000)
/lib64/ld-linux-x86-64.so.2 (0x0000765dc9971000)
conan@ae7c3785243c:~/project$ ldd
/home/conan/.conan2/p/b/libpqa632efa337a6e/p/lib/libecpg.so.6.17
linux-vdso.so.1 => (0x00007fff30dd9000)
libpgtypes.so.3 => not found
libpq.so.5 => not found
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007ad2a1096000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ad2a0ccc000)
/lib64/ld-linux-x86-64.so.2 (0x00007ad2a12b3000)
conan@ae7c3785243c:~/project$ ldd
/home/conan/.conan2/p/b/libpqa632efa337a6e/p/lib/libecpg.so.6.17
linux-vdso.so.1 => (0x00007ffe4e3b7000)
libpgtypes.so.3 => not found
libpq.so.5 => not found
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007035b616b000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007035b5da1000)
/lib64/ld-linux-x86-64.so.2 (0x00007035b6388000)
conan@ae7c3785243c:~/project$ ldd
/home/conan/.conan2/p/b/libpqa632efa337a6e/p/lib/libecpg_compat.so.3.17
linux-vdso.so.1 => (0x00007fffdd7b8000)
libecpg.so.6 => not found
libpgtypes.so.3 => not found
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x0000779677994000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007796775ca000)
/lib64/ld-linux-x86-64.so.2 (0x0000779677bb1000)
conan@ae7c3785243c:~/project$ ldd
/home/conan/.conan2/p/b/libpqa632efa337a6e/p/lib/libpq.so.5.17
linux-vdso.so.1 => (0x00007ffc1dba7000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x0000799a6e881000)
libssl.so.3 => not found
libcrypto.so.3 => not found
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x0000799a6e664000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x0000799a6e29a000)
/lib64/ld-linux-x86-64.so.2 (0x0000799a6eb8a000)

But can I find them listed as dependencies of the tools:

pg_dump:
linux-vdso.so.1 => (0x00007ffcab9d3000)
libpq.so.5 => not found
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007af540feb000)
liblz4.so.1 => /usr/lib/x86_64-linux-gnu/liblz4.so.1 (0x00007af540dd3000)
libzstd.so.1 => /usr/lib/x86_64-linux-gnu/libzstd.so.1 (0x00007af540b76000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007af540959000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007af54058f000)

So, my question is: *Is it correct to affirm I don't need those
dependencies when only interested in building and consuming the libraries? *

I'm asking because I don't see a specific option in the meson_option.txt to
disable/enable producing the executables, but only general options for
dependencies.

Regards!

---

From: Laurenz Albe <[email-masked]>
Date: Thu, 09 Oct 2025 16:49:03 +0200

On Thu, 2025-10-09 at 13:10 +0200, Uilian Ries wrote:
> Greetings!
> 
> I'm building PostgreSQL 17.5 locally, on Ubuntu 22.04, and using a CPU architecture x86_64.
> 
> I noted the meson_options.txt file contains a few optional dependencies, like
> zstd, zlib, lz4, libxml, and libxslt, which mostly seem to be related to compression.
> 
> However, even when I build all libraries using those options enabled, I can't see them
> listed as a dependency of the libraries:
> 
> [...]
>
> So, my question is: Is it correct to affirm I don't need those dependencies when only
> interested in building and consuming the libraries? 
> 
> I'm asking because I don't see a specific option in the meson_option.txt to disable/enable
> producing the executables, but only general options for dependencies.

My PostgreSQL is built with support for all these libraries, and I find that
my libraries are linked with "libz", but not with the other compression
libraries.

How did you configure and build PostgreSQL?

Yours,
Laurenz Albe

---

From: Uilian Ries <[email-masked]>
Date: Thu, 9 Oct 2025 16:58:49 +0200

Thank you for your answer!

My PostgreSQL is built with support for all these libraries, and I find
> that my libraries are linked with "libz"

Which libraries? libpgtypes, libpq, libecpg, libecpg_compat?

I'm using Meson through the Conan package manager.

You can find my full build log and ldd commands outputs attached.

Still, the meson setup command used is:

meson setup --native-file
> "/home/conan/.conan2/p/b/libpqa632efa337a6e/b/build-release/conan/conan_meson_native.ini"
> "/home/conan/.conan2/p/b/libpqa632efa337a6e/b/build-release"
> "/home/conan/.conan2/p/b/libpqa632efa337a6e/b/src" --prefix=/
> The Meson build system
> Version: 1.9.1
> Source dir: /home/conan/.conan2/p/b/libpqa632efa337a6e/b/src
> Build dir: /home/conan/.conan2/p/b/libpqa632efa337a6e/b/build-release
> Build type: native build
> Project name: postgresql
> Project version: 17.5
> C compiler for the host machine: gcc (gcc 11.4.0 "gcc (GCC) 11.4.0")
> C linker for the host machine: gcc ld.bfd 2.37
> Host machine cpu family: x86_64
> Host machine cpu: x86_64
> Run-time dependency threads found: YES
> Program perl found: YES (/usr/bin/perl)
> Program python3 found: YES (/opt/pyenv/versions/3.7.17/bin/python3)
> Program flex found: YES 2.6.4 2.6.4
> (/home/conan/.conan2/p/flex3e76cfacb0c1a/p/bin/flex)
> Program bison found: YES 3.8.2 3.8.2
> (/home/conan/.conan2/p/bison151b437a23e1e/p/bin/bison)
> Program sed found: YES (/bin/sed)
> Program prove found: YES (/usr/bin/prove)
> Program tar found: YES (/bin/tar)
> Program gzip found: YES (/bin/gzip)
> Program lz4 found: NO
> Program openssl found: YES (/usr/bin/openssl)
> Program zstd found: NO
> Program dtrace skipped: feature dtrace disabled
> Program config/missing found: YES
> (/home/conan/.conan2/p/b/libpqa632efa337a6e/b/src/config/missing)
> Program cp found: YES (/bin/cp)
> Program xmllint found: NO
> Program xsltproc found: NO
> Program wget found: YES (/usr/bin/wget)
> Program /opt/pyenv/versions/3.7.17/bin/python3 found: YES
> (/opt/pyenv/versions/3.7.17/bin/python3)
> Check usable header "bsd_auth.h" : NO
> Check usable header "dns_sd.h" : NO
> Program fop found: NO
> Found pkg-config: YES
> (/home/conan/.conan2/p/pkgco3885cd068f621/p/bin/pkgconf) 2.2.0
> Found CMake: /usr/bin/cmake (3.15.7)
> DEPRECATION: CMake support for versions <3.17 is deprecated since Meson
> 0.62.0.
> |
> | However, Meson was only able to find CMake 3.15.7.
> |
> | Support for all CMake versions below 3.17.0 will be removed once
> | newer CMake versions are more widely adopted. If you encounter
> | any errors please try upgrading CMake to a newer version first.
>
> Run-time dependency krb5-gssapi found: NO (tried pkgconfig and cmake)
> Library gssapi_krb5 found: NO
> Compiler for language cpp skipped: feature llvm disabled
> Run-time dependency libxml-2.0 found: YES 2.15.0
> Run-time dependency libxslt found: YES 1.1.43
> Run-time dependency liblz4 found: YES 1.9.4
> Run-time dependency tcl found: NO (tried pkgconfig)
> Library tcl found: NO
> Has header "tcl.h" with dependency -ltcl: NO
> Run-time dependency pam found: NO (tried pkgconfig and cmake)
> Library pam found: NO
> Has header "perl.h" : YES
> Message: CCFLAGS recommended by perl: -D_REENTRANT -D_GNU_SOURCE -DDEBIAN
> -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
> -D_FILE_OFFSET_BITS=64
> Message: CCFLAGS for embedding perl:
> -I/usr/lib/x86_64-linux-gnu/perl/5.22/CORE -DDEBIAN
> Message: LDFLAGS for embedding perl:
> "-L/usr/lib/x86_64-linux-gnu/perl/5.22/CORE -lperl -ldl -lm -lpthread -lc
> -lcrypt"
> Checking if "libperl" links: NO
> Message: disabling optional dependency plperl: missing libperl
> Run-time dependency readline found: YES 8.2
> Has header "readline/history.h" with dependency readline: YES
> Has header "readline/readline.h" with dependency readline: YES
> Checking for function "append_history" with dependency readline: YES
> Checking for function "history_truncate_file" with dependency readline: YES
> Checking for function "rl_completion_matches" with dependency readline: YES
> Checking for function "rl_filename_completion_function" with dependency
> readline: YES
> Checking for function "rl_reset_screen_size" with dependency readline: YES
> Checking for function "rl_variable_bind" with dependency readline: YES
> Header "readline/readline.h" has symbol "rl_completion_suppress_quote"
> with dependency readline: YES
> Header "readline/readline.h" has symbol "rl_filename_quote_characters"
> with dependency readline: YES
> Header "readline/readline.h" has symbol "rl_filename_quoting_function"
> with dependency readline: YES
> Run-time dependency libselinux found: NO (tried pkgconfig and cmake)
> Run-time dependency libsystemd found: NO (tried pkgconfig and cmake)
> Run-time dependency openssl found: YES 3.6.0
> Has header "openssl/ssl.h" with dependency openssl: YES
> Has header "openssl/err.h" with dependency openssl: YES
> Checking for function "CRYPTO_new_ex_data" with dependency openssl: YES
> Checking for function "SSL_new" with dependency openssl: YES
> Checking for function "SSL_CTX_set_cert_cb" with dependency openssl: YES
> Checking for function "OPENSSL_init_ssl" with dependency openssl: YES
> Checking for function "BIO_meth_new" with dependency openssl: YES
> Checking for function "ASN1_STRING_get0_data" with dependency openssl: YES
> Checking for function "HMAC_CTX_new" with dependency openssl: YES
> Checking for function "HMAC_CTX_free" with dependency openssl: YES
> Checking for function "CRYPTO_lock" with dependency openssl: NO
> Checking for function "X509_get_signature_info" with dependency openssl:
> YES
> Checking for function "SSL_CTX_set_num_tickets" with dependency openssl:
> YES
> Run-time dependency zlib found: YES 1.3.1
> Has header "zlib.h" with dependency zlib: YES
> Run-time dependency libzstd found: YES 1.5.7
> Checking if "c99" compiles: YES
> Checking for size of "long" : 8
> Checking for alignment of "short" : 2
> Checking for alignment of "int" : 4
> Checking for alignment of "long" : 8
> Checking for alignment of "double" : 8
> Checking for alignment of "long int" : 8
> Checking for size of "void *" : 8
> Checking for size of "size_t" : 8
> Checking if "__int128" links: YES
> Checking if "__int128 alignment bug" runs: YES
> Checking for alignment of "__int128" : 16
> Checking for size of "bool" : 1
> Compiler for C supports arguments -Werror=format: YES
> Compiler for C supports arguments -Werror=ignored-attributes: YES
> Checking if "format gnu_printf" compiles: YES
> Compiler for C supports function attribute visibility:default: YES
> Compiler for C supports function attribute visibility:hidden: YES
> Checking for function "__builtin_bswap16" : YES
> Checking for function "__builtin_bswap32" : YES
> Checking for function "__builtin_bswap64" : YES
> Checking for function "__builtin_clz" : YES
> Checking for function "__builtin_ctz" : YES
> Checking for function "__builtin_constant_p" : YES
> Checking for function "__builtin_frame_address" : YES
> Checking for function "__builtin_popcount" : YES
> Checking for function "__builtin_unreachable" : YES
> Checking if "__builtin_types_compatible_p" compiles: YES
> Checking if "__builtin_mul_overflow" links: YES
> Checking if "__get_cpuid" links: YES
> Checking if "__get_cpuid_count" links: YES
> Compiler for C supports arguments -fno-strict-aliasing: YES
> Compiler for C supports arguments -fwrapv: YES
> Compiler for C supports arguments -fexcess-precision=standard: YES
> Compiler for C supports arguments -ftree-vectorize: YES
> Compiler for C supports arguments -funroll-loops: YES
> Compiler for C supports arguments -Wmissing-prototypes: YES
> Compiler for C supports arguments -Wpointer-arith: YES
> Compiler for C supports arguments -Werror=vla: YES
> Compiler for C supports arguments -Werror=unguarded-availability-new: NO
> Compiler for C supports arguments -Wendif-labels: YES
> Compiler for C supports arguments -Wmissing-format-attribute: YES
> Compiler for C supports arguments -Wimplicit-fallthrough=3: YES
> Compiler for C supports arguments -Wcast-function-type: YES
> Compiler for C supports arguments -Wshadow=compatible-local: YES
> Compiler for C supports arguments -Wformat-security: YES
> Compiler for C supports arguments -Wdeclaration-after-statement: YES
> Compiler for C supports arguments -Wunused-command-line-argument: NO
> Compiler for C supports arguments -Wcompound-token-split-by-macro: NO
> Compiler for C supports arguments -Wformat-truncation: YES
> Compiler for C supports arguments -Wstringop-truncation: YES
> Compiler for C supports arguments -Wcast-function-type-strict: NO
> Compiler for C supports arguments -Wall: YES
> Compiler for C supports arguments -O3: YES
> Checking if "__sync_lock_test_and_set(char)" links: YES
> Checking if "__sync_lock_test_and_set(int32)" links: YES
> Checking if "__sync_val_compare_and_swap(int32)" links: YES
> Checking if "__sync_val_compare_and_swap(int64)" links: YES
> Checking if " __atomic_compare_exchange_n(int32)" links: YES
> Checking if " __atomic_compare_exchange_n(int64)" links: YES
> Checking if "XSAVE intrinsics without -mxsave" links: NO
> Checking if "XSAVE intrinsics with -mxsave" links: YES
> Checking if "AVX-512 popcount without -mavx512vpopcntdq -mavx512bw" links:
> NO
> Checking if "AVX-512 popcount with -mavx512vpopcntdq -mavx512bw" links: YES
> Checking if "_mm_crc32_u8 and _mm_crc32_u32 without -msse4.2" links: NO
> Checking if "_mm_crc32_u8 and _mm_crc32_u32 with -msse4.2" links: YES
> Checking if "x86_64: popcntq instruction" compiles: YES
> Has header "atomic.h" : NO
> Has header "copyfile.h" : NO
> Has header "crtdefs.h" : NO
> Has header "execinfo.h" : YES
> Has header "getopt.h" : YES
> Has header "ifaddrs.h" : YES
> Has header "langinfo.h" : YES
> Has header "mbarrier.h" : NO
> Has header "strings.h" : YES
> Has header "sys/epoll.h" : YES
> Has header "sys/event.h" : NO
> Has header "sys/personality.h" : YES
> Has header "sys/prctl.h" : YES
> Has header "sys/procctl.h" : NO
> Has header "sys/signalfd.h" : YES
> Has header "sys/ucred.h" : NO
> Has header "termios.h" : YES
> Has header "ucred.h" : NO
> Checking if "test whether F_FULLFSYNC is declared" compiles: NO
> Checking if "test whether fdatasync is declared" compiles: YES
> Checking if "test whether posix_fadvise is declared" compiles: YES
> Checking if "test whether strlcat is declared" compiles: NO
> Checking if "test whether strlcpy is declared" compiles: NO
> Checking if "test whether strnlen is declared" compiles: YES
> Checking if "test whether preadv is declared" compiles: YES
> Checking if "test whether pwritev is declared" compiles: YES
> Checking if "test whether strchrnul is declared" compiles: YES
> Checking for type "struct option" : YES
> Checking if "opterr" links: YES
> Checking if "optreset" links: NO
> Checking for type "socklen_t" : YES
> Checking whether type "struct sockaddr" has member "sa_len" : NO
> Checking whether type "struct tm" has member "tm_zone" : YES
> Checking if "global variable `timezone' exists" compiles: YES
> Checking for type "union semun" : NO
> Checking if "strerror_r" compiles: NO
> Checking for type "locale_t" : YES
> Checking if "typeof()" compiles: YES
> Checking if "wcstombs_l" compiles: NO
> Checking if "wcstombs_l in xlocale.h" compiles: NO
> Library m found: YES
> Library rt found: YES
> Library dl found: YES
> Library util found: YES
> Library getopt found: NO
> Library gnugetopt found: NO
> Library execinfo found: NO
> Checking for function "backtrace_symbols" : YES
> Checking for function "clock_gettime" : YES
> Checking for function "copyfile" : NO
> Checking for function "copy_file_range" : NO
> Checking for function "dlsym" : NO
> Checking for function "dlsym" with dependency -ldl: YES
> Checking for function "explicit_bzero" : NO
> Checking for function "getifaddrs" : YES
> Checking for function "getopt" : YES
> Checking for function "getopt_long" : YES
> Checking for function "getpeereid" : NO
> Checking for function "getpeerucred" : NO
> Checking for function "inet_aton" : YES
> Checking for function "inet_pton" : YES
> Checking for function "kqueue" : NO
> Checking for function "mbstowcs_l" : NO
> Checking for function "memset_s" : NO
> Checking for function "mkdtemp" : YES
> Checking for function "posix_fadvise" : YES
> Checking for function "posix_fallocate" : YES
> Checking for function "ppoll" : YES
> Checking for function "pthread_barrier_wait" : NO
> Checking for function "pthread_barrier_wait" with dependency threads: YES
> Checking for function "pthread_is_threaded_np" : NO
> Checking for function "pthread_is_threaded_np" with dependency threads: NO
> Checking for function "sem_init" : NO
> Checking for function "sem_init" with dependency -lrt: NO
> Checking for function "sem_init" with dependency threads: YES
> Checking for function "setproctitle" : NO
> Checking for function "setproctitle" with dependency -lutil: NO
> Checking for function "setproctitle_fast" : NO
> Checking for function "shm_open" : NO
> Checking for function "shm_open" with dependency -lrt: YES
> Checking for function "shm_unlink" : NO
> Checking for function "shm_unlink" with dependency -lrt: YES
> Checking for function "shmget" : YES
> Checking for function "socket" : YES
> Checking for function "strerror_r" : YES
> Checking for function "strlcat" : NO
> Checking for function "strlcpy" : NO
> Checking for function "strnlen" : YES
> Checking for function "strsignal" : YES
> Checking for function "sync_file_range" : YES
> Checking for function "syncfs" : YES
> Checking for function "uselocale" : YES
> Checking for function "wcstombs_l" : NO
> Checking for function "syslog" : YES
> Check usable header "syslog.h" : YES
> Program msgfmt found: YES (/usr/bin/msgfmt)
> Check usable header "libintl.h" : YES
> Checking for function "ngettext" : YES
> Configuring pg_config_ext.h using configuration
> Configuring pg_config.h using configuration
> Compiler for C supports arguments -fPIC: YES
> Compiler for C supports link arguments -Wl,--as-needed: YES
> Configuring pg_config_paths.h using configuration
> Program msgfmt found: YES (/usr/bin/msgfmt)
> Program msginit found: YES (/usr/bin/msginit)
> Program msgmerge found: YES (/usr/bin/msgmerge)
> Program xgettext found: YES (/usr/bin/xgettext)
> Configuring ecpg_config.h using configuration
> Program strip found: YES (/opt/conan/binutils/bin/strip)
> Compiler for C supports link arguments -Wl,--export-dynamic: YES
> Program ar found: YES (/opt/conan/binutils/bin/ar)
> Program mawk found: YES (/usr/bin/mawk)
> Configuring Makefile.global using configuration
> Configuring version.sgml using configuration
> Message: checking for file conflicts between source and build directory
> Program git found: YES (/usr/bin/git)
> Program bzip2 found: YES (/bin/bzip2)
> Build targets in project: 909
> NOTICE: Future-deprecated features used:
> * 0.55.0: {'ExternalProgram.path'}
> * 0.56.0: {'meson.build_root', 'meson.source_root'}
>
> postgresql 17.5
>
> Data layout
> data block size : 8 kB
> WAL block size : 8 kB
> segment size : 1 GB
>
> System
> host system : linux x86_64
> build system : linux x86_64
>
> Compiler
> linker : ld.bfd
> C compiler : gcc 11.4.0
>
> Compiler Flags
> CPP FLAGS : -D_GNU_SOURCE
> C FLAGS, functional : -fno-strict-aliasing -fwrapv
> -fexcess-precision=standard
> C FLAGS, warnings : -Wmissing-prototypes -Wpointer-arith -Werror=vla
> -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3
> -Wcast-function-type -Wshadow=compatible-local -Wformat-security
> -Wdeclaration-after-statement -Wno-format-truncation
> -Wno-stringop-truncation
> C FLAGS, modules : -fvisibility=hidden
> C FLAGS, user specified: -m64
> LD FLAGS : -m64
>
> Programs
> bison : /home/conan/.conan2/p/bison151b437a23e1e/p/bin/bison 3.8.2
> dtrace : NO
> flex : /home/conan/.conan2/p/flex3e76cfacb0c1a/p/bin/flex 2.6.4
>
> External libraries
> bonjour : NO
> bsd_auth : NO
> docs : NO
> docs_pdf : NO
> gss : NO
> icu : NO
> ldap : NO
> libxml : YES 2.15.0
> libxslt : YES 1.1.43
> llvm : NO
> lz4 : YES 1.9.4
> nls : YES
> openssl : YES 3.6.0
> pam : NO
> plperl : NO
> plpython : NO
> pltcl : NO
> readline : YES 8.2
> selinux : NO
> systemd : NO
> uuid : NO
> zlib : YES 1.3.1
> zstd : YES 1.5.7

On Thu, Oct 9, 2025 at 4:49 PM Laurenz Albe <[email-masked]>
wrote:

> like

-- 
Cordialmente,

Uilian Ries
<[email-masked]>

---

From: Laurenz Albe <[email-masked]>
Date: Thu, 09 Oct 2025 21:12:07 +0200

On Thu, 2025-10-09 at 16:58 +0200, Uilian Ries wrote:
> > My PostgreSQL is built with support for all these libraries, and I find that my libraries are linked with "libz"
> 

libpq, libecpg and libecpg_compat are linked with libz.so.1, libpgtypes isn't.

> You can find my full build log and ldd commands outputs attached.

That shows that you have configured PostgreSQL with support for zlib,
lz4 and zstd.  No idea why the libraries are not linked with libz.so.

Yours,
Laurenz Albe