···3434 # Either of these can be losslessly-extracted from `parsed` iff parsing succeeds.
3535 system = parse.doubleFromSystem final.parsed;
3636 config = parse.tripleFromSystem final.parsed;
3737- # Determine whether we are compatible with the provided CPU
3838- isCompatible = platform: parse.isCompatible final.parsed.cpu platform.parsed.cpu;
3737+ # Determine whether we can execute binaries built for the provided platform.
3838+ canExecute = platform:
3939+ parse.isCompatible final.parsed.cpu platform.parsed.cpu
4040+ && final.parsed.kernel == platform.parsed.kernel;
4141+ isCompatible = _: throw "2022-05-23: isCompatible has been removed in favor of canExecute, refer to the 22.11 changelog for details";
3942 # Derived meta-data
4043 libc =
4144 /**/ if final.isDarwin then "libSystem"
+6-13
lib/systems/parse.nix
···148148 # Every CPU is compatible with itself.
149149 # - (transitivity)
150150 # If A is compatible with B and B is compatible with C then A is compatible with C.
151151- # - (compatible under multiple endianness)
152152- # CPUs with multiple modes of endianness are pairwise compatible.
151151+ #
152152+ # Note: Since 22.11 the archs of a mode switching CPU are no longer considered
153153+ # pairwise compatible. Mode switching implies that binaries built for A
154154+ # and B respectively can't be executed at the same time.
153155 isCompatible = a: b: with cpuTypes; lib.any lib.id [
154156 # x86
155157 (b == i386 && isCompatible a i486)
···191193 (b == aarch64 && a == armv8a)
192194 (b == armv8a && isCompatible a aarch64)
193195194194- (b == aarch64 && a == aarch64_be)
195195- (b == aarch64_be && isCompatible a aarch64)
196196-197196 # PowerPC
198197 (b == powerpc && isCompatible a powerpc64)
199199- (b == powerpcle && isCompatible a powerpc)
200200- (b == powerpc && a == powerpcle)
201201- (b == powerpc64le && isCompatible a powerpc64)
202202- (b == powerpc64 && a == powerpc64le)
198198+ (b == powerpcle && isCompatible a powerpc64le)
203199204200 # MIPS
205201 (b == mips && isCompatible a mips64)
206206- (b == mips && a == mipsel)
207207- (b == mipsel && isCompatible a mips)
208208- (b == mips64 && a == mips64el)
209209- (b == mips64el && isCompatible a mips64)
202202+ (b == mipsel && isCompatible a mips64el)
210203211204 # RISCV
212205 (b == riscv32 && isCompatible a riscv64)
···1313 <itemizedlist spacing="compact">
1414 <listitem>
1515 <para>
1616- Please remove this line when you add the first item since
1717- docbook requires the section to be non-empty
1616+ During cross-compilation, tests are now executed if the test
1717+ suite can be executed by the build platform. This is the case
1818+ when doing “native” cross-compilation where the build and host
1919+ platforms are largely the same, but the nixpkgs’ cross
2020+ compilation infrastructure is used, e.g.
2121+ <literal>pkgsStatic</literal> and <literal>pkgsLLVM</literal>.
2222+ Another possibility is that the build platform is a superset
2323+ of the host platform, e.g. when cross-compiling from
2424+ <literal>x86_64-unknown-linux</literal> to
2525+ <literal>i686-unknown-linux</literal>. The predicate gating
2626+ test suite execution is the newly added
2727+ <literal>canExecute</literal> predicate: You can e.g. check if
2828+ <literal>stdenv.buildPlatform</literal> can execute binaries
2929+ built for <literal>stdenv.hostPlatform</literal> (i.e.
3030+ produced by <literal>stdenv.cc</literal>) by evaluating
3131+ <literal>stdenv.buildPlatform.canExecute stdenv.hostPlatform</literal>.
1832 </para>
1933 </listitem>
2034 </itemizedlist>
···3549 <itemizedlist spacing="compact">
3650 <listitem>
3751 <para>
3838- Please remove this line when you add the first item since
3939- docbook requires the section to be non-empty
5252+ The <literal>isCompatible</literal> predicate checking CPU
5353+ compatibility is no longer exposed by the platform sets
5454+ generated using <literal>lib.systems.elaborate</literal>. In
5555+ most cases you will want to use the new
5656+ <literal>canExecute</literal> predicate instead which also
5757+ considers the kernel / syscall interface. It is briefly
5858+ described in the release’s
5959+ <link linkend="sec-release-22.11-highlights">highlights
6060+ section</link>.
6161+ <literal>lib.systems.parse.isCompatible</literal> still
6262+ exists, but has changed semantically: Architectures with
6363+ differing endianness modes are <emphasis>no longer considered
6464+ compatible</emphasis>.
4065 </para>
4166 </listitem>
4267 </itemizedlist>
+18-2
nixos/doc/manual/release-notes/rl-2211.section.md
···6677In addition to numerous new and upgraded packages, this release has the following highlights:
8899-- Please remove this line when you add the first item since docbook requires the section to be non-empty
99+- During cross-compilation, tests are now executed if the test suite can be executed
1010+ by the build platform. This is the case when doing “native” cross-compilation
1111+ where the build and host platforms are largely the same, but the nixpkgs' cross
1212+ compilation infrastructure is used, e.g. `pkgsStatic` and `pkgsLLVM`. Another
1313+ possibility is that the build platform is a superset of the host platform, e.g. when
1414+ cross-compiling from `x86_64-unknown-linux` to `i686-unknown-linux`.
1515+ The predicate gating test suite execution is the newly added `canExecute`
1616+ predicate: You can e.g. check if `stdenv.buildPlatform` can execute binaries
1717+ built for `stdenv.hostPlatform` (i.e. produced by `stdenv.cc`) by evaluating
1818+ `stdenv.buildPlatform.canExecute stdenv.hostPlatform`.
10191120<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
1221···18271928## Backward Incompatibilities {#sec-release-22.11-incompatibilities}
20292121-- Please remove this line when you add the first item since docbook requires the section to be non-empty
3030+- The `isCompatible` predicate checking CPU compatibility is no longer exposed
3131+ by the platform sets generated using `lib.systems.elaborate`. In most cases
3232+ you will want to use the new `canExecute` predicate instead which also
3333+ considers the kernel / syscall interface. It is briefly described in the
3434+ release's [highlights section](#sec-release-22.11-highlights).
3535+ `lib.systems.parse.isCompatible` still exists, but has changed semantically:
3636+ Architectures with differing endianness modes are *no longer considered compatible*.
3737+2238<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
23392440## Other Notable Changes {#sec-release-22.11-notable-changes}
···11{ lib, stdenv, fetchurl, fetchpatch
22, autoreconfHook
3344-, doCheck ? true # test suite depends on dejagnu which cannot be used during bootstrapping
44+ # test suite depends on dejagnu which cannot be used during bootstrapping
55+ # dejagnu also requires tcl which can't be built statically at the moment
66+, doCheck ? !(stdenv.hostPlatform.isStatic)
57, dejagnu
68}:
79
+2-2
pkgs/stdenv/generic/make-derivation.nix
···167167let
168168 # TODO(@oxij, @Ericson2314): This is here to keep the old semantics, remove when
169169 # no package has `doCheck = true`.
170170- doCheck' = doCheck && stdenv.hostPlatform == stdenv.buildPlatform;
171171- doInstallCheck' = doInstallCheck && stdenv.hostPlatform == stdenv.buildPlatform;
170170+ doCheck' = doCheck && stdenv.buildPlatform.canExecute stdenv.hostPlatform;
171171+ doInstallCheck' = doInstallCheck && stdenv.buildPlatform.canExecute stdenv.hostPlatform;
172172173173 separateDebugInfo' = separateDebugInfo && stdenv.hostPlatform.isLinux && !(stdenv.hostPlatform.useLLVM or false);
174174 outputs' = outputs ++ lib.optional separateDebugInfo' "debug";
+1-1
pkgs/stdenv/linux/default.nix
···3131 # compatible with or current architecture.
3232 getCompatibleTools = lib.foldl (v: system:
3333 if v != null then v
3434- else if localSystem.isCompatible (lib.systems.elaborate { inherit system; }) then archLookupTable.${system}
3434+ else if localSystem.canExecute (lib.systems.elaborate { inherit system; }) then archLookupTable.${system}
3535 else null) null (lib.attrNames archLookupTable);
36363737 archLookupTable = table.${localSystem.libc}