onnxruntime cuda support fix dlopen path

onnxruntime loads some libraries at runtime with dlopen, and needs to
know where in the nix store to look for them.
This commit is contained in:
Mitchell Pleune
2025-02-14 23:16:28 +00:00
committed by Mitchell Pleune
parent b8d3fd79ec
commit ed1db774f0
@@ -229,6 +229,11 @@ effectiveStdenv.mkDerivation rec {
postPatch = ''
substituteInPlace cmake/libonnxruntime.pc.cmake.in \
--replace-fail '$'{prefix}/@CMAKE_INSTALL_ @CMAKE_INSTALL_
# https://github.com/microsoft/onnxruntime/blob/c4f3742bb456a33ee9c826ce4e6939f8b84ce5b0/onnxruntime/core/platform/env.h#L249
substituteInPlace onnxruntime/core/platform/env.h --replace-fail \
"GetRuntimePath() const { return PathString(); }" \
"GetRuntimePath() const { return PathString(\"$out/lib/\"); }"
'' + lib.optionalString (effectiveStdenv.hostPlatform.system == "aarch64-linux") ''
# https://github.com/NixOS/nixpkgs/pull/226734#issuecomment-1663028691
rm -v onnxruntime/test/optimizer/nhwc_transformer_test.cc