From 7731bbbc79f52624f3059df588ae909674718790 Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Thu, 21 Sep 2023 13:34:00 -0400 Subject: [PATCH 1/9] opencv4WithoutCuda: init at opencv4.version --- pkgs/top-level/all-packages.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1965858fbda9..ed83ff22184b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24336,6 +24336,10 @@ with pkgs; ffmpeg = ffmpeg_4; }; + opencv4WithoutCuda = opencv4.override { + enableCuda = false; + }; + opencv = opencv4; imath = callPackage ../development/libraries/imath { }; From 69e182e6f1b0db8da8c39b004c7e358a50d5387a Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Thu, 21 Sep 2023 12:27:00 -0400 Subject: [PATCH 2/9] sdrangel: opencv3 -> opencv4 --- pkgs/applications/radio/sdrangel/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/radio/sdrangel/default.nix b/pkgs/applications/radio/sdrangel/default.nix index f55371fd689a..f1dd9402cc72 100644 --- a/pkgs/applications/radio/sdrangel/default.nix +++ b/pkgs/applications/radio/sdrangel/default.nix @@ -24,7 +24,7 @@ , libbladeRF , mbelib , ninja -, opencv3 +, opencv4 , pkg-config , qtcharts , qtdeclarative @@ -90,7 +90,7 @@ stdenv.mkDerivation (finalAttrs: { libusb1 limesuite mbelib - opencv3 + opencv4 qtcharts qtdeclarative qtgamepad From 8969c706d25fcc4789c47d7011fa93e062d911e1 Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Thu, 21 Sep 2023 13:00:20 -0400 Subject: [PATCH 3/9] mxnet: opencv3 -> opencv4 --- pkgs/applications/science/math/mxnet/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/science/math/mxnet/default.nix b/pkgs/applications/science/math/mxnet/default.nix index d65de87d8eb9..993da2b89898 100644 --- a/pkgs/applications/science/math/mxnet/default.nix +++ b/pkgs/applications/science/math/mxnet/default.nix @@ -1,5 +1,5 @@ { config, stdenv, lib, fetchurl, fetchpatch, bash, cmake -, opencv3, gtest, blas, gomp, llvmPackages, perl +, opencv4, gtest, blas, gomp, llvmPackages, perl , cudaSupport ? config.cudaSupport, cudaPackages ? { }, nvidia_x11 , cudnnSupport ? cudaSupport }: @@ -37,7 +37,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake perl ]; - buildInputs = [ opencv3 gtest blas.provider ] + buildInputs = [ opencv4 gtest blas.provider ] ++ lib.optional stdenv.cc.isGNU gomp ++ lib.optional stdenv.cc.isClang llvmPackages.openmp # FIXME: when cuda build is fixed, remove nvidia_x11, and use /run/opengl-driver/lib From 2a2ba3dc3f08090e12cee4c11ba4a558a46a5fff Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Sat, 23 Sep 2023 19:58:50 -0400 Subject: [PATCH 4/9] caffeWithCuda: mark broken > CMake Error at cuda_compile_1_generated_math_functions.cu.o.Release.cmake:280 (message): > Error generating file > /build/source/build/src/caffe/CMakeFiles/cuda_compile_1.dir/util/./cuda_compile_1_generated_math_functions.cu.o --- pkgs/applications/science/math/caffe/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/science/math/caffe/default.nix b/pkgs/applications/science/math/caffe/default.nix index 5af927294d6c..527c96f4d64c 100644 --- a/pkgs/applications/science/math/caffe/default.nix +++ b/pkgs/applications/science/math/caffe/default.nix @@ -148,7 +148,7 @@ stdenv.mkDerivation rec { ''; homepage = "http://caffe.berkeleyvision.org/"; maintainers = with maintainers; [ ]; - broken = pythonSupport && (python.isPy310); + broken = (pythonSupport && (python.isPy310)) || cudaSupport; license = licenses.bsd2; platforms = platforms.linux ++ platforms.darwin; }; From 935338d123b4f183820c134edb058e5d022d6e8b Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Thu, 21 Sep 2023 13:27:24 -0400 Subject: [PATCH 5/9] caffe: opencv3 -> opencv4 --- pkgs/applications/science/math/caffe/default.nix | 10 ++++++++-- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/science/math/caffe/default.nix b/pkgs/applications/science/math/caffe/default.nix index 527c96f4d64c..42c160393595 100644 --- a/pkgs/applications/science/math/caffe/default.nix +++ b/pkgs/applications/science/math/caffe/default.nix @@ -1,12 +1,13 @@ { config, stdenv, lib , fetchFromGitHub , fetchurl +, fetchpatch , cmake , boost , gflags , glog , hdf5-cpp -, opencv3 +, opencv4 , protobuf , doxygen , blas @@ -71,7 +72,7 @@ stdenv.mkDerivation rec { ++ ["-DUSE_LEVELDB=${toggle leveldbSupport}"] ++ ["-DUSE_LMDB=${toggle lmdbSupport}"]; - buildInputs = [ boost gflags glog protobuf hdf5-cpp opencv3 blas ] + buildInputs = [ boost gflags glog protobuf hdf5-cpp opencv4 blas ] ++ lib.optional cudaSupport cudatoolkit ++ lib.optional cudnnSupport cudnn ++ lib.optional lmdbSupport lmdb @@ -96,6 +97,11 @@ stdenv.mkDerivation rec { patches = [ ./darwin.patch + (fetchpatch { + name = "support-opencv4"; + url = "https://github.com/BVLC/caffe/pull/6638/commits/0a04cc2ccd37ba36843c18fea2d5cbae6e7dd2b5.patch"; + hash = "sha256-ZegTvp0tTHlopQv+UzHDigs6XLkP2VfqLCWXl6aKJSI="; + }) ] ++ lib.optional pythonSupport (substituteAll { src = ./python.patch; inherit (python.sourceVersion) major minor; # Should be changed in case of PyPy diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ed83ff22184b..e2930432b297 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -39829,7 +39829,7 @@ with pkgs; caffe = callPackage ../applications/science/math/caffe ({ inherit (config) cudaSupport; cudaPackages = cudaPackages_10_1; - opencv3 = opencv3WithoutCuda; # Used only for image loading. + opencv4 = opencv4WithoutCuda; # Used only for image loading. blas = openblas; inherit (darwin.apple_sdk.frameworks) Accelerate CoreGraphics CoreVideo; } // (config.caffe or {})); From 5a1de75eb021bc7c9aa190b3bab193dfa41c0bc8 Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Thu, 21 Sep 2023 13:33:39 -0400 Subject: [PATCH 6/9] opencv3WithoutCuda: remove --- pkgs/top-level/all-packages.nix | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e2930432b297..9b64e0a4b086 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24325,10 +24325,6 @@ with pkgs; ffmpeg = ffmpeg_4; }; - opencv3WithoutCuda = opencv3.override { - enableCuda = false; - }; - opencv4 = callPackage ../development/libraries/opencv/4.x.nix { inherit (darwin.apple_sdk.frameworks) AVFoundation Cocoa VideoDecodeAcceleration CoreMedia MediaToolbox Accelerate; From 339418713e3ee42263d0e3639d0c6a6a092f2307 Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Sat, 23 Sep 2023 17:37:58 -0400 Subject: [PATCH 7/9] gmic-qt: remove apparently unused opencv3 dependency --- pkgs/tools/graphics/gmic-qt/default.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/tools/graphics/gmic-qt/default.nix b/pkgs/tools/graphics/gmic-qt/default.nix index 0a2ebd770994..fdff56a446dc 100644 --- a/pkgs/tools/graphics/gmic-qt/default.nix +++ b/pkgs/tools/graphics/gmic-qt/default.nix @@ -17,7 +17,6 @@ , libtiff , ninja , nix-update -, opencv3 , openexr , pkg-config , qtbase @@ -78,7 +77,6 @@ stdenv.mkDerivation (finalAttrs: { libjpeg libtiff libpng - opencv3 openexr graphicsmagick curl From 2fbd1b97f1364a1064e68c179ad472551ccdad80 Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Sat, 23 Sep 2023 18:26:10 -0400 Subject: [PATCH 8/9] video2midi: opencv3 -> opencv4 --- pkgs/tools/audio/video2midi/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/audio/video2midi/default.nix b/pkgs/tools/audio/video2midi/default.nix index f8c50fda29c3..2c2ea77de6e7 100644 --- a/pkgs/tools/audio/video2midi/default.nix +++ b/pkgs/tools/audio/video2midi/default.nix @@ -1,7 +1,7 @@ -{ lib, fetchFromGitHub, pythonPackages, opencv3 }: +{ lib, fetchFromGitHub, pythonPackages, opencv4 }: let - opencv3_ = pythonPackages.toPythonModule (opencv3.override { + opencv4_ = pythonPackages.toPythonModule (opencv4.override { inherit pythonPackages; enablePython = true; enableFfmpeg = true; @@ -19,7 +19,7 @@ in pythonPackages.buildPythonApplication rec { sha256 = "0qzrxqhsxn0h71nfrsi9g78hx3pqm3b8sr6fjq01k4k6dd2nwfam"; }; - propagatedBuildInputs = with pythonPackages; [ opencv3_ midiutil pygame pyopengl ]; + propagatedBuildInputs = with pythonPackages; [ opencv4_ midiutil pygame pyopengl ]; installPhase = '' install -Dm755 v2m.py $out/bin/v2m.py From 381e03e03a1fc4b83c2a94d83898f4a3dd6abf8c Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Sat, 23 Sep 2023 18:30:01 -0400 Subject: [PATCH 9/9] waifu2x-converter-cpp: opencv3 -> opencv4 --- pkgs/tools/graphics/waifu2x-converter-cpp/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/graphics/waifu2x-converter-cpp/default.nix b/pkgs/tools/graphics/waifu2x-converter-cpp/default.nix index 56fe4e122e53..f936ab83fb56 100644 --- a/pkgs/tools/graphics/waifu2x-converter-cpp/default.nix +++ b/pkgs/tools/graphics/waifu2x-converter-cpp/default.nix @@ -1,4 +1,4 @@ -{ cmake, fetchFromGitHub, makeWrapper, opencv3, lib, stdenv, ocl-icd, opencl-headers, OpenCL +{ cmake, fetchFromGitHub, makeWrapper, opencv4, lib, stdenv, ocl-icd, opencl-headers, OpenCL , config , cudaSupport ? config.cudaSupport, cudatoolkit ? null }: @@ -20,7 +20,7 @@ stdenv.mkDerivation rec { ]; buildInputs = [ - opencv3 + opencv4 ] ++ lib.optional cudaSupport cudatoolkit ++ lib.optional stdenv.isDarwin OpenCL ++ lib.optionals stdenv.isLinux [ ocl-icd opencl-headers ];