Skip to content

Commit

Permalink
various: fix hostPlatform.canExecute buildPlatform
Browse files Browse the repository at this point in the history
It doesn't matter whether the hostPlatform could execute stuff from the
buildPlatform - we need it the other way around: Certain things during a
build process can only happen when, as part of the build, the
**buildPlatform** can execute the code it just created for the
**hostPlatform**.

Unless we are talking about compilation at run-time, as in the case of
PostgreSQL. Extend the comment there to make it clear that this is on
purpose.
  • Loading branch information
wolfgangwalther committed Dec 21, 2024
1 parent 8ddbc44 commit b9af1c1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkgs/by-name/li/libnvme/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
swig,
systemd,
# ImportError: cannot import name 'mlog' from 'mesonbuild'
withDocs ? stdenv.hostPlatform.canExecute stdenv.buildPlatform,
withDocs ? stdenv.buildPlatform.canExecute stdenv.hostPlatform,
}:

stdenv.mkDerivation (finalAttrs: {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/re/repgrep/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ rustPlatform.buildRustPackage rec {
installManPage rgr.1
popd
''
+ lib.optionalString (stdenv.hostPlatform.canExecute stdenv.buildPlatform) ''
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
# As it can be seen here: https://github.com/acheronfail/repgrep/blob/0.15.0/.github/workflows/release.yml#L206, the completions are just the same as ripgrep
installShellCompletion --cmd rgr \
--bash <(${lib.getExe ripgrep} --generate complete-bash | sed 's/-c rg/-c rgr/') \
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/vl/vlc/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ stdenv.mkDerivation (finalAttrs: {
# Upstream luac can't cross compile, so we have to install the lua sources
# instead of bytecode:
# https://www.lua.org/wshop13/Jericke.pdf#page=39
+ lib.optionalString (!stdenv.hostPlatform.canExecute stdenv.buildPlatform) ''
+ lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
substituteInPlace share/Makefile.am \
--replace $'.luac \\\n' $'.lua \\\n'
'';
Expand Down
3 changes: 3 additions & 0 deletions pkgs/servers/sql/postgresql/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,9 @@ let
# resulting LLVM IR isn't platform-independent this doesn't give you much.
# In fact, I tried to test the result in a VM-test, but as soon as JIT was used to optimize
# a query, postgres would coredump with `Illegal instruction`.
#
# Note: This is "host canExecute build" on purpose, since this is about the LLVM that is called
# to do JIT at **runtime**.
broken = jitSupport && !stdenv.hostPlatform.canExecute stdenv.buildPlatform;
};
});
Expand Down

0 comments on commit b9af1c1

Please sign in to comment.