Skip to contentSkip to conversation

fix libabseil-cpp build on older gcc versions

PATCH Superseded buildroot at heine.tech 2 participants 13 messages Oct 27, 2020 – Oct 30, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover fix libabseil-cpp build on older gcc versions

From: Michael Nosthoff <[email protected]>

This series fixes a bunch of issues with the latest libabseil version on older gcc versions.

* libabseil doesn't enforce a C++ Standard anymore but needs at least C++11. So for GCC < 6 set 11 manually.
* libabseil depends on gcc >= 4.9
* grpc depends on (host-)libabseil-cpp so depend on (host-)gcc >= 4.9

fixes

  aarch64    | host-libabseil-cpp-20200923.2  | http://autobuild.buildroot.net/results/5780d5e21e5e9c0ba86cc422ef995f45dc83cc4c
 aarch64_be  | host-libabseil-cpp-20200923.2  | http://autobuild.buildroot.net/results/8138c63fc13940e1b97f07f24752b199f88ccfa8
    arm      |    libabseil-cpp-20200923.2    | http://autobuild.buildroot.net/results/f8eda966c6400c242680db378c8944444d89d5c5
  mips64el   |    libabseil-cpp-20200923.2    | http://autobuild.buildroot.net/results/38e9427d995e16bc4876f9fdc890c42e4fd04c06
    mips     |    libabseil-cpp-20200923.2    | http://autobuild.buildroot.net/results/4e99415728a6f3c6b396a9872924262652f77996
    arm      |    libabseil-cpp-20200923.2    | http://autobuild.buildroot.net/results/1830577843772bdfd6e310b4d361aa1edf5969d6

Michael Nosthoff (3):
package/libabseil-cpp: enforce C++11 package/libabseil-cpp: depend on gcc >= 4.9 package/grpc: raise (host) gcc dependency to 4.9

 package/grpc/Config.in                 |  8 +++++---
 package/libabseil-cpp/Config.in        |  5 +++--
 package/libabseil-cpp/libabseil-cpp.mk | 10 ++++++++++
 3 files changed, 18 insertions(+), 5 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/3 package/libabseil-cpp: enforce C++11

From: Michael Nosthoff <[email protected]>

For gcc < 6 the c++ default is 98. Abseil needs at least 11 but doesn't enforce this anymore. So we need to do this.

---
 package/libabseil-cpp/libabseil-cpp.mk | 10 ++++++++++
 1 file changed, 10 insertions(+)
package/libabseil-cpp/libabseil-cpp.mk +10 -0
index dfcf892f65..8490b6d948 100644
@@ -20,5 +20,15 @@ HOST_LIBABSEIL_CPP_CONF_OPTS = \
 	-DABSL_USE_GOOGLETEST_HEAD=OFF \
 	-DABSL_RUN_TESTS=OFF
 
+# abseil needs c++ >= 11 but doesn't set this anymore,
+# before gcc6 the default is 98.
+ifeq ($(BR2_GCC_AT_LEAST_6_0),)
+LIBABSEIL_CPP_CONF_OPTS += -DCMAKE_CXX_STANDARD=11
+endif
+
+ifeq ($(BR2_HOST_GCC_AT_LEAST_6_0),)
+HOST_LIBABSEIL_CPP_CONF_OPTS += -DCMAKE_CXX_STANDARD=11
+endif
+
 $(eval $(cmake-package))
 $(eval $(host-cmake-package))
Signature · 1 line
2.25.1
#7 lore raw

PATCH 2/3 package/libabseil-cpp: depend on gcc >= 4.9

In reply to buildroot at heine.tech

From: Michael Nosthoff <[email protected]>

abseil depends on gcc >= 4.9

https://abseil.io/docs/cpp/platforms/platforms#linux

---
 package/libabseil-cpp/Config.in | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
package/libabseil-cpp/Config.in +3 -2
index 8018e7b264..222e3a092a 100644
@@ -14,6 +14,7 @@ config BR2_PACKAGE_LIBABSEIL_CPP_ARCH_SUPPORTS
 config BR2_PACKAGE_LIBABSEIL_CPP
 	bool "libabseil-cpp"
 	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on !BR2_STATIC_LIBS # uses dlfcn.h
 	depends on BR2_PACKAGE_LIBABSEIL_CPP_ARCH_SUPPORTS
@@ -26,7 +27,7 @@ config BR2_PACKAGE_LIBABSEIL_CPP
 
 	  https://github.com/abseil/abseil-cpp
 
-comment "libabseil-cpp needs a toolchain w/ C++, threads, dynamic library"
+comment "libabseil-cpp needs a toolchain w/ gcc >= 4.9, C++, threads, dynamic library"
 	depends on BR2_PACKAGE_LIBABSEIL_CPP_ARCH_SUPPORTS
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS || \
-		BR2_STATIC_LIBS
+		BR2_STATIC_LIBS || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
Signature · 1 line
2.25.1
#11 lore raw

PATCH 3/3 package/grpc: raise (host) gcc dependency to 4.9

In reply to buildroot at heine.tech

From: Michael Nosthoff <[email protected]>

(host-)libabseil-cpp depends on gcc >= 4.9

---
 package/grpc/Config.in | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
package/grpc/Config.in +5 -3
index 0270b38c35..6151f4b3d1 100644
@@ -3,7 +3,8 @@ config BR2_PACKAGE_GRPC
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_TOOLCHAIN_HAS_THREADS # protobuf, re2
 	depends on BR2_PACKAGE_PROTOBUF_ARCH_SUPPORTS # protobuf
-	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # protobuf, re2
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # protobuf, re2, libabseil-cpp
+	depends on BR2_HOST_GCC_AT_LEAST_4_9 # host-libabseil-cpp
 	depends on !BR2_STATIC_LIBS # protobuf, libabseil-cpp
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4 || BR2_TOOLCHAIN_HAS_ATOMIC
 	depends on BR2_PACKAGE_LIBABSEIL_CPP_ARCH_SUPPORTS
@@ -19,9 +20,10 @@ config BR2_PACKAGE_GRPC
 
 	  http://github.com/grpc/grpc
 
-comment "grpc needs a toolchain w/ C++, threads, dynamic library, gcc >= 4.8"
+comment "grpc needs a toolchain w/ C++, threads, dynamic library, gcc >= 4.9"
 	depends on BR2_PACKAGE_LIBABSEIL_CPP_ARCH_SUPPORTS
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4 || BR2_TOOLCHAIN_HAS_ATOMIC
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS \
-		|| BR2_STATIC_LIBS || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
+		|| BR2_STATIC_LIBS || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 \
+		|| !BR2_HOST_GCC_AT_LEAST_4_9
 	depends on BR2_PACKAGE_PROTOBUF_ARCH_SUPPORTS
Signature · 1 line
2.25.1
#2 lore raw

PATCH 1/3 package/libabseil-cpp: enforce C++11

In reply to buildroot at heine.tech
Quoted 6 lines · On Tue, 27 Oct 2020 18:40:44 +0100 Michael Nosthoff via buildroot…

From: Michael Nosthoff <[email protected]>

For gcc < 6 the c++ default is 98. Abseil needs@least 11 but doesn't enforce this anymore. So we need to do this.

Is this fixing a build issue? What was the thing that made you write this patch?

package/libabseil-cpp/libabseil-cpp.mk HOST_LIBABSEIL_CPP_CONF_OPTS = \ · line 31

Quoted 9 lines
package/libabseil-cpp/libabseil-cpp.mk +9 -0
+# abseil needs c++ >= 11 but doesn't set this anymore,
+# before gcc6 the default is 98.
+ifeq ($(BR2_GCC_AT_LEAST_6_0),)
+LIBABSEIL_CPP_CONF_OPTS += -DCMAKE_CXX_STANDARD=11
+endif
+
+ifeq ($(BR2_HOST_GCC_AT_LEAST_6_0),)
+HOST_LIBABSEIL_CPP_CONF_OPTS += -DCMAKE_CXX_STANDARD=11
+endif

Can we do it unconditionally ?

Thanks,

Thomas

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

PATCH 2/3 package/libabseil-cpp: depend on gcc >= 4.9

In reply to buildroot at heine.tech
Quoted 7 lines · On Tue, 27 Oct 2020 18:40:45 +0100 Michael Nosthoff via buildroot…

From: Michael Nosthoff <[email protected]>

abseil depends on gcc >= 4.9

https://abseil.io/docs/cpp/platforms/platforms#linux

Is this fixing a build issue ? If so, is this issue reported in the autobuilders ? If it's not fixing a build issue, what is the reason/intention behind this change ?

Thanks,

Thomas

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

PATCH 3/3 package/grpc: raise (host) gcc dependency to 4.9

In reply to buildroot at heine.tech

Hello,

Quoted 5 lines · On Tue, 27 Oct 2020 18:40:46 +0100 Michael Nosthoff via buildroot…

From: Michael Nosthoff <[email protected]>

(host-)libabseil-cpp depends on gcc >= 4.9

This must be squashed into PATCH 2/3: as soon as libabseil gains new "depends on", those "depends on" *must* be propagated to anything that has a "select BR2_PACKAGE_LIBABSEIL_CPP".

Thanks!

Thomas

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

PATCH 1/3 package/libabseil-cpp: enforce C++11

In reply to Thomas Petazzoni

Hi,

Quoted 5 lines · Thomas Petazzoni
Quoted 2 lines · On Tue, 27 Oct 2020 18:40:44 +0100 Michael Nosthoff via buildroot…

From: Michael Nosthoff <[email protected]>

Quoted 8 lines
Quoted 4 lines

For gcc < 6 the c++ default is 98. Abseil needs@least 11 but doesn't enforce this anymore. So we need to do this.

Is this fixing a build issue? What was the thing that made you write this patch?

I had the links to the broken autobuilders in the Cover letter. Should I put them in the commit instead?

Quoted 11 lines

package/libabseil-cpp/libabseil-cpp.mk HOST_LIBABSEIL_CPP_CONF_OPTS = \ · line 31

Quoted 9 lines
package/libabseil-cpp/libabseil-cpp.mk +9 -0
+# abseil needs c++ >= 11 but doesn't set this anymore,
+# before gcc6 the default is 98.
+ifeq ($(BR2_GCC_AT_LEAST_6_0),)
+LIBABSEIL_CPP_CONF_OPTS += -DCMAKE_CXX_STANDARD=11
+endif
+
+ifeq ($(BR2_HOST_GCC_AT_LEAST_6_0),)
+HOST_LIBABSEIL_CPP_CONF_OPTS += -DCMAKE_CXX_STANDARD=11
+endif

Can we do it unconditionally ?

Sure, that was the fallback before (In the CMakeLists). And grpc also just sets C++11 as fallback.

I just thought that, as abseil is all about "bringing newer C++ features to older C++ versions", it would make sense to build it with C++14/17 when it's the compilers default. But as grpc is also built with "only" C++11 this might not be the best idea in the first place.

Regards,
Michael

#9 lore raw

PATCH 2/3 package/libabseil-cpp: depend on gcc >= 4.9

In reply to Thomas Petazzoni

Hi,

Quoted 5 lines · Thomas Petazzoni

Is this fixing a build issue ? If so, is this issue reported in the autobuilders ? If it's not fixing a build issue, what is the reason/intention behind this change ?

The build with 4.8 still fails after applying the first patch of this series. As this is shadowed by the C++11 error it doesn't turn up in the autobuilders. Should I just include a build error output into the commit?

Regards,
Michael

#4 lore raw

PATCH 1/3 package/libabseil-cpp: enforce C++11

In reply to Michael Nosthoff
Quoted 4 lines · On Fri, 30 Oct 2020 08:44:06 +0100 "Michael Nosthoff" <[email protected]>…
Quoted 2 lines

Is this fixing a build issue? What was the thing that made you write this patch?

I had the links to the broken autobuilders in the Cover letter. Should I put them in the commit instead?

Sorry, I had missed the cover letters, since I'm mainly looking at patches through patchwork. And yes, the link to the autobuilder failure should be in the commit log, like this:

Fixes:

http://autobuild.buildroot.org/...

Quoted 12 lines
Quoted 11 lines

package/libabseil-cpp/libabseil-cpp.mk HOST_LIBABSEIL_CPP_CONF_OPTS = \ · line 31

Quoted 9 lines
package/libabseil-cpp/libabseil-cpp.mk +9 -0
+# abseil needs c++ >= 11 but doesn't set this anymore,
+# before gcc6 the default is 98.
+ifeq ($(BR2_GCC_AT_LEAST_6_0),)
+LIBABSEIL_CPP_CONF_OPTS += -DCMAKE_CXX_STANDARD=11
+endif
+
+ifeq ($(BR2_HOST_GCC_AT_LEAST_6_0),)
+HOST_LIBABSEIL_CPP_CONF_OPTS += -DCMAKE_CXX_STANDARD=11
+endif  

Can we do it unconditionally ?

Quoted 6 lines

Sure, that was the fallback before (In the CMakeLists). And grpc also just sets C++11 as fallback.

I just thought that, as abseil is all about "bringing newer C++ features to older C++ versions", it would make sense to build it with C++14/17 when it's the compilers default. But as grpc is also built with "only" C++11 this might not be the best idea in the first place.

In fact, let's turn this around: if abseil uses C++11 features, then it should by itself pass -std=c++11 to the compiler, by setting the appropriate CXX_STANDARD in its CMakeLists.txt. There is no reason Buildroot should have to help here. So isn't an abseil CMakeLists.txt fix (submitted upstream) more appropriate here ?

Thanks!

Thomas

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

PATCH 2/3 package/libabseil-cpp: depend on gcc >= 4.9

In reply to Michael Nosthoff

Hello,

Quoted 4 lines · On Fri, 30 Oct 2020 08:48:17 +0100 "Michael Nosthoff" <[email protected]>…

The build with 4.8 still fails after applying the first patch of this series. As this is shadowed by the C++11 error it doesn't turn up in the autobuilders. Should I just include a build error output into the commit?

Yes, and you can explained that this was shadowed by the C++11 failure, and therefore there are no recorded autobuilder failures.

Thanks!

Thomas

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

PATCH 1/3 package/libabseil-cpp: enforce C++11

In reply to Thomas Petazzoni

Hi,

Quoted 7 lines · Thomas Petazzoni

In fact, let's turn this around: if abseil uses C++11 features, then it should by itself pass -std=c++11 to the compiler, by setting the appropriate CXX_STANDARD in its CMakeLists.txt. There is no reason Buildroot should have to help here. So isn't an abseil CMakeLists.txt fix (submitted upstream) more appropriate here ?

Actually this was in abseil and they removed it intentionally in [0].
So I don't think they might have interest in picking up a patch that would reintroduce that...

Regards,
Michael

[0] https://github.com/abseil/abseil-cpp/commit/c6954897f7ece5011f0126db9117361dc1a6ff36#

#6 lore raw

PATCH 1/3 package/libabseil-cpp: enforce C++11

Quoted 2 lines · On Fri, 30 Oct 2020 09:47:42 +0100 "Michael Nosthoff" <[email protected]>…

Actually this was in abseil and they removed it intentionally in [0].
So I don't think they might have interest in picking up a patch that would reintroduce that...

Meh, ok. Then, so be it, your patch is the best we can do I guess.

Thomas

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