haskellPackages.cabal-install: fix build when cross compiling#490936
haskellPackages.cabal-install: fix build when cross compiling#490936alexfmpe wants to merge 1 commit intoNixOS:haskell-updatesfrom
Conversation
| postInstall = old.postInstall + '' | ||
| mkdir -p "$out/share/man/man1" | ||
| "$out/bin/cabal" man --raw > "$out/share/man/man1/cabal.1" | ||
| ${emulator} "$out/bin/cabal" man --raw > "$out/share/man/man1/cabal.1" |
There was a problem hiding this comment.
This causes rebuild even on the native case due to the extra exec.
One way to get around it is something like
let emulatorIfNeeded exe = if isCross then (emulator + " " + exe) else exe;
and then
${emulatorIfNeeded ''"$out/bin/cabal"''} man --raw > "$out/share/man/man1/cabal.1"
| ++ old.buildTools or [ ]; | ||
| postInstall = old.postInstall + '' | ||
| mkdir -p "$out/share/man/man1" | ||
| "$out/bin/cabal" man --raw > "$out/share/man/man1/cabal.1" |
There was a problem hiding this comment.
Why do we even call $out/bin/cabal here? Shouldn't we call the build tool cabal in this case?
There was a problem hiding this comment.
Not sure, maybe @sternenseemann remembers?
They seem to have the same output, as
diff result-cabal-native/share/man/man1/cabal.1.gz result-cabal-cross/share/man/man1/cabal.1.gz came out empty.
I can't imagine a non-contrived scenario where they would differ. The only real concern I see is that build tool cabal might be a different version.
Tangent, but I think we might end up using this "run executable via emulator" logic quite a bit for those test suites which expect the executable in PATH
There was a problem hiding this comment.
It was introduced in #115347. It doesn't look like it was on purpose that way.
There was a problem hiding this comment.
Cabal doesn't act as a build tool that generates a man page from source files here. Rather, it dumps its own documentation that is compiled in. Hence it is correct to use $out/bin/cabal (it just is an ill-conceived mechanism). In particular, cabal-install doesn't even depend on cabal-install at build time and if we would introduce this dependency, there would not be a guarantee that the output would be the same, i.e. running cabal man and man cabal would give different results.
My vote would be to just disable the man page generation if cross compiling. There is no good way to support this.
There was a problem hiding this comment.
Tangent, but I think we might end up using this "run executable via emulator" logic quite a bit for those test suites which expect the executable in PATH
Also here, probably disabling is better. The emulator is not a silver bullet (e.g. the user space qemu can't inject itself into exec calls) and also not necessarily available.
There was a problem hiding this comment.
Thanks for clarifying.
My vote would be to just disable the man page generation if cross compiling. There is no good way to support this.
Agreed.
There was a problem hiding this comment.
My vote would be to just disable the man page generation if cross compiling. There is no good way to support this.
Even for pkgsStatic ?
What about disabling when canExecute is false, which is what actually requires emulator shenanigans?
There was a problem hiding this comment.
What about disabling when
canExecuteis false
Yes, that.
2db7daa to
6e825af
Compare
6e825af to
2c7d514
Compare
Fixes
nix-build -A pkgsCross.aarch64-multiplatform.haskellPackages.cabal-installThings done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.