From 9e6475352d53475fbe344e869c36ee59f43108c1 Mon Sep 17 00:00:00 2001 From: Reno Dakota Date: Thu, 2 Jan 2025 17:02:10 -0800 Subject: [PATCH 1/2] sage.lib: ignore narrowing error on clang-19 `https://github.com/sagemath/sage/pull/39249` The v_index type is an integer and in the code there are lots of places where the significant bytes of an 8 byte type are lost in assignment. However, this is the only one which causes an error. A workaround is to ignore the error or to preform the assignment outside of the initializer list. --- pkgs/by-name/sa/sage/sagelib.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/by-name/sa/sage/sagelib.nix b/pkgs/by-name/sa/sage/sagelib.nix index 98096eadb6696..408a015a2a9ab 100644 --- a/pkgs/by-name/sa/sage/sagelib.nix +++ b/pkgs/by-name/sa/sage/sagelib.nix @@ -1,4 +1,6 @@ { + lib, + stdenv, sage-src, env-locations, python, @@ -118,6 +120,13 @@ buildPythonPackage rec { readline ]; + env = lib.optionalAttrs stdenv.cc.isClang { + # code tries to assign a unsigned long to an int in an initialized list + # leading to this error. + # https://github.com/sagemath/sage/pull/39249 + NIX_CFLAGS_COMPILE = "-Wno-error=c++11-narrowing-const-reference"; + }; + propagatedBuildInputs = [ # native dependencies (TODO: determine which ones need to be propagated) blas From 01299c081f87c6f5c7c42c6c41f4511e7732b7b5 Mon Sep 17 00:00:00 2001 From: Reno Dakota Date: Thu, 2 Jan 2025 17:02:36 -0800 Subject: [PATCH 2/2] sage.tests: darwin sandbox fixes --- pkgs/by-name/sa/sage/sage-tests.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/by-name/sa/sage/sage-tests.nix b/pkgs/by-name/sa/sage/sage-tests.nix index 6080d8204fc15..669730f46c822 100644 --- a/pkgs/by-name/sa/sage/sage-tests.nix +++ b/pkgs/by-name/sa/sage/sage-tests.nix @@ -49,6 +49,14 @@ stdenv.mkDerivation { makeWrapper "${sage-with-env}/bin/sage" "$out/bin/sage" ''; + env = lib.optionalAttrs stdenv.hostPlatform.isDarwin { + # prevent warnings about assigning LC_* to "C" resulting in broken tests + # when run in darwin sandbox + LC_ALL = "en_US.UTF-8"; + }; + + # allow singular tests to pass in darwin sandbox + __darwinAllowLocalNetworking = true; doInstallCheck = true; installCheckPhase = '' export HOME="$TMPDIR/sage-home"