Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [RFC PATCH 1/2] toolchain: add BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET option
@ 2024-10-03 16:26 Dario Binacchi
  2024-10-03 16:26 ` [Buildroot] [RFC PATCH 2/2] package/libcap: fix build failure on ARC targets Dario Binacchi
  2024-11-01  8:58 ` [Buildroot] [RFC PATCH 1/2] toolchain: add BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET option Thomas Petazzoni via buildroot
  0 siblings, 2 replies; 3+ messages in thread
From: Dario Binacchi @ 2024-10-03 16:26 UTC (permalink / raw)
  To: buildroot
  Cc: Marcus Folkesson, Raphael Pavlidis, Bernd Kuhls, Sen Hastings,
	Yann E . MORIN, Thomas Petazzoni, Adrian Perez de Castro,
	Romain Naour, Dario Binacchi, linux-amarula, Giulio Benetti,
	Norbert Lange

The build of libcap fails for ARC Targets which don't have the
ATOMICS_EXT flag set:

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 disables BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET for BR2_arc
without BR2_ARC_ATOMIC_EXT.

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

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
 toolchain/Config.in | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/toolchain/Config.in b/toolchain/Config.in
index 6e91ab756cd4..6e2856b38ae1 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -855,6 +855,11 @@ config BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_sparc
 	depends on !(BR2_arc && !BR2_ARC_ATOMIC_EXT)
 
+config BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET
+	bool
+	default y
+	depends on !(BR2_arc && !BR2_ARC_ATOMIC_EXT)
+
 # The availability of __sync for 8-byte types on ARM is somewhat
 # complicated:
 #
-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [RFC PATCH 2/2] package/libcap: fix build failure on ARC targets
  2024-10-03 16:26 [Buildroot] [RFC PATCH 1/2] toolchain: add BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET option Dario Binacchi
@ 2024-10-03 16:26 ` Dario Binacchi
  2024-11-01  8:58 ` [Buildroot] [RFC PATCH 1/2] toolchain: add BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET option Thomas Petazzoni via buildroot
  1 sibling, 0 replies; 3+ messages in thread
From: Dario Binacchi @ 2024-10-03 16:26 UTC (permalink / raw)
  To: buildroot
  Cc: Marcus Folkesson, Raphael Pavlidis, Bernd Kuhls, Sen Hastings,
	Yann E . MORIN, Thomas Petazzoni, Adrian Perez de Castro,
	Romain Naour, Dario Binacchi, linux-amarula, Giulio Benetti,
	Norbert Lange

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(-)

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
-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [RFC PATCH 1/2] toolchain: add BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET option
  2024-10-03 16:26 [Buildroot] [RFC PATCH 1/2] toolchain: add BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET option Dario Binacchi
  2024-10-03 16:26 ` [Buildroot] [RFC PATCH 2/2] package/libcap: fix build failure on ARC targets Dario Binacchi
@ 2024-11-01  8:58 ` Thomas Petazzoni via buildroot
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-11-01  8:58 UTC (permalink / raw)
  To: Dario Binacchi
  Cc: buildroot, Marcus Folkesson, Raphael Pavlidis, Bernd Kuhls,
	Sen Hastings, Yann E . MORIN, Adrian Perez de Castro,
	Romain Naour, linux-amarula, Giulio Benetti, Norbert Lange

On Thu,  3 Oct 2024 18:26:28 +0200
Dario Binacchi <dario.binacchi@amarulasolutions.com> wrote:

> The build of libcap fails for ARC Targets which don't have the
> ATOMICS_EXT flag set:
> 
> 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 disables BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET for BR2_arc
> without BR2_ARC_ATOMIC_EXT.
> 
> Fixes:
> - http://autobuild.buildroot.net/results/66ee26677777124eafb4740a3c7437e06f704f98
> 
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> ---
>  toolchain/Config.in | 5 +++++
>  1 file changed, 5 insertions(+)

Thanks for the patch, but I'm afraid this is not the right approach. We
don't want to have BR2_* options for each and every atomic_* function.
We already have BR2_TOOLCHAIN_HAS_ATOMIC which serves this purpose.
However, what you need to make sure is to link against libatomic. Could
you try this instead?

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-01  8:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-03 16:26 [Buildroot] [RFC PATCH 1/2] toolchain: add BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET option Dario Binacchi
2024-10-03 16:26 ` [Buildroot] [RFC PATCH 2/2] package/libcap: fix build failure on ARC targets Dario Binacchi
2024-11-01  8:58 ` [Buildroot] [RFC PATCH 1/2] toolchain: add BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET option Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox