[RFC,2/2] package/libcap: fix build failure on ARC targets

Message ID 20241003162629.470273-2-dario.binacchi@amarulasolutions.com
State New
Headers show
Series
  • [RFC,1/2] toolchain: add BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET option
Related show

Commit Message

Dario Binacchi Oct. 3, 2024, 4:26 p.m. UTC
Building arp-scan with --with-libcap for the ARC target raises the
following error:

configure:5053: checking for cap_set_proc in -lcap

cap_proc.c:(.text+0x78): undefined reference to `__atomic_test_and_set'

configure:5086: result: no
configure:5097: error: libcap support was requested but the library was not found

The patch adds the dependency on BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET
to libcap.

Additionally, besides libcap, it was necessary to add the dependency on
BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET to other packages to remove
warnings of this type:

WARNING: unmet direct dependencies detected for BR2_PACKAGE_LIBCAP
  Depends on [n]: BR2_USE_MMU [=y] && BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET [=n]
  Selected by [y]:
  - BR2_PACKAGE_RNG_TOOLS [=y] && BR2_TOOLCHAIN_HAS_THREADS_NPTL [=y] && BR2_USE_MMU [=y]

WARNING: unmet direct dependencies detected for BR2_PACKAGE_LIBCAP
  Depends on [n]: BR2_USE_MMU [=y] && BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET [=n]
  Selected by [y]:
  - BR2_PACKAGE_RNG_TOOLS [=y] && BR2_TOOLCHAIN_HAS_THREADS_NPTL [=y] && BR2_USE_MMU [=y]

Fixes:
- http://autobuild.buildroot.net/results/66ee26677777124eafb4740a3c7437e06f704f98

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
 package/bubblewrap/Config.in  | 1 +
 package/cdrkit/Config.in      | 1 +
 package/chrony/Config.in      | 1 +
 package/criu/Config.in        | 1 +
 package/libcap/Config.in      | 1 +
 package/ntpsec/Config.in      | 1 +
 package/proftpd/Config.in     | 1 +
 package/rng-tools/Config.in   | 2 +-
 package/slirp4netns/Config.in | 1 +
 package/squid/Config.in       | 1 +
 package/systemd/Config.in     | 1 +
 package/vdr/Config.in         | 1 +
 12 files changed, 12 insertions(+), 1 deletion(-)

Patch

diff --git a/package/bubblewrap/Config.in b/package/bubblewrap/Config.in
index 2492cee0e564..95aa171b46b0 100644
--- a/package/bubblewrap/Config.in
+++ b/package/bubblewrap/Config.in
@@ -1,6 +1,7 @@ 
 config BR2_PACKAGE_BUBBLEWRAP
 	bool "bubblewrap"
 	depends on BR2_USE_MMU # fork()
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET # libcap
 	select BR2_PACKAGE_LIBCAP
 	help
 	  Unprivileged sandbox tool based on Linux namespaces.
diff --git a/package/cdrkit/Config.in b/package/cdrkit/Config.in
index b3ddcbd13540..8b6ed6984993 100644
--- a/package/cdrkit/Config.in
+++ b/package/cdrkit/Config.in
@@ -1,6 +1,7 @@ 
 config BR2_PACKAGE_CDRKIT
 	bool "cdrkit"
 	depends on BR2_USE_MMU # fork
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET # libcap
 	# Needed for libbz
 	select BR2_PACKAGE_BZIP2
 	select BR2_PACKAGE_LIBCAP
diff --git a/package/chrony/Config.in b/package/chrony/Config.in
index c22b756c113f..2784d20516ce 100644
--- a/package/chrony/Config.in
+++ b/package/chrony/Config.in
@@ -1,6 +1,7 @@ 
 config BR2_PACKAGE_CHRONY
 	bool "chrony"
 	depends on BR2_USE_MMU # fork()
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET # libcap
 	select BR2_PACKAGE_LIBCAP
 	help
 	  Chrony is a pair of programs which are used to maintain the
diff --git a/package/criu/Config.in b/package/criu/Config.in
index 30b131cd30a6..913583cfee96 100644
--- a/package/criu/Config.in
+++ b/package/criu/Config.in
@@ -26,6 +26,7 @@  config BR2_PACKAGE_CRIU
 	depends on BR2_INSTALL_LIBSTDCPP # protobuf
 	depends on BR2_TOOLCHAIN_HAS_THREADS # protobuf, libnl
 	depends on BR2_USE_WCHAR # libbsd
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET # libcap
 	select BR2_PACKAGE_HOST_PYTHON3
 	select BR2_PACKAGE_HOST_PYTHON3_SSL
 	select BR2_PACKAGE_PROTOBUF
diff --git a/package/libcap/Config.in b/package/libcap/Config.in
index e1971b7bb15a..b0379d8f5094 100644
--- a/package/libcap/Config.in
+++ b/package/libcap/Config.in
@@ -1,6 +1,7 @@ 
 config BR2_PACKAGE_LIBCAP
 	bool "libcap"
 	depends on BR2_USE_MMU # fork()
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET
 	help
 	  This library implements the user-space interfaces to the
 	  POSIX 1003.1e capabilities available in Linux kernels. These
diff --git a/package/ntpsec/Config.in b/package/ntpsec/Config.in
index 3b20daecc77a..9135527c238a 100644
--- a/package/ntpsec/Config.in
+++ b/package/ntpsec/Config.in
@@ -4,6 +4,7 @@  config BR2_PACKAGE_NTPSEC
 	depends on BR2_USE_WCHAR # python3
 	depends on BR2_TOOLCHAIN_HAS_THREADS # python3
 	depends on !BR2_STATIC_LIBS # python3
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET # libcap
 	select BR2_PACKAGE_LIBCAP
 	select BR2_PACKAGE_OPENSSL
 	select BR2_PACKAGE_PYTHON3
diff --git a/package/proftpd/Config.in b/package/proftpd/Config.in
index 9d99ff70c485..f82c2c460029 100644
--- a/package/proftpd/Config.in
+++ b/package/proftpd/Config.in
@@ -12,6 +12,7 @@  if BR2_PACKAGE_PROFTPD
 
 config BR2_PACKAGE_PROFTPD_MOD_CAP
 	bool "mod_cap support"
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET # libcap
 	select BR2_PACKAGE_LIBCAP
 	help
 	  Compile ProFTPD with mod_cap support
diff --git a/package/rng-tools/Config.in b/package/rng-tools/Config.in
index 7f08fa25fbf7..cc11484aefd9 100644
--- a/package/rng-tools/Config.in
+++ b/package/rng-tools/Config.in
@@ -2,7 +2,7 @@  config BR2_PACKAGE_RNG_TOOLS
 	bool "rng-tools"
 	# pthread_setaffinity_np
 	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
-	depends on BR2_USE_MMU # libcap
+	depends on BR2_USE_MMU && BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET # libcap
 	select BR2_PACKAGE_ARGP_STANDALONE if BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_MUSL
 	select BR2_PACKAGE_LIBCAP
 	select BR2_PACKAGE_OPENSSL
diff --git a/package/slirp4netns/Config.in b/package/slirp4netns/Config.in
index 22414dfbc972..9103eea70cbc 100644
--- a/package/slirp4netns/Config.in
+++ b/package/slirp4netns/Config.in
@@ -5,6 +5,7 @@  config BR2_PACKAGE_SLIRP4NETNS
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libglib2, slirp
 	depends on BR2_PACKAGE_LIBSECCOMP_ARCH_SUPPORTS # libseccomp
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_17 # libseccomp
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET # libcap
 	select BR2_PACKAGE_LIBCAP
 	select BR2_PACKAGE_LIBGLIB2
 	select BR2_PACKAGE_LIBSECCOMP
diff --git a/package/squid/Config.in b/package/squid/Config.in
index ab13e735e114..ca02c9f97ea1 100644
--- a/package/squid/Config.in
+++ b/package/squid/Config.in
@@ -15,6 +15,7 @@  config BR2_PACKAGE_SQUID
 	depends on BR2_HOST_GCC_AT_LEAST_8 # C++17
 	# needs fork()
 	depends on BR2_USE_MMU
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET # libcap
 	select BR2_PACKAGE_LIBCAP
 	select BR2_PACKAGE_LIBTOOL
 	select BR2_PACKAGE_LIBXCRYPT if BR2_TOOLCHAIN_USES_GLIBC
diff --git a/package/systemd/Config.in b/package/systemd/Config.in
index d9545e9db04f..f5ec1cc854d6 100644
--- a/package/systemd/Config.in
+++ b/package/systemd/Config.in
@@ -25,6 +25,7 @@  menuconfig BR2_PACKAGE_SYSTEMD
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_8
 	depends on BR2_HOST_GCC_AT_LEAST_8 # host-systemd
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET # libcap
 	select BR2_PACKAGE_HAS_UDEV
 	select BR2_PACKAGE_DBUS if !BR2_PACKAGE_DBUS_BROKER # runtime
 	select BR2_PACKAGE_LIBCAP
diff --git a/package/vdr/Config.in b/package/vdr/Config.in
index 38502729a7fb..0000eac361e0 100644
--- a/package/vdr/Config.in
+++ b/package/vdr/Config.in
@@ -6,6 +6,7 @@  config BR2_PACKAGE_VDR
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_9
 	depends on BR2_USE_MMU # fork()
 	depends on BR2_USE_WCHAR
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET # libcap
 	select BR2_PACKAGE_FONTCONFIG
 	select BR2_PACKAGE_FREETYPE
 	select BR2_PACKAGE_JPEG