From c4560442bf4eadd68a8ec1f05faddcedd975d4a0 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 7 Oct 2025 17:29:30 +0300 Subject: [PATCH 1/4] scipopt-scip: fix build with CMake 4 --- ...1-check-fix-invalid-ctest-invocation.patch | 40 +++++++++++++++++++ pkgs/by-name/sc/scipopt-scip/package.nix | 5 +++ 2 files changed, 45 insertions(+) create mode 100644 pkgs/by-name/sc/scipopt-scip/0001-check-fix-invalid-ctest-invocation.patch diff --git a/pkgs/by-name/sc/scipopt-scip/0001-check-fix-invalid-ctest-invocation.patch b/pkgs/by-name/sc/scipopt-scip/0001-check-fix-invalid-ctest-invocation.patch new file mode 100644 index 000000000000..d6b1f5cd2e18 --- /dev/null +++ b/pkgs/by-name/sc/scipopt-scip/0001-check-fix-invalid-ctest-invocation.patch @@ -0,0 +1,40 @@ +From 7772c64ee2face1c1099c23ecbfd20ff663cffc3 Mon Sep 17 00:00:00 2001 +From: Florian Klink +Date: Tue, 7 Oct 2025 16:19:31 +0300 +Subject: [PATCH] check: fix invalid ctest invocation + +ctest doesn't like `-R "-default"`. CMake 4.0 fails with the following +error message: + +> CMake Error: Invalid value used with -R + +`-R` normally specifies the regex that needs to match. If none is +specified, all are selected: + +https://cmake.org/cmake/help/latest/manual/ctest.1.html#cmdoption-ctest-R + +This maybe never worked, but got silently ignored until +https://cmake.org/cmake/help/latest/policy/CMP0175.html + +Removing that regex should only cause *more* tests to get selected, not +less - and the build now succeeds with it. +--- + check/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/check/CMakeLists.txt b/check/CMakeLists.txt +index 0d667d5..c26b978 100644 +--- a/check/CMakeLists.txt ++++ b/check/CMakeLists.txt +@@ -4,7 +4,7 @@ include(CTest) + # add a custom SCIP check target 'scip_check' + # + add_custom_target(scip_check +- COMMAND ${CMAKE_CTEST_COMMAND} -R "-default" -E "applications" --output-on-failure ++ COMMAND ${CMAKE_CTEST_COMMAND} -E "applications" --output-on-failure + DEPENDS scip + ) + +-- +2.51.0 + diff --git a/pkgs/by-name/sc/scipopt-scip/package.nix b/pkgs/by-name/sc/scipopt-scip/package.nix index dd09c6713d75..0a4c491ce1bb 100644 --- a/pkgs/by-name/sc/scipopt-scip/package.nix +++ b/pkgs/by-name/sc/scipopt-scip/package.nix @@ -29,6 +29,11 @@ stdenv.mkDerivation rec { hash = "sha256-Zc1AXNpHQXXFO8jkMaJj6xYkmkQxAM8G+SiPiH9xCAw="; }; + patches = [ + # https://github.com/scipopt/scip/pull/169 + ./0001-check-fix-invalid-ctest-invocation.patch + ]; + nativeBuildInputs = [ cmake ]; buildInputs = [ From 78b77878bfaf2e9fb62355c316841b5a5797ceea Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 7 Oct 2025 18:04:34 +0300 Subject: [PATCH 2/4] scipopt-scip: drop unused cmakeFlags array. --- pkgs/by-name/sc/scipopt-scip/package.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/by-name/sc/scipopt-scip/package.nix b/pkgs/by-name/sc/scipopt-scip/package.nix index 0a4c491ce1bb..ec54c7413e8b 100644 --- a/pkgs/by-name/sc/scipopt-scip/package.nix +++ b/pkgs/by-name/sc/scipopt-scip/package.nix @@ -51,8 +51,6 @@ stdenv.mkDerivation rec { mpfr # if not included, throws fatal error: mpfr.h not found ]; - cmakeFlags = [ ]; - doCheck = true; meta = { From 99a29533045a9c43efffad9c318c1f77752bd10d Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Fri, 22 Aug 2025 16:19:53 +0200 Subject: [PATCH 3/4] scipopt-scip: remove unneeded argument We don't use fetchzip anywhere. --- pkgs/by-name/sc/scipopt-scip/package.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/by-name/sc/scipopt-scip/package.nix b/pkgs/by-name/sc/scipopt-scip/package.nix index ec54c7413e8b..901fcbb9a073 100644 --- a/pkgs/by-name/sc/scipopt-scip/package.nix +++ b/pkgs/by-name/sc/scipopt-scip/package.nix @@ -1,7 +1,6 @@ { lib, stdenv, - fetchzip, fetchFromGitHub, cmake, zlib, From 633c317b1305150f40ae046e3bdd53dcfc092f6e Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Fri, 22 Aug 2025 16:24:46 +0200 Subject: [PATCH 4/4] or-tools: enable SCIP support This adds a new argument, withScip, defaulting to true, which will configure or-tools with SCIP support. or-tools usually is built with SCIP support, and only tested like this, see https://github.com/google/or-tools/pull/4745. However, SCIP only was introduced to nixpkgs March 2025, that's probably why or-tools in nixpkgs came without it so far. If built with SCIP support, we need to propagate scip itself, otherwise downstream cmake consumers need to set SCIP_ROOT explicitly. --- pkgs/by-name/or/or-tools/package.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/or/or-tools/package.nix b/pkgs/by-name/or/or-tools/package.nix index 638b77782166..3d13cdf0b797 100644 --- a/pkgs/by-name/or/or-tools/package.nix +++ b/pkgs/by-name/or/or-tools/package.nix @@ -20,6 +20,9 @@ swig, unzip, zlib, + + scipopt-scip, + withScip ? true, }: let @@ -87,9 +90,13 @@ stdenv.mkDerivation (finalAttrs: { (lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib") (lib.cmakeBool "FETCH_PYTHON_DEPS" false) (lib.cmakeBool "USE_GLPK" true) - (lib.cmakeBool "USE_SCIP" false) + (lib.cmakeBool "USE_SCIP" withScip) (lib.cmakeFeature "Python3_EXECUTABLE" "${python3.pythonOnBuildForHost.interpreter}") ] + ++ lib.optionals withScip [ + # scip code parts require setting this unfortunately… + (lib.cmakeFeature "CMAKE_CXX_FLAGS" "-Wno-error=format-security") + ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ (lib.cmakeBool "CMAKE_MACOSX_RPATH" false) ]; @@ -137,7 +144,12 @@ stdenv.mkDerivation (finalAttrs: { python3.pkgs.immutabledict python3.pkgs.numpy python3.pkgs.pandas + ] + ++ lib.optionals withScip [ + # Needed for downstream cmake consumers to not need to set SCIP_ROOT explicitly + scipopt-scip ]; + nativeCheckInputs = [ python3.pkgs.matplotlib python3.pkgs.pandas