From 4295e225f568a61836bcb89e92aa27cbdcd4f19f Mon Sep 17 00:00:00 2001 From: Leon Schuermann Date: Tue, 4 Sep 2018 13:30:07 +0200 Subject: [PATCH] libvmi: fix libxenctrl dynamic loading (#45865) libvmi uses dlopen() to only require libxenctrl if the Xen hypervisor is used, which failed because libxenctrl could not be found. Add xen libraries to libvmi's RUNPATH using patchelf. --- pkgs/development/libraries/libvmi/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/libraries/libvmi/default.nix b/pkgs/development/libraries/libvmi/default.nix index 28cfe56d59b8..44b2a81b2d3c 100644 --- a/pkgs/development/libraries/libvmi/default.nix +++ b/pkgs/development/libraries/libvmi/default.nix @@ -15,6 +15,7 @@ with stdenv.lib; stdenv.mkDerivation rec { name = "libvmi-${version}"; version = "0.12.0"; + libVersion = "0.0.12"; src = fetchFromGitHub { owner = "libvmi"; @@ -28,6 +29,13 @@ stdenv.mkDerivation rec { configureFlags = optional (!xenSupport) "--disable-xen"; + # libvmi uses dlopen() for the xen libraries, however autoPatchelfHook doesn't work here + postFixup = optionalString xenSupport '' + libvmi="$out/lib/libvmi.so.${libVersion}" + oldrpath=$(patchelf --print-rpath "$libvmi") + patchelf --set-rpath "$oldrpath:${makeLibraryPath [ xen ]}" "$libvmi" + ''; + meta = with stdenv.lib; { homepage = "http://libvmi.com/"; description = "A C library for virtual machine introspection";