diff options
author | Daniël de Kok <me@danieldk.eu> | 2020-11-08 10:49:31 +0100 |
---|---|---|
committer | Daniël de Kok <me@danieldk.eu> | 2020-11-09 07:49:54 +0100 |
commit | e8721af065934457b4ebf4ca819009ab5a2cb3de (patch) | |
tree | 37fc50e9f99f13a49e2e43dc77e5b911c7dabce1 | |
parent | d36077239cd504a82788411d0a58a24a6c529fb8 (diff) |
libtorch-bin: fix CMake library paths for split outputs
The libtorch CMake files are in the `dev` output and used relative
paths to locate the shared libraries. This fails, because the
libraries are in the `out` output. This change patches the CMake files
to use library paths from `out`.
See #102146.
-rw-r--r-- | pkgs/development/libraries/science/math/libtorch/bin.nix | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pkgs/development/libraries/science/math/libtorch/bin.nix b/pkgs/development/libraries/science/math/libtorch/bin.nix index 6180c14c4d72..7c78f61af694 100644 --- a/pkgs/development/libraries/science/math/libtorch/bin.nix +++ b/pkgs/development/libraries/science/math/libtorch/bin.nix @@ -45,6 +45,14 @@ in stdenv.mkDerivation { # We do not care about Java support... rm -f $out/lib/lib*jni* 2> /dev/null || true + + # Fix up library paths for split outputs + substituteInPlace $dev/share/cmake/Torch/TorchConfig.cmake \ + --replace \''${TORCH_INSTALL_PREFIX}/lib "$out/lib" \ + + substituteInPlace \ + $dev/share/cmake/Caffe2/Caffe2Targets-release.cmake \ + --replace \''${_IMPORT_PREFIX}/lib "$out/lib" \ ''; postFixup = let |