From 1eb39d0ea75b8e0646bc62bbe345aa6af146f3da Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sun, 2 Nov 2025 16:38:01 +0000 Subject: [PATCH] onnxruntime: remove reference to nvcc in libonnxruntime_providers_cuda.so --- pkgs/by-name/on/onnxruntime/package.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/by-name/on/onnxruntime/package.nix b/pkgs/by-name/on/onnxruntime/package.nix index bd91c2d2584f..7325b481285f 100644 --- a/pkgs/by-name/on/onnxruntime/package.nix +++ b/pkgs/by-name/on/onnxruntime/package.nix @@ -17,6 +17,7 @@ perl, pkg-config, python3Packages, + removeReferencesTo, re2, zlib, protobuf, @@ -44,6 +45,7 @@ let stdenv = throw "Use effectiveStdenv instead"; effectiveStdenv = if cudaSupport then cudaPackages.backendStdenv else inputs.stdenv; + inherit (cudaPackages) cuda_nvcc; cudaArchitecturesString = cudaPackages.flags.cmakeCudaArchitecturesString; @@ -121,6 +123,7 @@ effectiveStdenv.mkDerivation rec { ++ lib.optionals cudaSupport [ cudaPackages.cuda_nvcc cudaPackages.cudnn-frontend + removeReferencesTo ] ++ lib.optionals isCudaJetson [ cudaPackages.autoAddCudaCompatRunpath @@ -318,6 +321,12 @@ effectiveStdenv.mkDerivation rec { ../include/onnxruntime/core/session/onnxruntime_*.h ''; + # See comments in `cudaPackages.nccl` + postFixup = lib.optionalString cudaSupport '' + remove-references-to -t "${lib.getBin cuda_nvcc}" ''${!outputLib}/lib/libonnxruntime_providers_cuda.so + ''; + disallowedRequisites = [ (lib.getBin cuda_nvcc) ]; + passthru = { inherit cudaSupport cudaPackages ncclSupport; # for the python module inherit protobuf;