Skip to content

static build of postgresql (and thus libpq) fails #191920

@robx

Description

@robx

Steps To Reproduce

Steps to reproduce the behavior:

  1. patch nixpkgs to fix lz4 static build (lz4: fix static build #191915)
  2. build statically some postgresql client tool that links libpq, e.g. pg_top

E.g., nix build github:robx/nixpkgs/lz4-static#pkgsStatic.pg_top does the job.

Build log

$ nix build github:robx/nixpkgs/lz4-static#pkgsStatic.pg_top
error: builder for '/nix/store/jc4h3yc4k5n478bvchfccdyj1a8g3fbx-postgresql-static-x86_64-unknown-linux-musl-14.5.drv' failed with exit code 2;
       last 10 log lines:
       > /nix/store/q8zpwwa77zaa5h0p15iiid26g5ak6s7l-x86_64-unknown-linux-musl-binutils-2.38/bin/x86_64-unknown-linux-musl-ld: /nix/store/zbyfyc4a71mymphik6kz8qxsfasaf1mc-icu4c-71.1-x86_64-unknown-linux-musl/lib/libicuuc.a(ustack.ao):(.data.rel.ro._ZTIN6icu_716UStackE[_ZTIN6icu_716UStackE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
       > /nix/store/q8zpwwa77zaa5h0p15iiid26g5ak6s7l-x86_64-unknown-linux-musl-binutils-2.38/bin/x86_64-unknown-linux-musl-ld: /nix/store/zbyfyc4a71mymphik6kz8qxsfasaf1mc-icu4c-71.1-x86_64-unknown-linux-musl/lib/libicuuc.a(chariter.ao):(.data.rel.ro._ZTIN6icu_7124ForwardCharacterIteratorE[_ZTIN6icu_7124ForwardCharacterIteratorE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
       > /nix/store/q8zpwwa77zaa5h0p15iiid26g5ak6s7l-x86_64-unknown-linux-musl-binutils-2.38/bin/x86_64-unknown-linux-musl-ld: /nix/store/zbyfyc4a71mymphik6kz8qxsfasaf1mc-icu4c-71.1-x86_64-unknown-linux-musl/lib/libicuuc.a(chariter.ao):(.data.rel.ro._ZTIN6icu_7117CharacterIteratorE[_ZTIN6icu_7117CharacterIteratorE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
       > /nix/store/q8zpwwa77zaa5h0p15iiid26g5ak6s7l-x86_64-unknown-linux-musl-binutils-2.38/bin/x86_64-unknown-linux-musl-ld: /nix/store/zbyfyc4a71mymphik6kz8qxsfasaf1mc-icu4c-71.1-x86_64-unknown-linux-musl/lib/libicuuc.a(parsepos.ao):(.data.rel.ro._ZTIN6icu_7113ParsePositionE[_ZTIN6icu_7113ParsePositionE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
       > collect2: error: ld returned 1 exit status
       > make[2]: *** [Makefile:66: postgres] Error 1
       > make[2]: Leaving directory '/build/postgresql-14.5/src/backend'
       > make[1]: *** [Makefile:42: all-backend-recurse] Error 2
       > make[1]: Leaving directory '/build/postgresql-14.5/src'
       > make: *** [GNUmakefile:16: world-src-recurse] Error 2
       For full logs, run 'nix log /nix/store/jc4h3yc4k5n478bvchfccdyj1a8g3fbx-postgresql-static-x86_64-unknown-linux-musl-14.5.drv'.
error: 1 dependencies of derivation '/nix/store/lxlnl2kal1r6a7s6rihs51809djrs79m-pg_top-static-x86_64-unknown-linux-musl-3.7.0.drv' failed to build

Additional context

For the purpose of statically building tools that use libpq, we wouldn't actually need a static build of the postgresql backend. Compare #61580, which suggests a separate libpq package.

Notify maintainers

@thoughtpolice @marsam

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

$ nix-shell -p nix-info --run "nix-info -m"
this path will be fetched (0.06 MiB download, 0.30 MiB unpacked):
  /nix/store/q6ayjwizl0xcbvknkcksy5g4n1ipa6b1-bash-interactive-5.1-p8-dev
copying path '/nix/store/q6ayjwizl0xcbvknkcksy5g4n1ipa6b1-bash-interactive-5.1-p8-dev' from 'https://cache.nixos.org'...
 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.91, NixOS, 22.05 (Quokka)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.8.1`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions