Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experiment: try using nix's pkgs.pkgsStatic for the static build #2332

Closed
wants to merge 4 commits into from

Conversation

robx
Copy link
Contributor

@robx robx commented Jun 16, 2022

pkgs.pkgsStatic on Linux is essentially what static-haskell-nix does, except it doesn't appear to deal with system libraries properly. But eventually this should obsolete static-haskell-nix, which seems unmaintained.

@robx robx force-pushed the nix-static branch 3 times, most recently from d1aa027 to 47f52b7 Compare June 17, 2022 11:59
@robx robx changed the title experiment: try using nix's pkgs.pkgsMusl for the static build experiment: try using nix's pkgs.pkgsStatic for the static build Aug 10, 2022
@robx
Copy link
Contributor Author

robx commented Sep 19, 2022

After rebasing, this is currently failing with:

       > /nix/store/gzms61swp55fg5qbvshyqv5jfsnfvybz-x86_64-unknown-linux-musl-binutils-2.38/bin/x86_64-unknown-linux-musl-ld: /nix/store/pcdy4i08qq7w4ipxa3xan6rqdpdvh8hs-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.4/src/backend'
       > make[1]: *** [Makefile:42: all-backend-recurse] Error 2
       > make[1]: Leaving directory '/build/postgresql-14.4/src'
       > make: *** [GNUmakefile:16: world-src-recurse] Error 2
       For full logs, run 'nix log /nix/store/wb0p273zxsa5f1wspn4173l7wxz9kr95-postgresql-static-x86_64-unknown-linux-musl-14.4.drv'.

This appears to be an issue linking libicuuc, while building postgresql itself statically.

We shouldn't actually need to build the postgresql backend statically, this is just happening because we need static libpq (but chances are similar issues would show up anyway).

@brandonros
Copy link

What would it take to add cross-compilation support to this as per https://nix.dev/tutorials/cross-compilation?

@robx
Copy link
Contributor Author

robx commented Dec 19, 2022

What would it take to add cross-compilation support to this as per https://nix.dev/tutorials/cross-compilation?

I'm not sure I understand what you're going for here, could you elaborate?

(The issue #2478 collects some more info about the static build, might be the better place to discuss this.)

@steve-chavez
Copy link
Member

We shouldn't actually need to build the postgresql backend statically, this is just happening because we need static libpq (but chances are similar issues would show up anyway).

There's some progress for packaging only libpq on nixpkgs: https://github.com/NixOS/nixpkgs/pull/234470/files

Perhaps we could copy that expression into our repo?

@wolfgangwalther
Copy link
Member

Closing in favor of #3169

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants