diff options
author | Thomas Watson <twatson52@icloud.com> | 2024-04-06 15:11:48 -0500 |
---|---|---|
committer | Thomas Watson <twatson52@icloud.com> | 2024-04-07 10:44:53 -0500 |
commit | 9bcd91ba09dbe6d7cb93b2774a77596d914563ca (patch) | |
tree | c6840282093bf00dcb0744d8006133c940322e0e /pkgs/build-support | |
parent | 14ac5705600b87f3f645da175a1ff4450df6cb54 (diff) |
build-fhsenv-bubblewrap: reference 32-bit binaries only if multiArch
Fixes issues using bubblewrap'd fhsenvs in scenarios where i686 is not supported (such as Rosetta 2 emulation in a Linux VM on Apple Silicon).
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix | 13 | ||||
-rw-r--r-- | pkgs/build-support/build-fhsenv-bubblewrap/default.nix | 2 |
2 files changed, 7 insertions, 8 deletions
diff --git a/pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix b/pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix index 81813473a8dbf..2ab7847926e29 100644 --- a/pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix +++ b/pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix @@ -40,12 +40,11 @@ let isMultiBuild = multiArch && stdenv.system == "x86_64-linux"; isTargetBuild = !isMultiBuild; - # list of packages (usually programs) which are only be installed for the - # host's architecture + # list of packages (usually programs) which match the host's architecture + # (which includes stuff from multiPkgs) targetPaths = targetPkgs pkgs ++ (if multiPkgs == null then [] else multiPkgs pkgs); - # list of packages which are installed for both x86 and x86_64 on x86_64 - # systems + # list of packages which are for x86 (only multiPkgs, only for x86_64 hosts) multiPaths = multiPkgs pkgsi686Linux; # base packages of the chroot @@ -76,8 +75,8 @@ let ]; ldconfig = writeShellScriptBin "ldconfig" '' - # due to a glibc bug, 64-bit ldconfig complains about patchelf'd 32-bit libraries, so we're using 32-bit ldconfig - exec ${if stdenv.system == "x86_64-linux" then pkgsi686Linux.glibc.bin else pkgs.glibc.bin}/bin/ldconfig -f /etc/ld.so.conf -C /etc/ld.so.cache "$@" + # due to a glibc bug, 64-bit ldconfig complains about patchelf'd 32-bit libraries, so we use 32-bit ldconfig when we have them + exec ${if isMultiBuild then pkgsi686Linux.glibc.bin else pkgs.glibc.bin}/bin/ldconfig -f /etc/ld.so.conf -C /etc/ld.so.cache "$@" ''; etcProfile = writeText "profile" '' @@ -251,7 +250,7 @@ let in runCommandLocal "${name}-fhs" { passthru = { - inherit args baseTargetPaths targetPaths baseMultiPaths ldconfig; + inherit args baseTargetPaths targetPaths baseMultiPaths ldconfig isMultiBuild; }; } '' mkdir -p $out diff --git a/pkgs/build-support/build-fhsenv-bubblewrap/default.nix b/pkgs/build-support/build-fhsenv-bubblewrap/default.nix index e06fb51dd4b67..c30a4dfb7ea37 100644 --- a/pkgs/build-support/build-fhsenv-bubblewrap/default.nix +++ b/pkgs/build-support/build-fhsenv-bubblewrap/default.nix @@ -252,7 +252,7 @@ let --symlink /etc/ld.so.cache ${glibc}/etc/ld.so.cache \ --ro-bind ${glibc}/etc/rpc ${glibc}/etc/rpc \ --remount-ro ${glibc}/etc \ - '' + optionalString (stdenv.isx86_64 && stdenv.isLinux) (indentLines '' + '' + optionalString fhsenv.isMultiBuild (indentLines '' --tmpfs ${pkgsi686Linux.glibc}/etc \ --symlink /etc/ld.so.conf ${pkgsi686Linux.glibc}/etc/ld.so.conf \ --symlink /etc/ld.so.cache ${pkgsi686Linux.glibc}/etc/ld.so.cache \ |