Skip to contentSkip to conversation

package/grpc: add explicitly link with libatomic

PATCH New Ryan Barnett 3 participants 3 messages Dec 7, 2018 – Dec 31, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/grpc: add explicitly link with libatomic

On some architectures, you must link with libatomic, on some other architectures, they are available built-in, but in all cases, linking against libatomic does not harm.

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

---
 package/grpc/grpc.mk | 6 ++++++
 1 file changed, 6 insertions(+)
package/grpc/grpc.mk +6 -0
index 6ca6536fff..527c7fa7e2 100644
@@ -23,6 +23,12 @@ GRPC_CONF_OPTS = \
 	-DgRPC_ZLIB_PROVIDER=package \
 	-DgRPC_NATIVE_CPP_PLUGIN=$(HOST_DIR)/bin/grpc_cpp_plugin
 
+# grpc can uses __atomic builtins, so we need to link with
+# libatomic for the architectures who need libatomic.
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+GRPC_CONF_OPTS += -DCMAKE_C_STANDARD_LIBRARIES="-latomic"
+endif
+
 HOST_GRPC_CONF_OPTS = \
 	-D_gRPC_CARES_LIBRARIES=cares \
 	-DgRPC_CARES_PROVIDER=none \
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 package/grpc: add explicitly link with libatomic

Quoted 31 lines · Ryan Barnett

On some architectures, you must link with libatomic, on some other architectures, they are available built-in, but in all cases, linking against libatomic does not harm.

Fixes:

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

---
 package/grpc/grpc.mk | 6 ++++++
 1 file changed, 6 insertions(+)
package/grpc/grpc.mk +6 -1
index 6ca6536fff..527c7fa7e2 100644
@@ -23,6 +23,12 @@ GRPC_CONF_OPTS = \
        -DgRPC_ZLIB_PROVIDER=package \
        -DgRPC_NATIVE_CPP_PLUGIN=$(HOST_DIR)/bin/grpc_cpp_plugin
 
+# grpc can uses __atomic builtins, so we need to link with
+# libatomic for the architectures who need libatomic.
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+GRPC_CONF_OPTS += -DCMAKE_C_STANDARD_LIBRARIES="-latomic"
+endif
+
 HOST_GRPC_CONF_OPTS = \
        -D_gRPC_CARES_LIBRARIES=cares \
        -DgRPC_CARES_PROVIDER=none \
--
Quoted 3 lines

2.17.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20181207/f3b0fdcf/attachment.html>

#2 lore raw

PATCH 1/1 package/grpc: add explicitly link with libatomic

In reply to Ryan Barnett

Hello,

Quoted 8 lines · Ryan Barnett

On some architectures, you must link with libatomic, on some other architectures, they are available built-in, but in all cases, linking against libatomic does not harm.

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

It's a bit more complicated than that:

- If it uses atomic built-ins, one needs to "depends on BR2_TOOLCHAIN_HAS_ATOMIC"

- It can also use sync builtins.

So I've fixed that up, and applied your patch with the following changes:

[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]

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com