summaryrefslogtreecommitdiffstats
path: root/libmount/python
diff options
context:
space:
mode:
authorFilipe Brandenburger2015-12-31 07:36:15 +0100
committerFilipe Brandenburger2016-01-26 22:24:25 +0100
commite61f406913fb9356aed013da7ece34e73929cff6 (patch)
treec12cb4436ec2d9ca579fe51c60228c58858bbebf /libmount/python
parenttests: make swaplabel test more robust (diff)
downloadkernel-qcow2-util-linux-e61f406913fb9356aed013da7ece34e73929cff6.tar.gz
kernel-qcow2-util-linux-e61f406913fb9356aed013da7ece34e73929cff6.tar.xz
kernel-qcow2-util-linux-e61f406913fb9356aed013da7ece34e73929cff6.zip
build-sys: Order pylibmount after usrlib on install
This fixes a failure of `make install DESTDIR=...` when trying to relink pylibmount against libmount.la. libtool will look for libmount.so under ${DESTDIR}/${libdir}, but if it is not yet present, it will assume it is a system installed library and use -lmount instead. This makes the install order significant. Automake lists the install entries in alphabetical order, and as install-pylibmountexecLTLIBRARIES < install-usrlib_execLTLIBRARIES, make will try to install pylibmount.so before libmount.so is present in the DESTDIR, which will then cause libtool to fallback to -lmount when relinking. This causes the error below: libtool: install: warning: relinking `pylibmount.la' libtool: install: (... libtool --mode=relink gcc -o pylibmount.la \ -rpath /usr/lib/python2.7/dist-packages/libmount \ libmount/python/*.lo libmount.la ... -lpython2.7 \ -inst-prefix-dir /path/to/destdir) /usr/bin/ld: cannot find -lmount collect2: error: ld returned 1 exit status libtool: install: error: relink `pylibmount.la' ... make[3]: *** [install-pylibmountexecLTLIBRARIES] Error 1 Work around this issue by using a zz_ prefix for the pylibmount exec dir, in order to install it last. This does not work if parallel make is used for the install step, but that should be a minor issue (parallel install is probably not that useful for util-linux, which is not that large a package to actually benefit from it.) The proper fix should be to introduce a make dependency of target install-pylibmountexecLTLIBRARIES on target install-usrlib_execLTLIBRARIES, but unfortunately there is no good way to accomplish that in automake without overriding it completely. This issue seems to be previously encountered in automake context, since automake includes a hack to insert such a dependency rule to install all libLTLIBRARIES before attempting to install binPROGRAMS, initially introduced in the commit below: http://git.savannah.gnu.org/cgit/automake.git/commit/?id=bd4a1d5ad1a72fa780a8b7fd6c365a5dad2e6220 Also, a related bug from Ubuntu tracker: https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/1442076 Tested that `make install` starts working again after this commit, even when libmount-dev is not installed on the system. Also confirmed that `make distcheck` is now functional. Confirmed that both __init__.py and the .so library are still installed in the Python directory. Tested that it still works without python-devel installed, also inspected Makefile.in which looks correct. Tested that `make install pylibmountexecdir=...` still works to override destination directory at `make install` time. Signed-off-by: Filipe Brandenburger <filbranden@google.com>
Diffstat (limited to 'libmount/python')
-rw-r--r--libmount/python/Makemodule.am14
1 files changed, 12 insertions, 2 deletions
diff --git a/libmount/python/Makemodule.am b/libmount/python/Makemodule.am
index 367d32472..89f756f6c 100644
--- a/libmount/python/Makemodule.am
+++ b/libmount/python/Makemodule.am
@@ -2,11 +2,21 @@ if BUILD_PYLIBMOUNT
pylibmountexecdir = $(pyexecdir)/libmount
+# Use a zz_ prefix to ensure this is last on `make install` (automake orders
+# the entries in alphabetical order) since we need to ensure that the
+# install-zz_pylibmountexecLTLIBRARIES step is only executed after the
+# install-usrlib_execLTLIBRARIES step, otherwise libtool fails to find
+# libmount under DESTDIR when it tries to relink pylibmount.so.
+#
+# Keep the pylibmountexecdir variable, in order to be backwards compatible with
+# invocation of `make install` that override that variable in the command line.
+zz_pylibmountexecdir = $(pylibmountexecdir)
+
# Please, don't use $pythondir for the scripts. We have to use the same
# directory for binary stuff as well as for the scripts otherwise it's
# not possible to install 32-bit and 64-bit version on the same system.
-pylibmountexec_LTLIBRARIES = pylibmount.la
-pylibmountexec_PYTHON = libmount/python/__init__.py
+zz_pylibmountexec_LTLIBRARIES = pylibmount.la
+zz_pylibmountexec_PYTHON = libmount/python/__init__.py
pylibmount_la_SOURCES = \
libmount/python/pylibmount.c \