package/grpc: needs atomic or sync built-ins
authorRyan Barnett <ryan.barnett@rockwellcollins.com>
Fri, 7 Dec 2018 17:12:41 +0000 (11:12 -0600)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Mon, 31 Dec 2018 14:52:12 +0000 (15:52 +0100)
grpc uses atomic or sync built-ins from the compiler, so we need to
add the appropriate dependency. In addition, on some architectures,
linking with libatomic is needed to use the atomic builtins.

Fixes:

  http://autobuild.buildroot.org/results/2f208fbfe4e9da94be5b9c030dbd278cb8ba053c/

Signed-off-by: Ryan Barnett <ryan.barnett@rockwellcollins.com>
Reviewed-by: Robert Rose <robertroyrose@gmail.com>
[Thomas:
 - add the dependency on sync or atomic builtins in Config.in
 - use -DCMAKE_EXE_LINKER_FLAGS instead of
   -DCMAKE_C_STANDARD_LIBRARIES, to be consistent with what we do in
   some other cmake-based packages
 - tweak commit log]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/grpc/Config.in
package/grpc/grpc.mk

index 3b1740061268d8167d684751d954906a91e62730..2765d0fb4014feade884460a86991c87e7524ef5 100644 (file)
@@ -6,6 +6,7 @@ config BR2_PACKAGE_GRPC
        depends on BR2_HOST_GCC_AT_LEAST_4_8 # protobuf
        depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # protobuf
        depends on !BR2_STATIC_LIBS # protobuf
+       depends on BR2_TOOLCHAIN_HAS_SYNC_4 || BR2_TOOLCHAIN_HAS_ATOMIC
        select BR2_PACKAGE_C_ARES
        select BR2_PACKAGE_OPENSSL
        select BR2_PACKAGE_PROTOBUF
@@ -17,6 +18,7 @@ config BR2_PACKAGE_GRPC
          http://github.com/grpc/grpc
 
 comment "grpc needs a toolchain w/ C++, threads, dynamic library, host and target gcc >= 4.8"
+       depends on BR2_TOOLCHAIN_HAS_SYNC_4 || BR2_TOOLCHAIN_HAS_ATOMIC
        depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS \
                || BR2_STATIC_LIBS || !BR2_HOST_GCC_AT_LEAST_4_8 \
                || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
index 6ca6536fffa28aa44e3067e916d9ed1076a45ada..6c804429ffb7af4e841eedde27383c800ca49e69 100644 (file)
@@ -23,6 +23,12 @@ GRPC_CONF_OPTS = \
        -DgRPC_ZLIB_PROVIDER=package \
        -DgRPC_NATIVE_CPP_PLUGIN=$(HOST_DIR)/bin/grpc_cpp_plugin
 
+# grpc can use __atomic builtins, so we need to link with
+# libatomic when available
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+GRPC_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
+endif
+
 HOST_GRPC_CONF_OPTS = \
        -D_gRPC_CARES_LIBRARIES=cares \
        -DgRPC_CARES_PROVIDER=none \