All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-java][PATCH 1/2] classes:java: move version_specific_cflags to java.bbclass
@ 2018-08-02 14:45 Andreas Obergschwandtner
  2018-08-02 14:45 ` [meta-java][PATCH 2/2] icedtea: disable error format-overflow for gcc 7 Andreas Obergschwandtner
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Andreas Obergschwandtner @ 2018-08-02 14:45 UTC (permalink / raw)
  To: openembedded-devel

moved version_specific_cflags from openjfdk-8-common.inc to java.bbclass and
renamed it to java_version_specific_cflags because it will be used for a fix
in icedtea7

Signed-off-by: Andreas Obergschwandtner <andreas.obergschwandtner@skidata.com>
---
 classes/java.bbclass                      | 29 +++++++++++++++++++++
 recipes-core/openjdk/openjdk-8-common.inc | 31 ++---------------------
 2 files changed, 31 insertions(+), 29 deletions(-)

diff --git a/classes/java.bbclass b/classes/java.bbclass
index aa012ab..906bf8e 100644
--- a/classes/java.bbclass
+++ b/classes/java.bbclass
@@ -28,6 +28,35 @@ STAGING_LIBDIR_JVM_NATIVE ?= "${STAGING_LIBDIR_NATIVE}/jvm"
 EXTRA_OEMAKE_remove_task-compile = "${PARALLEL_MAKE}"
 EXTRA_OEMAKE_remove_task-install = "${PARALLEL_MAKEINST}"
 
+# Determine the version specific compiler flags depending on the used
+# host gcc version
+def java_version_specific_cflags(d):
+    import re
+
+    extraflags = None
+    version = None
+
+    if bb.data.inherits_class('native', d):
+        from subprocess import Popen, PIPE
+
+        cmd = d.expand('${CC} -dumpversion').split()
+        cc = Popen(cmd, stdout=PIPE, stderr=PIPE)
+        version = cc.communicate()[0].decode('utf-8')[0]
+    else:
+        # in the cross case, trust that GCCVERSION is correct. This won't
+        # work if the native toolchain is Clang, but as of this writing that
+        # doesn't work anyway.
+        version = d.getVar('GCCVERSION', expand=True)[0]
+        # skip non digit characters at the beginning, e.g. from "linaro-6.2%"
+        match = re.search("\d", version)
+        if match:
+            version = version[match.start():]
+
+    if version.isdigit():
+        extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or ''
+        return extraflags
+    return ''
+
 # OpenJDK supports parallel compilation but uses a plain number for this.
 # In OE we have PARALLEL_MAKE which is the actual option passed to make,
 # e.g. "-j 4".
diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes-core/openjdk/openjdk-8-common.inc
index 0af320d..5fae03a 100644
--- a/recipes-core/openjdk/openjdk-8-common.inc
+++ b/recipes-core/openjdk/openjdk-8-common.inc
@@ -224,33 +224,6 @@ FLAGS_GCC7 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
 # version is and only add the flags that are appropriate for that GCC
 # version.
 
-def version_specific_cflags(d):
-    import re
-
-    extraflags = None
-    version = None
-
-    if bb.data.inherits_class('native', d):
-        from subprocess import Popen, PIPE
-
-        cmd = d.expand('${CC} -dumpversion').split()
-        cc = Popen(cmd, stdout=PIPE, stderr=PIPE)
-        version = cc.communicate()[0].decode('utf-8')[0]
-    else:
-        # in the cross case, trust that GCCVERSION is correct. This won't
-        # work if the native toolchain is Clang, but as of this writing that
-        # doesn't work anyway.
-        version = d.getVar('GCCVERSION', expand=True)[0]
-        # skip non digit characters at the beginning, e.g. from "linaro-6.2%"
-        match = re.search("\d", version)
-        if match:
-            version = version[match.start():]
-
-    if version.isdigit():
-        extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or ''
-        return extraflags
-    return ''
-
-CFLAGS_append = " ${@version_specific_cflags(d)}"
-CXXFLAGS_append = " ${@version_specific_cflags(d)}"
+CFLAGS_append = " ${@java_version_specific_cflags(d)}"
+CXXFLAGS_append = " ${@java_version_specific_cflags(d)}"
 CXX_append = " -std=gnu++98"
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [meta-java][PATCH 2/2] icedtea: disable error format-overflow for gcc 7
  2018-08-02 14:45 [meta-java][PATCH 1/2] classes:java: move version_specific_cflags to java.bbclass Andreas Obergschwandtner
@ 2018-08-02 14:45 ` Andreas Obergschwandtner
  2018-08-03  7:04   ` Richard Leitner
  2018-08-03  7:04 ` [meta-java][PATCH 1/2] classes:java: move version_specific_cflags to java.bbclass Richard Leitner
  2018-08-04  9:53 ` André Draszik
  2 siblings, 1 reply; 7+ messages in thread
From: Andreas Obergschwandtner @ 2018-08-02 14:45 UTC (permalink / raw)
  To: openembedded-devel

no patch has been found in debian and hotspot repo for
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=881824. The warning was
added with gcc 7.

Signed-off-by: Andreas Obergschwandtner <andreas.obergschwandtner@skidata.com>
---
 recipes-core/icedtea/icedtea7-native.inc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/recipes-core/icedtea/icedtea7-native.inc b/recipes-core/icedtea/icedtea7-native.inc
index 93463be..453fae3 100644
--- a/recipes-core/icedtea/icedtea7-native.inc
+++ b/recipes-core/icedtea/icedtea7-native.inc
@@ -24,6 +24,14 @@ CFLAGS_append = " -fno-tree-dse"
 CXXFLAGS_append = " -fno-tree-dse"
 CXX_append = " -std=gnu++98"
 
+# Disable format-overflow error with host g++ >= 7.3.
+# Bug is reported https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=881824
+# but no patch was found for Debian.
+FLAGS_GCC7 = " -Wno-error=format-overflow"
+
+CFLAGS_append = " ${@java_version_specific_cflags(d)}"
+CXXFLAGS_append = " ${@java_version_specific_cflags(d)}"
+
 inherit native java autotools pkgconfig
 
 JAVA_HOME[unexport] = "1"
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [meta-java][PATCH 1/2] classes:java: move version_specific_cflags to java.bbclass
  2018-08-02 14:45 [meta-java][PATCH 1/2] classes:java: move version_specific_cflags to java.bbclass Andreas Obergschwandtner
  2018-08-02 14:45 ` [meta-java][PATCH 2/2] icedtea: disable error format-overflow for gcc 7 Andreas Obergschwandtner
@ 2018-08-03  7:04 ` Richard Leitner
  2018-08-04  9:53 ` André Draszik
  2 siblings, 0 replies; 7+ messages in thread
From: Richard Leitner @ 2018-08-03  7:04 UTC (permalink / raw)
  To: openembedded-devel

Hi,
this is a note to let you know that I've just added this patch to the
master-next branch of the meta-java repository at
	git://git.yoctoproject.org/meta-java

As soon as it has gone through some more testing it will likely be
merged to the master branch.

If you have any questions, please let me know.

regards;Richard.L

On 08/02/2018 04:45 PM, andreas.obergschwandtner@skidata.com wrote:
> 
> moved version_specific_cflags from openjfdk-8-common.inc to java.bbclass and
> renamed it to java_version_specific_cflags because it will be used for a fix
> in icedtea7
> 
> Signed-off-by: Andreas Obergschwandtner <andreas.obergschwandtner@skidata.com>

...


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [meta-java][PATCH 2/2] icedtea: disable error format-overflow for gcc 7
  2018-08-02 14:45 ` [meta-java][PATCH 2/2] icedtea: disable error format-overflow for gcc 7 Andreas Obergschwandtner
@ 2018-08-03  7:04   ` Richard Leitner
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Leitner @ 2018-08-03  7:04 UTC (permalink / raw)
  To: openembedded-devel

Hi,
this is a note to let you know that I've just added this patch to the
master-next branch of the meta-java repository at
	git://git.yoctoproject.org/meta-java

As soon as it has gone through some more testing it will likely be
merged to the master branch.

If you have any questions, please let me know.

regards;Richard.L

On 08/02/2018 04:45 PM, andreas.obergschwandtner@skidata.com wrote:
> 
> no patch has been found in debian and hotspot repo for
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=881824. The warning was
> added with gcc 7.
> 
> Signed-off-by: Andreas Obergschwandtner <andreas.obergschwandtner@skidata.com>

...


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [meta-java][PATCH 1/2] classes:java: move version_specific_cflags to java.bbclass
  2018-08-02 14:45 [meta-java][PATCH 1/2] classes:java: move version_specific_cflags to java.bbclass Andreas Obergschwandtner
  2018-08-02 14:45 ` [meta-java][PATCH 2/2] icedtea: disable error format-overflow for gcc 7 Andreas Obergschwandtner
  2018-08-03  7:04 ` [meta-java][PATCH 1/2] classes:java: move version_specific_cflags to java.bbclass Richard Leitner
@ 2018-08-04  9:53 ` André Draszik
  2018-08-06  6:31   ` Richard Leitner
  2 siblings, 1 reply; 7+ messages in thread
From: André Draszik @ 2018-08-04  9:53 UTC (permalink / raw)
  To: openembedded-devel

On Thu, 2018-08-02 at 16:45 +0200, Andreas Obergschwandtner wrote:
> moved version_specific_cflags from openjfdk-8-common.inc to java.bbclass
> and
> renamed it to java_version_specific_cflags because it will be used for a
> fix
> in icedtea7

Does it really make sense to have openjdk / icedtea specific flags in a
generic java class in a function with a generic name as is
java_version_specific_cflags?

Maybe it would be better to create a new class for these things instead?


Cheers,
Andre'



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [meta-java][PATCH 1/2] classes:java: move version_specific_cflags to java.bbclass
  2018-08-04  9:53 ` André Draszik
@ 2018-08-06  6:31   ` Richard Leitner
  2018-08-08  9:00     ` André Draszik
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Leitner @ 2018-08-06  6:31 UTC (permalink / raw)
  To: openembedded-devel

Hi André,
thank you for your comments!

On 08/04/2018 11:53 AM, André Draszik wrote:
> On Thu, 2018-08-02 at 16:45 +0200, Andreas Obergschwandtner wrote:
>> moved version_specific_cflags from openjfdk-8-common.inc to java.bbclass
>> and
>> renamed it to java_version_specific_cflags because it will be used for a
>> fix
>> in icedtea7
> 
> Does it really make sense to have openjdk / icedtea specific flags in a
> generic java class in a function with a generic name as is
> java_version_specific_cflags?

As far as I understood this patch the specific GCC flags are in the
openjdk/icedtea recipe (those FLAGS_GCCx which are appended to C(XX)FLAGS
using the java_version_specific_cflags function).

Therefore I think the function itself is not bound to any recipe at all as
it only checks if the flags should be set for the used GCC version.

Nonetheless a improvement which would make sense IMHO is:
 a) either getting the fact it's for GCC-only inside the function name or
    make it work for all supported compilers
 b) maybe move it to oe-core or meta-oe as it might be useful also for
    other recipes (beside java).

What do you think about it?

> 
> Maybe it would be better to create a new class for these things instead?

As mentioned above, I don't think it is openjdk/icedtea specific...
Basically it's not even java specific. IMHO it's a plain helper function
for GCC flags which are not supported in older releases of GCC. So maybe
there's really a better place to be in for this function. Any ideas?


thanks&regards;Richard.L


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [meta-java][PATCH 1/2] classes:java: move version_specific_cflags to java.bbclass
  2018-08-06  6:31   ` Richard Leitner
@ 2018-08-08  9:00     ` André Draszik
  0 siblings, 0 replies; 7+ messages in thread
From: André Draszik @ 2018-08-08  9:00 UTC (permalink / raw)
  To: Richard Leitner, openembedded-devel

Hi,

On Mon, 2018-08-06 at 08:31 +0200, Richard Leitner wrote:
> On 08/04/2018 11:53 AM, André Draszik wrote:
> > On Thu, 2018-08-02 at 16:45 +0200, Andreas Obergschwandtner wrote:
> > > moved version_specific_cflags from openjfdk-8-common.inc to
> > > java.bbclass
> > > and
> > > renamed it to java_version_specific_cflags because it will be used for
> > > a
> > > fix
> > > in icedtea7
> > 
> > Does it really make sense to have openjdk / icedtea specific flags in a
> > generic java class in a function with a generic name as is
> > java_version_specific_cflags?
> 
> As far as I understood this patch the specific GCC flags are in the
> openjdk/icedtea recipe (those FLAGS_GCCx which are appended to C(XX)FLAGS
> using the java_version_specific_cflags function).
> 
> Therefore I think the function itself is not bound to any recipe at all as
> it only checks if the flags should be set for the used GCC version.
> 
> Nonetheless a improvement which would make sense IMHO is:
>  a) either getting the fact it's for GCC-only inside the function name or
>     make it work for all supported compilers
>  b) maybe move it to oe-core or meta-oe as it might be useful also for
>     other recipes (beside java).
> 
> What do you think about it?

OK, fair enough, the commit message subject is mentioning
version_specific_cflags, and I didn't read the actual patch carefully
enough.

Still, this patch places things related to *compiling* Java itself into a
class (java.bbclass) that is meant to be used by recipes building/installing
java sources judging by the class' name.

> Maybe it would be better to create a new class for these things instead?
> 
> As mentioned above, I don't think it is openjdk/icedtea specific...
> Basically it's not even java specific. IMHO it's a plain helper function
> for GCC flags which are not supported in older releases of GCC. So maybe
> there's really a better place to be in for this function. Any ideas?

In this specific case, it's a patch against master, and it's for GCC >= 6.
Are compilers not supporting -fno-lifetime-dse -fno-delete-null-pointer-
checks (gcc 5?) even still supported by everything on master? Would it make
sense to add -fno-lifetime-dse -fno-delete-null-pointer-checks to CFLAGS
CXXFLAGS unconditionally instead?


Cheers,
Andre'



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-08-08  9:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-02 14:45 [meta-java][PATCH 1/2] classes:java: move version_specific_cflags to java.bbclass Andreas Obergschwandtner
2018-08-02 14:45 ` [meta-java][PATCH 2/2] icedtea: disable error format-overflow for gcc 7 Andreas Obergschwandtner
2018-08-03  7:04   ` Richard Leitner
2018-08-03  7:04 ` [meta-java][PATCH 1/2] classes:java: move version_specific_cflags to java.bbclass Richard Leitner
2018-08-04  9:53 ` André Draszik
2018-08-06  6:31   ` Richard Leitner
2018-08-08  9:00     ` André Draszik

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.