Skip to contentSkip to conversation

openjdk-build-helper: Fix decoding GCC major version

PATCH In review Jacob Kroon 2 participants 7 messages Apr 30, 2020 – May 1, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 openjdk-build-helper: Fix decoding GCC major version

GCC in Fedora 32 is up to version 10, so return the whole word instead of the first letter.

---
 classes/openjdk-build-helper.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
classes/openjdk-build-helper.bbclass +1 -1
index 8d83e02..4e334c2 100644
@@ -31,7 +31,7 @@ def openjdk_build_helper_get_build_cflags(d):
         from subprocess import Popen, PIPE
         cmd = d.expand('%s -dumpversion' % build_cc).split()
         cc = Popen(cmd, stdout=PIPE, stderr=PIPE)
-        return cc.communicate()[0].decode('utf-8')[0]
+        return cc.communicate()[0].decode('utf-8').split()[0]
 
     build_cc = d.getVar('BUILD_CC')
     version = get_build_cc_version(build_cc)
Signature · 1 line
2.26.2
#1 lore raw

PATCH 2/3 icedtea7-native: Fix building with GCC 10

---
 recipes-core/icedtea/icedtea7-native.inc | 3 +++
 1 file changed, 3 insertions(+)
recipes-core/icedtea/icedtea7-native.inc +3 -0
index 8d0dc71..b0b9419 100644
@@ -28,6 +28,9 @@ CXX_append = " -std=gnu++98"
 # WORKAROUND: ignore errors from new compilers
 CFLAGS_append = " -Wno-error=stringop-overflow -Wno-error=return-type"
 
+# Explicitly pass -fcommon since GCC 10 defaults to -fno-common for C sources
+CFLAGS_append = " -fcommon"
+
 inherit native java autotools pkgconfig
 inherit openjdk-build-helper
 inherit python3native
Signature · 1 line
2.26.2
#2 lore raw

PATCH 3/3 openjdk-8: Fix building with GCC 10

In reply to Jacob Kroon
---
 recipes-core/openjdk/openjdk-8-common.inc | 4 ++++
 1 file changed, 4 insertions(+)
recipes-core/openjdk/openjdk-8-common.inc +4 -0
index d8b30b8..5228338 100644
@@ -176,6 +176,10 @@ FLAGS_GCC6 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
 FLAGS_GCC7 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
 FLAGS_GCC8 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
 FLAGS_GCC9 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
+FLAGS_GCC10 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
+
+# GCC 10 defaults to -fno-common, but OpenJDK 8 is not ready for this.
+FLAGS_GCC10_append = " -fcommon"
 
 # flags for -native, and for bits that need a host-tool during -cross
 BUILD_CFLAGS_append = " ${@openjdk_build_helper_get_build_cflags(d)}"
Signature · 1 line
2.26.2
#3 lore raw

Re: [oe] [PATCH][meta-java 3/3] openjdk-8: Fix building with GCC 10

Hi Jacob,
thanks for the patch!

Quoted 10 lines · Jacob Kroon
---
 recipes-core/openjdk/openjdk-8-common.inc | 4 ++++
 1 file changed, 4 insertions(+)
recipes-core/openjdk/openjdk-8-common.inc +0 -0
index d8b30b8..5228338 100644

recipes-core/openjdk/openjdk-8-common.inc FLAGS_GCC6 = "-fno-lifetime-dse -fno-delete-null-pointer-checks" · line 182

Quoted 7 lines
recipes-core/openjdk/openjdk-8-common.inc +4 -0
@@ -176,6 +176,10 @@ FLAGS_GCC6 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
 FLAGS_GCC7 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
 FLAGS_GCC8 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
 FLAGS_GCC9 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
+FLAGS_GCC10 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
+
+# GCC 10 defaults to -fno-common, but OpenJDK 8 is not ready for this.
+FLAGS_GCC10_append = " -fcommon"

Does setting "-fcommon" also work for GCC version > 5 and < 10? In icedtea7-native you've appended it to CFLAGS it w/o GCC version.

Background of the question is that I'm currently planning to drop support for GCC versions < 6 in the recipes. If done so, we currently have no need for version specific flags. Just want to check if that would be an exception. Thanks.

regards;rl

#4 lore raw

Re: [oe] [PATCH][meta-java 3/3] openjdk-8: Fix building with GCC 10

Quoted 25 lines · Richard Leitner

Hi Jacob,
thanks for the patch!

Quoted 10 lines · Jacob Kroon
---
  recipes-core/openjdk/openjdk-8-common.inc | 4 ++++
  1 file changed, 4 insertions(+)
recipes-core/openjdk/openjdk-8-common.inc +0 -0
index d8b30b8..5228338 100644

recipes-core/openjdk/openjdk-8-common.inc FLAGS_GCC6 = "-fno-lifetime-dse -fno-delete-null-pointer-checks" · line 182

Quoted 7 lines
recipes-core/openjdk/openjdk-8-common.inc +4 -0
@@ -176,6 +176,10 @@ FLAGS_GCC6 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
  FLAGS_GCC7 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
  FLAGS_GCC8 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
  FLAGS_GCC9 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
+FLAGS_GCC10 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
+
+# GCC 10 defaults to -fno-common, but OpenJDK 8 is not ready for this.
+FLAGS_GCC10_append = " -fcommon"

Does setting "-fcommon" also work for GCC version > 5 and < 10? In icedtea7-native you've appended it to CFLAGS it w/o GCC version.

Quoted 7 lines

Background of the question is that I'm currently planning to drop support for GCC versions < 6 in the recipes. If done so, we currently have no need for version specific flags. Just want to check if that would be an exception. Thanks.

regards;rl

A quick check shows that support for -fcommon/-fno-common exists since at least gcc 4.7.2:
https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Code-Gen-Options.html
So yes, it should work for 5 < GCC version < 10.

/Jacob

#5 lore raw

Re: [oe] [PATCH][meta-java 3/3] openjdk-8: Fix building with GCC 10

Quoted 31 lines · Jacob Kroon
Quoted 30 lines · Richard Leitner

Hi Jacob,
thanks for the patch!

Quoted 10 lines · Jacob Kroon
---
  recipes-core/openjdk/openjdk-8-common.inc | 4 ++++
  1 file changed, 4 insertions(+)
recipes-core/openjdk/openjdk-8-common.inc +0 -0
index d8b30b8..5228338 100644

recipes-core/openjdk/openjdk-8-common.inc FLAGS_GCC6 = "-fno-lifetime-dse -fno-delete-null-pointer-checks" · line 182

Quoted 7 lines
recipes-core/openjdk/openjdk-8-common.inc +4 -0
@@ -176,6 +176,10 @@ FLAGS_GCC6 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
  FLAGS_GCC7 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
  FLAGS_GCC8 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
  FLAGS_GCC9 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
+FLAGS_GCC10 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
+
+# GCC 10 defaults to -fno-common, but OpenJDK 8 is not ready for this.
+FLAGS_GCC10_append = " -fcommon"

Does setting "-fcommon" also work for GCC version > 5 and < 10? In icedtea7-native you've appended it to CFLAGS it w/o GCC version.

Background of the question is that I'm currently planning to drop support for GCC versions < 6 in the recipes. If done so, we currently have no need for version specific flags. Just want to check if that would be an exception. Thanks.

Quoted 7 lines
Quoted 2 lines

regards;rl

A quick check shows that support for -fcommon/-fno-common exists since at least gcc 4.7.2:
https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Code-Gen-Options.html
So yes, it should work for 5 < GCC version < 10.

Great. Thanks for checking.
Then I'll take your series as-it-is and will rebase my local patches on yours.

regards;rl

Quoted 2 lines

/Jacob

#6 lore raw
In reply to Jacob Kroon

Applied the whole series to master-next.
I will merge it to master after some tests. Thanks!

regards;rl

Quoted 26 lines · Jacob Kroon

GCC in Fedora 32 is up to version 10, so return the whole word instead of the first letter.

---
 classes/openjdk-build-helper.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
classes/openjdk-build-helper.bbclass +1 -1
index 8d83e02..4e334c2 100644
@@ -31,7 +31,7 @@ def openjdk_build_helper_get_build_cflags(d):
         from subprocess import Popen, PIPE
         cmd = d.expand('%s -dumpversion' % build_cc).split()
         cc = Popen(cmd, stdout=PIPE, stderr=PIPE)
-        return cc.communicate()[0].decode('utf-8')[0]
+        return cc.communicate()[0].decode('utf-8').split()[0]
 
     build_cc = d.getVar('BUILD_CC')
     version = get_build_cc_version(build_cc)
Signature · 1 line
2.26.2