haskellPackages.postgresql-libpq: Use pkg-config instead of pg_config to find libpq #286370
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
During configure, postgresql-libpq's Setup.hs will try to execute pg_config to find libpq. This will not work when cross-compiling, because pg_config was compiled for the target system, but needs to run on the host.
The "use-pkg-config" flag allows to do this via pkg-config instead, which works better in those cases.
To replicate this, one needs to be able to build a cross-postgresql at first. Examples for a separate libpq derivation / output are in #234470 and #273175, those could possibly already work to compile to
pkgsStatic
. Alternatively, a quick hack for a test would be to removeicu
andsystemd
dependencies frompkgs/servers/sql/postgresql/default.nix
and then buildpkgsCross.musl64.postgresql
.Once postgresql builds, but before this patch,
nix-build -A pkgsCross.musl64.haskellPackages.postgresql-libpq
will fail with:Which makes sense, I assume, because postgresql would not be in the path anymore as a buildInput, but not nativeBuildInput.
After the change to use pkg-config,
pkgsCross.musl64.haskellPackages.postgresql-libpq
builds successfully. Of course, I also tested regularhaskellPackages.postgresql-libpq
, which still builds fine.Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.