From 075f147ceffb84bab3eb804baa158cb9dcc3410a Mon Sep 17 00:00:00 2001 From: David Sterba Date: Thu, 24 Oct 2019 02:02:07 +0200 Subject: [PATCH] btrfs-progs: preload libbtrfs for libbtrfs-test The libbtrfs-test simulated build happens outside of the source repository, but sometimes the system library is used instead of the repo one. When -rpath does not work, force the correct library by LD_PRELOAD. Signed-off-by: David Sterba --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a19c68d1..d9c38df7 100644 --- a/Makefile +++ b/Makefile @@ -624,9 +624,10 @@ library-test: library-test.c libbtrfs.so @echo " [TEST PREP] $@"$(eval TMPD=$(shell mktemp -d)) $(Q)mkdir -p $(TMPD)/include/btrfs && \ cp $(libbtrfs_headers) $(TMPD)/include/btrfs && \ + cp libbtrfs.so.0.1 $(TMPD) && \ cd $(TMPD) && $(CC) -I$(TMPD)/include -o $@ $(addprefix $(ABSTOPDIR)/,$^) -Wl,-rpath=$(ABSTOPDIR) -lbtrfs @echo " [TEST RUN] $@" - $(Q)cd $(TMPD) && ./$@ + $(Q)cd $(TMPD) && LD_PRELOAD=libbtrfs.so.0.1 ./$@ @echo " [TEST CLEAN] $@" $(Q)$(RM) -rf -- $(TMPD)