Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Nosthoff <buildroot@heine.tech>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] package/grpc: fix build on ubuntu gcc 4.8
Date: Tue, 15 Sep 2020 18:11:07 +0200	[thread overview]
Message-ID: <20200915161107.1826-1-buildroot@heine.tech> (raw)

gcc 4.8 on ubuntu 14.04 does some broken optimization at link-time
which causes grpc to create a grpc_cpp_plugin which quits because
of a failing assertion. The created plugin is itself used during
compilation which lets the build fail.
With the added -Wl,--no-as-needed flag the LTO is disabled and grpc
compiles successfully.

fixes:
- http://autobuild.buildroot.net/results/b554f6f2fb66892273f7520ad6e36923557b229e
- http://autobuild.buildroot.net/results/3ebb2880b9b3fd5154979016391dde897e2c039c
- http://autobuild.buildroot.net/results/c2078e821e0728fe980be2c849c25d82e791a4c2

Signed-off-by: Michael Nosthoff <buildroot@heine.tech>
---
 package/grpc/grpc.mk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/package/grpc/grpc.mk b/package/grpc/grpc.mk
index 2114f98e40..4db309d4e9 100644
--- a/package/grpc/grpc.mk
+++ b/package/grpc/grpc.mk
@@ -72,5 +72,12 @@ HOST_GRPC_CONF_OPTS = \
 	-DgRPC_ZLIB_PROVIDER=package \
 	-DgRPC_ABSL_PROVIDER=package
 
+#With gcc 4.8 (at least on ubuntu) there is a bug in LTO which breaks the linkage of
+#the grpc_cpp_plugin with libprotobuf and pthread. This additional flag fixes this.
+ifeq ($(BR2_HOST_GCC_AT_LEAST_4_9),)
+HOST_GRPC_CONF_OPTS += \
+	-DCMAKE_EXE_LINKER_FLAGS="$(HOST_LDFLAGS) -Wl,--no-as-needed"
+endif
+
 $(eval $(cmake-package))
 $(eval $(host-cmake-package))
-- 
2.25.1

             reply	other threads:[~2020-09-15 16:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-15 16:11 Michael Nosthoff [this message]
2020-09-19  8:18 ` [Buildroot] [PATCH] package/grpc: fix build on ubuntu gcc 4.8 Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200915161107.1826-1-buildroot@heine.tech \
    --to=buildroot@heine.tech \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox