pygrub: Specify -rpath LIBEXEC_LIB when building fsimage.so
authorIan Jackson <ian.jackson@citrix.com>
Fri, 22 Feb 2019 12:24:35 +0000 (12:24 +0000)
committerMaximilian Engelhardt <maxi@daemonizer.de>
Wed, 7 Dec 2022 20:02:44 +0000 (21:02 +0100)
If LIBEXEC_LIB is not on the default linker search path, the python
fsimage.so module fails to find libfsimage.so.

Add the relevant directory to the rpath explicitly.

(This situation occurs in the Debian package, where
--with-libexec-libdir is used to put each Xen version's libraries and
utilities in their own directory, to allow them to be coinstalled.)

Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
tools/pygrub/Makefile
tools/pygrub/setup.py

index 37b214621492025149530cc8793eac781f5b8038..17bdd2dbd3fc9b6bff8435b5806089b24dae5f80 100644 (file)
@@ -10,12 +10,13 @@ INSTALL_LOG = build/installed_files.txt
 all: build
 .PHONY: build
 build:
-       CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py build
+       CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" LDFLAGS="$(PY_LDFLAGS)" LIBEXEC_LIB=$(LIBEXEC_LIB) $(PYTHON) setup.py build
 
 .PHONY: install
 install: all
        $(INSTALL_DIR) $(DESTDIR)/$(bindir)
        CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" \
+               LIBEXEC_LIB=$(LIBEXEC_LIB) \
                LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py install \
                --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \
                 --root="$(DESTDIR)" --install-scripts=$(LIBEXEC_BIN) --force
index 0e4e3d02d3726425300a0d01f1b0b2f854fdd6ae..964c3ea482bcc345fc3a06646afd1acd2b9bbd49 100644 (file)
@@ -5,10 +5,15 @@ import sys
 
 extra_compile_args  = [ "-fno-strict-aliasing" ]
 
+extra_link_args = []
+try: extra_link_args += [ "-Wl,-rpath," + os.environ['LIBEXEC_LIB'] ]
+except KeyError: pass
+
 XEN_ROOT = "../.."
 
 xenfsimage = Extension("xenfsimage",
     extra_compile_args = extra_compile_args,
+    extra_link_args = extra_link_args,
     include_dirs = [ XEN_ROOT + "/tools/libfsimage/common/" ],
     library_dirs = [ XEN_ROOT + "/tools/libfsimage/common/" ],
     libraries = ["xenfsimage"],