postgresqlPackages.postgis: fix cross-compilation#424800
Conversation
There was a problem hiding this comment.
Surprising: json_c doesn't work on RiscV?
There was a problem hiding this comment.
It is looking for the json libraries or header files but I couldn't get it to work. So this feature is missing but at least cross-compilation will work :)
|
how did you build it? this should fix: nix build .#pkgsCross.riscv64.postgis |
I mean the same error for other platforms |
sikmir
left a comment
There was a problem hiding this comment.
Please update commit message to postgresqlPackages.postgis: fix cross-compilation.
|
A bit refactored: diff --git i/pkgs/servers/sql/postgresql/ext/postgis.nix w/pkgs/servers/sql/postgresql/ext/postgis.nix
index 09c547075135..39b5329c993d 100644
--- i/pkgs/servers/sql/postgresql/ext/postgis.nix
+++ w/pkgs/servers/sql/postgresql/ext/postgis.nix
@@ -91,12 +91,19 @@ postgresqlBuildExtension (finalAttrs: {
./autogen.sh
'';
- configureFlags = [
- "--with-pgconfig=${postgresql.pg_config}/bin/pg_config"
- "--with-gdalconfig=${gdal}/bin/gdal-config"
- "--with-jsondir=${json_c.dev}"
- "--disable-extension-upgrades-install"
- ] ++ lib.optional withSfcgal "--with-sfcgal=${sfcgal}/bin/sfcgal-config";
+ configureFlags =
+ let
+ isCross = stdenv.hostPlatform != stdenv.buildPlatform;
+ in
+ [
+ (lib.enableFeature false "extension-upgrades-install")
+ (lib.withFeatureAs true "pgconfig" "${postgresql.pg_config}/bin/pg_config")
+ (lib.withFeatureAs true "gdalconfig" "${gdal}/bin/gdal-config")
+ (lib.withFeatureAs true "jsondir" (lib.getDev json_c))
+ (lib.withFeatureAs true "xml2config" (lib.getExe' (lib.getDev libxml2) "xml2-config"))
+ (lib.withFeatureAs withSfcgal "sfcgal" "${sfcgal}/bin/sfcgal-config")
+ (lib.withFeature (!isCross) "json") # configure: error: cannot check for file existence when cross compiling
+ ];
makeFlags = [
"PERL=${perl}/bin/perl" |
|
Thank you, added it! |
There was a problem hiding this comment.
Comparing full platforms with == and != is a bit of an anti-pattern. Can we be any more specific? Why does cross fail in this case - is it because the build platform can't execute the host version of a dependency? Or what exactly is the reason?
Also see discussion in #380005.
There was a problem hiding this comment.
Or what exactly is the reason?
configure: error: cannot check for file existence when cross compiling
I didn't dig deeper.
There was a problem hiding this comment.
Seems like this error comes from the AC_CHECK_FILE macro in:
The macro is defined upstream here:
The cross_compiling thing is set here:
It looks like autoconf compares the triples it gets passed for that case.
Thus, I suggest this:
| isCross = stdenv.hostPlatform != stdenv.buildPlatform; | |
| isCross = stdenv.hostPlatform.config != stdenv.buildPlatform.config; |
There was a problem hiding this comment.
Added the changes and it's working. Thank you
|
Thank you! |
|
Successfully created backport PR for |
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-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.