kumquat-buildroot/package/libcap/0002-Migrate-all-uses-of-tcapsh-static-to-sudotest-target.patch

56 lines
1.5 KiB
Diff
Raw Normal View History

package/libcap: fix static linking issues Since the bump of libcap to 2.42, host-libcap unconditionally tries to build a shared library, which fails on build machines where the static version of the C library is not available. This issue was reported upstream, who fixed it by two different commits, which are backported as patches 0001 and 0002. They require passing a DYNAMIC= value, which should be "yes" to enable dynamic linking, or empty when not using dynamic linking. However, other upstream changes broke our logic to support static-only linking for the target. So we introduce a 0003 patch which extends how the DYNAMIC flag is used to disable the build of the shared library in the libcap/ folder. This allows to greatly simplify libcap.mk. Note that the refactoring is mixed with the fix: the two are hardly splitable. We need to be able to pass the same options at all steps, and especially the staging step, otherwise some code gets compiled with the host compiler, installed in staging, and thus fails the architecture check later on. Fixes: host-libcap build failure on system without a static libc http://autobuild.buildroot.net/results/4b14458014e420ffe088f118e7d0261e67f2d551/ libcap build failure on static only systems http://autobuild.buildroot.net/results/8961759067c4639ae697b6ee5db606f098b7c7e8/ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> [yann.morin.1998@free.fr: - also pass DYNAMIC=yes at host-install step - extend commit log to explain why we refactor and fix together ] Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2020-09-09 23:02:50 +02:00
From 159d53d71c7539719b3883bbdc7b113c876a5e55 Mon Sep 17 00:00:00 2001
From: "Andrew G. Morgan" <morgan@kernel.org>
Date: Mon, 7 Sep 2020 14:02:03 -0700
Subject: [PATCH] Migrate all uses of tcapsh-static to sudotest target.
Since sudotest is mostly the reason for using a static binary, force
all uses to be under this test target.
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
go/Makefile | 6 +++---
progs/Makefile | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/go/Makefile b/go/Makefile
index 19b3e29..508b380 100644
--- a/go/Makefile
+++ b/go/Makefile
@@ -70,16 +70,16 @@ ifeq ($(CGO_REQUIRED),0)
CGO_ENABLED="1" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" GOPATH=$(GOPATH) $(GO) build -o $@-cgo $<
endif
-test: all ../progs/tcapsh-static
+test: all
CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" GOPATH="$(GOPATH)" $(GO) test $(IMPORTDIR)/psx
CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" GOPATH="$(GOPATH)" $(GO) test $(IMPORTDIR)/cap
LD_LIBRARY_PATH=../libcap ./compare-cap
+
+sudotest: test ../progs/tcapsh-static
./try-launching
ifeq ($(CGO_REQUIRED),0)
./try-launching-cgo
endif
-
-sudotest: test
sudo ./try-launching
ifeq ($(CGO_REQUIRED),0)
sudo ./try-launching-cgo
diff --git a/progs/Makefile b/progs/Makefile
index 1b27c41..f416e59 100644
--- a/progs/Makefile
+++ b/progs/Makefile
@@ -16,7 +16,7 @@ endif
DEPS=../libcap/libcap.a ../libcap/libpsx.a
-all: $(BUILD) tcapsh-static
+all: $(BUILD)
$(DEPS):
make -C ../libcap all
--
2.26.2