[v2,1/1] wampcc: needs atomic

Message ID 20180710182740.10902-1-fontaine.fabrice@gmail.com
State Accepted
Headers show
Series
  • [v2,1/1] wampcc: needs atomic
Related show

Commit Message

Fabrice Fontaine July 10, 2018, 6:27 p.m.
Fixes:
 - http://autobuild.buildroot.net/results/2f994762d4e01a904c50cf2728a4103e6e79da2a

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
Changes v1 -> v2 (after review of Thomas Petazzoni):
 - Add BR2_TOOLCHAIN_HAS_ATOMIC in Config.in

 package/wampcc/Config.in | 3 +++
 package/wampcc/wampcc.mk | 5 +++++
 2 files changed, 8 insertions(+)

Comments

Thomas Petazzoni July 16, 2018, 2:30 p.m. | #1
Hello,

On Tue, 10 Jul 2018 20:27:40 +0200, Fabrice Fontaine wrote:
> Fixes:
>  - http://autobuild.buildroot.net/results/2f994762d4e01a904c50cf2728a4103e6e79da2a
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
> Changes v1 -> v2 (after review of Thomas Petazzoni):
>  - Add BR2_TOOLCHAIN_HAS_ATOMIC in Config.in

Applied to master, thanks. I believe there's probably quite a few
packages that link with -latomic if BR2_TOOLCHAIN_HAS_LIBATOMIC=y, but
don't depend on BR2_TOOLCHAIN_HAS_ATOMIC. However, it's not as simple
as adding "depends on BR2_TOOLCHAIN_HAS_ATOMIC" to all packages that
link with -latomic, because some packages can use either __sync or
__atomic built-ins.

Best regards,

Thomas

Patch

diff --git a/package/wampcc/Config.in b/package/wampcc/Config.in
index 9cf7d99dfe..92abc9cb25 100644
--- a/package/wampcc/Config.in
+++ b/package/wampcc/Config.in
@@ -4,6 +4,7 @@  config BR2_PACKAGE_WAMPCC
 	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL # libuv
 	depends on BR2_USE_MMU # libuv
 	depends on !BR2_STATIC_LIBS # libuv
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # libuv
 	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # std::shared_future
 	select BR2_PACKAGE_LIBUV
@@ -17,11 +18,13 @@  config BR2_PACKAGE_WAMPCC
 
 comment "wampcc needs a toolchain w/ C++, NPTL, dynamic library"
 	depends on BR2_USE_MMU
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_INSTALL_LIBSTDCPP || \
 		!BR2_TOOLCHAIN_HAS_THREADS_NPTL || BR2_STATIC_LIBS
 
 comment "wampcc needs a toolchain not affected by GCC bug 64735"
 	depends on BR2_USE_MMU
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on BR2_TOOLCHAIN_HAS_GCC_BUG_64735
diff --git a/package/wampcc/wampcc.mk b/package/wampcc/wampcc.mk
index d8e093f679..dcd65f49d5 100644
--- a/package/wampcc/wampcc.mk
+++ b/package/wampcc/wampcc.mk
@@ -11,4 +11,9 @@  WAMPCC_INSTALL_STAGING = YES
 WAMPCC_LICENSE = MIT
 WAMPCC_LICENSE_FILES = LICENSE
 
+# Uses __atomic_fetch_add_8
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+WAMPCC_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -latomic"
+endif
+
 $(eval $(cmake-package))