mprime: fix fatal error with -march=znver1

Compiling for recent architectures causes rounding issues:

FATAL ERROR: Rounding was 0.4977243728, expected less than 0.4
This commit is contained in:
someplaceguy
2026-05-24 17:58:21 +05:30
committed by John Titor
parent 8d7ba4f88b
commit f511847d35
+11
View File
@@ -28,6 +28,8 @@ let
."${stdenv.hostPlatform.system}" or throwSystem;
docDir = "share/mprime/doc";
ccArch = stdenv.hostPlatform.gcc.arch or "x86-64";
in
stdenv.mkDerivation (finalAttrs: {
pname = "mprime";
@@ -67,6 +69,15 @@ stdenv.mkDerivation (finalAttrs: {
gmp
];
env = {
NIX_CFLAGS_COMPILE = toString (
# The following is needed because compiling with stdenv.hostPlatform.gcc.arch
# set to something like "znver1" causes fatal errors during runtime due to
# rounding issues
lib.optional (stdenv.hostPlatform.isx86_64 && ccArch != "x86-64") "-march=x86-64"
);
};
enableParallelBuilding = true;
buildPhase = ''