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.
This commit is contained in:
Leon Schuermann 2018-09-04 13:30:07 +02:00 committed by xeji
parent 205f3e941a
commit 4295e225f5

View File

@ -15,6 +15,7 @@ with stdenv.lib;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "libvmi-${version}"; name = "libvmi-${version}";
version = "0.12.0"; version = "0.12.0";
libVersion = "0.0.12";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "libvmi"; owner = "libvmi";
@ -28,6 +29,13 @@ stdenv.mkDerivation rec {
configureFlags = optional (!xenSupport) "--disable-xen"; 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; { meta = with stdenv.lib; {
homepage = "http://libvmi.com/"; homepage = "http://libvmi.com/";
description = "A C library for virtual machine introspection"; description = "A C library for virtual machine introspection";