Skip to contentSkip to conversation

openjdk-8: make GCC6 happy

PATCH In review Dan McGregor 5 participants 10 messages Jun 22, 2016 – Jul 18, 2016 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 openjdk-8: make GCC6 happy

From: Daniel McGregor <[email protected]>

GCC 6 sets the default C++ standard to C++14 and introduces dead store elimination by default. OpenJDK 8 is not ready for either of these changes, so set the C++ standard back to gnu++98 and disable dead store elimination.

Switched to using --with-extra-cflags, cxxflags, and ldflags. The added patch fixes building when using those flags, and are needed to get CFLAGS into the JDK build in the native case.

---
 recipes-core/openjdk/openjdk-8-common.inc          |  4 ++
 recipes-core/openjdk/openjdk-8-cross.inc           | 11 ++---
 recipes-core/openjdk/openjdk-8-native.inc          | 15 +++---
 recipes-core/openjdk/openjdk-8-release-72b05.inc   |  1 +
 .../openjdk8-avoid-early-ldflags-expansion.patch   | 53 ++++++++++++++++++++++
 5 files changed, 68 insertions(+), 16 deletions(-)
 create mode 100644 recipes-core/openjdk/patches-openjdk-8/openjdk8-avoid-early-ldflags-expansion.patch
recipes-core/openjdk/openjdk-8-common.inc +4 -0
index 3206ec4..90c20d2 100644
@@ -229,3 +229,7 @@ JDK_ARCH = "${@get_jdk_arch(d)}"
 export DEBUG_BINARIES = "true"
 
 ALTERNATIVE_PRIORITY = "50"
+
+CFLAGS_append = " -fno-lifetime-dse -fno-delete-null-pointer-checks"
+CXXFLAGS_append = " -fno-lifetime-dse -fno-delete-null-pointer-checks"
+CXX_append = " -std=gnu++98"
recipes-core/openjdk/openjdk-8-cross.inc +4 -7
index 3189764..11e94ce 100644
@@ -39,9 +39,6 @@ SRC_URI_append = "\
     file://jvm.cfg \
 "
 
-# do not use --wth-extra-cflags, it breaks building demos for jdk
-# maybe disabling demos is more reasonable than avoiding --wth-extra-cflags
-# needs discussion
 EXTRA_OECONF_append = "\
     --with-jobs=${@get_jdk8_native_jobs(d)} \
     \
@@ -53,6 +50,10 @@ EXTRA_OECONF_append = "\
     --disable-precompiled-headers \
     --disable-zip-debug-info \
     \
+    --with-extra-cflags='${CFLAGS}' \
+    --with-extra-cxxflags='${CXXFLAGS}' \
+    --with-extra-ldflags='${LDFLAGS}' \
+    \
     ${@jdk_configure_options(d)} \
 "
 
@@ -83,10 +84,6 @@ export MFLAGS="${@jdk_make_options(d)} MAKE_VERBOSE=y QUIETLY= VERBOSE=-s LOG_LE
 BUILD_LD="${BUILD_CCLD}"
 
 EXTRA_OEMAKE_append = '\
-    OE_CFLAGS="${CFLAGS}" \
-    OE_CPPFLAGS="${CPPFLAGS}" \
-    OE_CXXFLAGS="${CXXFLAGS}" \
-    OE_LDFLAGS="${LDFLAGS}" \
     ${@jdk_make_options(d)} \
     ALT_SDT_H="${STAGING_INCDIR}" \
     ALT_CUPS_HEADERS_PATH="${STAGING_INCDIR}" \
recipes-core/openjdk/openjdk-8-native.inc +6 -9
index 7a37d1a..91080d2 100644
@@ -15,15 +15,16 @@ PACKAGECONFIG[cups] = "--with-cups,,cups"
 PACKAGECONFIG[alsa] = "--with-alsa,,alsa-lib-native"
 PACKAGECONFIG[jce] = "--enable-unlimited-crypto,,"
 
-# do not use --wth-extra-cflags, it breaks building demos for jdk
-# maybe disabling demos is more reasonable than avoiding --wth-extra-cflags
-# needs discussion
 EXTRA_OECONF_append = "\
     --with-jobs=${@get_jdk8_native_jobs(d)} \
     \
     --with-sys-root=${STAGING_DIR_NATIVE} \
     --with-tools-dir=${STAGING_DIR_NATIVE} \
     --with-boot-jdk=${STAGING_LIBDIR_NATIVE}/jvm/icedtea7-native \
+    --with-extra-cflags='${CFLAGS}' \
+    --with-extra-cxxflags='${CXXFLAGS}' \
+    --with-extra-ldflags='${LDFLAGS}' \
+    --with-stdc++lib=dynamic \
     ${@jdk_configure_options(d)} \
 "
 # --with-boot-jdk=${WORKDIR}/fake-jdk
@@ -32,18 +33,14 @@ inherit native
 
 require openjdk-8-common.inc
 
-CFLAGS_append = "${@jdk_cpp_options(d)}"
+CFLAGS_append = " ${@jdk_cpp_options(d)}"
 CPPFLAGS_append = "${@jdk_cpp_options(d)}"
-CXXFLAGS_append = "${@jdk_cpp_options(d)}"
+CXXFLAGS_append = " ${@jdk_cpp_options(d)}"
 
 export MAKE_VERBOSE = "y"
 export MFLAGS="${@jdk_make_options(d)} MAKE_VERBOSE=y QUIETLY= VERBOSE=-s LOG_LEVEL=trace"
 
 EXTRA_OEMAKE_append = ' \
-    OE_CFLAGS="${CFLAGS}" \
-    OE_CPPFLAGS="${CPPFLAGS}" \
-    OE_CXXFLAGS="${CXXFLAGS}" \
-    OE_LDFLAGS="${LDFLAGS}" \
     ${@jdk_make_options(d)} \
     MAKE_VERBOSE=y VERBOSE=-s LOG_LEVEL=trace \
     QUIETLY= \
recipes-core/openjdk/openjdk-8-release-72b05.inc +1 -0
index f8ba367..ce31f3d 100644
@@ -4,6 +4,7 @@ PATCHES_URI="\
     file://dont-expect-fqpn-for-make.patch;striplevel=0 \
     file://openjdk8-no-genx11-in-headless.patch;apply=no \
     file://openjdk8-no-unused-deps.patch;apply=no \
+    file://openjdk8-avoid-early-ldflags-expansion.patch;apply=no \
     file://openjdk8-find-compiler-fix-env-respect.patch;apply=no \
     file://openjdk8-prevent-debuginfo-in-favour-of-openembedded-package-split.patch;apply=no \
 "
recipes-core/openjdk/patches-openjdk-8/openjdk8-avoid-early-ldflags-expansion.patch new file +53 -0

53 lines not on this page · raw message

Signature · 1 line
2.9.0
#1 lore raw
Quoted 10 lines · Dan McGregor <danismostlikely <at> gmail.com> writes:

From: Daniel McGregor <daniel.mcgregor <at> vecima.com>

GCC 6 sets the default C++ standard to C++14 and introduces dead store elimination by default. OpenJDK 8 is not ready for either of these changes, so set the C++ standard back to gnu++98 and disable dead store elimination.

Switched to using --with-extra-cflags, cxxflags, and ldflags. The added patch fixes building when using those flags, and are needed to get CFLAGS into the JDK build in the native case.

Has anyone tested this on a host system where gcc is still 4.x, like 4.9.2 on Debian Wheezy?

I'm finding that -fno-lifetime-dse is also getting passed to the gcc used for compiling native binaries (obviously in openjdk-8-native, but also for some helper executables in openjdk-8). This then breaks the compilation because older gcc rejects that flag.

I've briefly toyed with the patch below which worked for openjdk-8-native, but not for openjdk-8. I'm just going to work around it by staying on gcc 5.x and clearing these extra flags.

I'm not familiar enough with the openjdk-8 build process to propose a better solution, but perhaps someone else has an idea?

(quoted diff) +0 -0

b/meta-java/recipes-core/openjdk/openjdk-8-common.inc index dd3d397..060d828 100644

meta-java/recipes-core/openjdk/openjdk-8-common.inc +21 -3
@@ -237,6 +237,25 @@ EXTRA_OECONF_append = "\
         --with-update-version=${OPENJDK_UPDATE_VERSION} \
 "
 
-CFLAGS_append = " -fno-lifetime-dse -fno-delete-null-pointer-checks"
-CXXFLAGS_append = " -fno-lifetime-dse -fno-delete-null-pointer-checks"
+# GCC 6 sets the default C++ standard to C++14 and introduces dead store
+# elimination by default. OpenJDK 8 is not ready for either of these
+# changes.
+FLAGS_GCC6 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
+
+# All supported cross compilers support the compiler flags that were
+# added to make compilation with gcc6 work. But the host compiler for
+# native compilation is a different story: it may be too old (for example,
+# gcc 4.9.2 on Debian Wheezy). In that case we need to check what the
+# version is and unset the flags when gcc is not yet GCC 6.
+python () {
+    if d.getVar('PN', True).endswith('-native'):
+        import re, subprocess
+        version = subprocess.check_output(d.expand('${CC}
--version').split()).decode('utf-8')
+        m = re.search(r'^gcc.* (\d+)(\.\d+)*$', version, re.MULTILINE)
+        if m and int(m.group(1)) < 6:
+            d.setVar('FLAGS_GCC6', '')
+}
+
+CFLAGS_append = " ${FLAGS_GCC6}"
+CXXFLAGS_append = " ${FLAGS_GCC6}"

CXX_append = " -std=gnu++98"

Bye, Patrick

#2 lore raw

Hi Patrick,

Yes, same problem here. I'm using Debian Jessie with GCC 4.9.2.

Quoted 71 lines · Patrick Ohly
Quoted 10 lines · Dan McGregor <danismostlikely <at> gmail.com> writes:

From: Daniel McGregor <daniel.mcgregor <at> vecima.com>

GCC 6 sets the default C++ standard to C++14 and introduces dead store elimination by default. OpenJDK 8 is not ready for either of these changes, so set the C++ standard back to gnu++98 and disable dead store elimination.

Switched to using --with-extra-cflags, cxxflags, and ldflags. The added patch fixes building when using those flags, and are needed to get CFLAGS into the JDK build in the native case.

Has anyone tested this on a host system where gcc is still 4.x, like 4.9.2 on Debian Wheezy?

I'm finding that -fno-lifetime-dse is also getting passed to the gcc used for compiling native binaries (obviously in openjdk-8-native, but also for some helper executables in openjdk-8). This then breaks the compilation because older gcc rejects that flag.

I've briefly toyed with the patch below which worked for openjdk-8-native, but not for openjdk-8. I'm just going to work around it by staying on gcc 5.x and clearing these extra flags.

I'm not familiar enough with the openjdk-8 build process to propose a better
solution, but perhaps someone else has an idea?

meta-java/recipes-core/openjdk/openjdk-8-common.inc +21 -3
index dd3d397..060d828 100644
@@ -237,6 +237,25 @@ EXTRA_OECONF_append = "\
         --with-update-version=${OPENJDK_UPDATE_VERSION} \
 "
 
-CFLAGS_append = " -fno-lifetime-dse -fno-delete-null-pointer-checks"
-CXXFLAGS_append = " -fno-lifetime-dse -fno-delete-null-pointer-checks"
+# GCC 6 sets the default C++ standard to C++14 and introduces dead store
+# elimination by default. OpenJDK 8 is not ready for either of these
+# changes.
+FLAGS_GCC6 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
+
+# All supported cross compilers support the compiler flags that were
+# added to make compilation with gcc6 work. But the host compiler for
+# native compilation is a different story: it may be too old (for example,
+# gcc 4.9.2 on Debian Wheezy). In that case we need to check what the
+# version is and unset the flags when gcc is not yet GCC 6.
+python () {
+    if d.getVar('PN', True).endswith('-native'):
+        import re, subprocess
+        version = subprocess.check_output(d.expand('${CC}
--version').split()).decode('utf-8')
+        m = re.search(r'^gcc.* (\d+)(\.\d+)*$', version, re.MULTILINE)
+        if m and int(m.group(1)) < 6:
+            d.setVar('FLAGS_GCC6', '')
+}
+
+CFLAGS_append = " ${FLAGS_GCC6}"
+CXXFLAGS_append = " ${FLAGS_GCC6}"
 CXX_append = " -std=gnu++98"

Bye, Patrick

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

#3 lore raw
In reply to Patrick Ohly
Quoted 51 lines · Patrick Ohly
Quoted 10 lines · Dan McGregor <danismostlikely <at> gmail.com> writes:

From: Daniel McGregor <daniel.mcgregor <at> vecima.com>

GCC 6 sets the default C++ standard to C++14 and introduces dead store elimination by default. OpenJDK 8 is not ready for either of these changes, so set the C++ standard back to gnu++98 and disable dead store elimination.

Switched to using --with-extra-cflags, cxxflags, and ldflags. The added patch fixes building when using those flags, and are needed to get CFLAGS into the JDK build in the native case.

Has anyone tested this on a host system where gcc is still 4.x, like 4.9.2 on Debian Wheezy?

I'm finding that -fno-lifetime-dse is also getting passed to the gcc used for compiling native binaries (obviously in openjdk-8-native, but also for some helper executables in openjdk-8). This then breaks the compilation because older gcc rejects that flag.

I've briefly toyed with the patch below which worked for openjdk-8-native, but not for openjdk-8. I'm just going to work around it by staying on gcc 5.x and clearing these extra flags.

I'm not familiar enough with the openjdk-8 build process to propose a better solution, but perhaps someone else has an idea?

meta-java/recipes-core/openjdk/openjdk-8-common.inc +13 -2
index dd3d397..060d828 100644
@@ -237,6 +237,25 @@ EXTRA_OECONF_append = "\
         --with-update-version=${OPENJDK_UPDATE_VERSION} \
 "
 
-CFLAGS_append = " -fno-lifetime-dse -fno-delete-null-pointer-checks"
-CXXFLAGS_append = " -fno-lifetime-dse -fno-delete-null-pointer-checks"
+# GCC 6 sets the default C++ standard to C++14 and introduces dead store
+# elimination by default. OpenJDK 8 is not ready for either of these
+# changes.
+FLAGS_GCC6 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
+
+# All supported cross compilers support the compiler flags that were
+# added to make compilation with gcc6 work. But the host compiler for
+# native compilation is a different story: it may be too old (for example,
+# gcc 4.9.2 on Debian Wheezy). In that case we need to check what the
+# version is and unset the flags when gcc is not yet GCC 6.
+python () {
+    if d.getVar('PN', True).endswith('-native'):
+        import re, subprocess

meta-java/recipes-core/openjdk/openjdk-8-common.inc EXTRA_OECONF_append = "\

Quoted 10 lines
meta-java/recipes-core/openjdk/openjdk-8-common.inc +8 -1
+        version = subprocess.check_output(d.expand('${CC}
--version').split()).decode('utf-8')
+        m = re.search(r'^gcc.* (\d+)(\.\d+)*$', version, re.MULTILINE)
+        if m and int(m.group(1)) < 6:
+            d.setVar('FLAGS_GCC6', '')
+}
+
+CFLAGS_append = " ${FLAGS_GCC6}"
+CXXFLAGS_append = " ${FLAGS_GCC6}"
 CXX_append = " -std=gnu++98"

I can see this needed in several other cases too. May be this should be made a common utility

Quoted 8 lines

Bye, Patrick

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

#4 lore raw

Hi Patrick,
I tested your solution and works fine. Can you send this as a patch to list?

Thanks,

Fabio.

#5 lore raw
In reply to Khem Raj
Quoted 57 lines · Khem Raj
Quoted 56 lines · Patrick Ohly
Quoted 10 lines · Dan McGregor <danismostlikely <at> gmail.com> writes:

From: Daniel McGregor <daniel.mcgregor <at> vecima.com>

GCC 6 sets the default C++ standard to C++14 and introduces dead store elimination by default. OpenJDK 8 is not ready for either of these changes, so set the C++ standard back to gnu++98 and disable dead store elimination.

Switched to using --with-extra-cflags, cxxflags, and ldflags. The added patch fixes building when using those flags, and are needed to get CFLAGS into the JDK build in the native case.

Has anyone tested this on a host system where gcc is still 4.x, like 4.9.2 on Debian Wheezy?

I'm finding that -fno-lifetime-dse is also getting passed to the gcc used for compiling native binaries (obviously in openjdk-8-native, but also for some helper executables in openjdk-8). This then breaks the compilation because older gcc rejects that flag.

I've briefly toyed with the patch below which worked for openjdk-8-native, but not for openjdk-8. I'm just going to work around it by staying on gcc 5.x and clearing these extra flags.

I'm not familiar enough with the openjdk-8 build process to propose a better solution, but perhaps someone else has an idea?

meta-java/recipes-core/openjdk/openjdk-8-common.inc +17 -3
index dd3d397..060d828 100644
@@ -237,6 +237,25 @@ EXTRA_OECONF_append = "\
         --with-update-version=${OPENJDK_UPDATE_VERSION} \
 "
 
-CFLAGS_append = " -fno-lifetime-dse -fno-delete-null-pointer-checks"
-CXXFLAGS_append = " -fno-lifetime-dse -fno-delete-null-pointer-checks"
+# GCC 6 sets the default C++ standard to C++14 and introduces dead store
+# elimination by default. OpenJDK 8 is not ready for either of these
+# changes.
+FLAGS_GCC6 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
+
+# All supported cross compilers support the compiler flags that were
+# added to make compilation with gcc6 work. But the host compiler for
+# native compilation is a different story: it may be too old (for example,
+# gcc 4.9.2 on Debian Wheezy). In that case we need to check what the
+# version is and unset the flags when gcc is not yet GCC 6.
+python () {
+    if d.getVar('PN', True).endswith('-native'):
+        import re, subprocess
+        version = subprocess.check_output(d.expand('${CC}
--version').split()).decode('utf-8')
+        m = re.search(r'^gcc.* (\d+)(\.\d+)*$', version, re.MULTILINE)
+        if m and int(m.group(1)) < 6:
+            d.setVar('FLAGS_GCC6', '')
Quoted 8 lines

meta-java/recipes-core/openjdk/openjdk-8-common.inc EXTRA_OECONF_append = "\

Quoted 5 lines
meta-java/recipes-core/openjdk/openjdk-8-common.inc +4 -0
+}
+
+CFLAGS_append = " ${FLAGS_GCC6}"
+CXXFLAGS_append = " ${FLAGS_GCC6}"
 CXX_append = " -std=gnu++98"

I can see this needed in several other cases too. May be this should be made a common utility

I agree but this can be done after we fix meta-java case, so we can avoid a bottleneck here.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#6 lore raw
Quoted 3 lines · Otavio Salvador
Quoted 1 line · Khem Raj

On Mon, Jul 11, 2016 at 4:29 AM, Patrick Ohly <[email protected]>

Quoted 9 lines · wrote:
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines · Dan McGregor <danismostlikely <at> gmail.com> writes:

From: Daniel McGregor <daniel.mcgregor <at> vecima.com>

GCC 6 sets the default C++ standard to C++14 and introduces dead store elimination by default. OpenJDK 8 is not ready for either of these changes, so set the C++ standard back to gnu++98 and disable dead store elimination.

Switched to using --with-extra-cflags, cxxflags, and ldflags. The

added

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

patch fixes building when using those flags, and are needed to get CFLAGS into the JDK build in the native case.

Has anyone tested this on a host system where gcc is still 4.x, like

4.9.2

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

on Debian Wheezy?

I'm finding that -fno-lifetime-dse is also getting passed to the gcc

used

Quoted 1 line
Quoted 1 line
Quoted 1 line

for compiling native binaries (obviously in openjdk-8-native, but also

for

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

some helper executables in openjdk-8). This then breaks the compilation because older gcc rejects that flag.

I've briefly toyed with the patch below which worked for

openjdk-8-native,

Quoted 1 line
Quoted 1 line
Quoted 1 line

but not for openjdk-8. I'm just going to work around it by staying on

gcc

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

5.x and clearing these extra flags.

I'm not familiar enough with the openjdk-8 build process to propose a

better

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

solution, but perhaps someone else has an idea?

meta-java/recipes-core/openjdk/openjdk-8-common.inc +0 -0
index dd3d397..060d828 100644
@@ -237,6 +237,25 @@ EXTRA_OECONF_append = "\
         --with-update-version=${OPENJDK_UPDATE_VERSION} \
 "
 
Quoted 3 lines
Quoted 3 lines

meta-java/recipes-core/openjdk/openjdk-8-common.inc EXTRA_OECONF_append = "\

Quoted 3 lines
meta-java/recipes-core/openjdk/openjdk-8-common.inc +1 -2
-CFLAGS_append = " -fno-lifetime-dse -fno-delete-null-pointer-checks"
-CXXFLAGS_append = " -fno-lifetime-dse -fno-delete-null-pointer-checks"
+# GCC 6 sets the default C++ standard to C++14 and introduces dead

store

Quoted 7 lines
Quoted 7 lines

meta-java/recipes-core/openjdk/openjdk-8-common.inc EXTRA_OECONF_append = "\

Quoted 7 lines
meta-java/recipes-core/openjdk/openjdk-8-common.inc +7 -0
+# elimination by default. OpenJDK 8 is not ready for either of these
+# changes.
+FLAGS_GCC6 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
+
+# All supported cross compilers support the compiler flags that were
+# added to make compilation with gcc6 work. But the host compiler for
+# native compilation is a different story: it may be too old (for

example,

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
meta-java/recipes-core/openjdk/openjdk-8-common.inc +8 -1
+# gcc 4.9.2 on Debian Wheezy). In that case we need to check what the
+# version is and unset the flags when gcc is not yet GCC 6.
+python () {
+    if d.getVar('PN', True).endswith('-native'):
+        import re, subprocess
+        version = subprocess.check_output(d.expand('${CC}
--version').split()).decode('utf-8')
+        m = re.search(r'^gcc.* (\d+)(\.\d+)*$', version, re.MULTILINE)
+        if m and int(m.group(1)) < 6:
Quoted 8 lines
Quoted 8 lines

meta-java/recipes-core/openjdk/openjdk-8-common.inc EXTRA_OECONF_append = "\

Quoted 6 lines
meta-java/recipes-core/openjdk/openjdk-8-common.inc +5 -0
+            d.setVar('FLAGS_GCC6', '')
+}
+
+CFLAGS_append = " ${FLAGS_GCC6}"
+CXXFLAGS_append = " ${FLAGS_GCC6}"
 CXX_append = " -std=gnu++98"

I can see this needed in several other cases too. May be this should be

made

Quoted 4 lines
Quoted 1 line

a common utility

I agree but this can be done after we fix meta-java case, so we can avoid a bottleneck here.

Yup. I did know about this. I'm glad somebody found a solution.

Quoted 10 lines

--
Otavio Salvador O.S. Systems
http://www.ossystems.com.br http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

#7 lore raw
In reply to Patrick Ohly
Quoted 44 lines · Patrick Ohly
Quoted 10 lines · Dan McGregor <danismostlikely <at> gmail.com> writes:

From: Daniel McGregor <daniel.mcgregor <at> vecima.com>

GCC 6 sets the default C++ standard to C++14 and introduces dead store elimination by default. OpenJDK 8 is not ready for either of these changes, so set the C++ standard back to gnu++98 and disable dead store elimination.

Switched to using --with-extra-cflags, cxxflags, and ldflags. The added patch fixes building when using those flags, and are needed to get CFLAGS into the JDK build in the native case.

Has anyone tested this on a host system where gcc is still 4.x, like 4.9.2 on Debian Wheezy?

I'm finding that -fno-lifetime-dse is also getting passed to the gcc used for compiling native binaries (obviously in openjdk-8-native, but also for some helper executables in openjdk-8). This then breaks the compilation because older gcc rejects that flag.

I've briefly toyed with the patch below which worked for openjdk-8-native, but not for openjdk-8. I'm just going to work around it by staying on gcc 5.x and clearing these extra flags.

I'm not familiar enough with the openjdk-8 build process to propose a better solution, but perhaps someone else has an idea?

meta-java/recipes-core/openjdk/openjdk-8-common.inc +6 -2
index dd3d397..060d828 100644
@@ -237,6 +237,25 @@ EXTRA_OECONF_append = "\
         --with-update-version=${OPENJDK_UPDATE_VERSION} \
 "
 
-CFLAGS_append = " -fno-lifetime-dse -fno-delete-null-pointer-checks"
-CXXFLAGS_append = " -fno-lifetime-dse -fno-delete-null-pointer-checks"
+# GCC 6 sets the default C++ standard to C++14 and introduces dead store
+# elimination by default. OpenJDK 8 is not ready for either of these
+# changes.
+FLAGS_GCC6 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
+
+# All supported cross compilers support the compiler flags that were

meta-java/recipes-core/openjdk/openjdk-8-common.inc EXTRA_OECONF_append = "\ · line 254

Quoted 10 lines
meta-java/recipes-core/openjdk/openjdk-8-common.inc +9 -1
+# added to make compilation with gcc6 work. But the host compiler for
+# native compilation is a different story: it may be too old (for example,
+# gcc 4.9.2 on Debian Wheezy). In that case we need to check what the
+# version is and unset the flags when gcc is not yet GCC 6.
+python () {
+    if d.getVar('PN', True).endswith('-native'):
+        import re, subprocess
+        version = subprocess.check_output(d.expand('${CC}
--version').split()).decode('utf-8')
+        m = re.search(r'^gcc.* (\d+)(\.\d+)*$', version, re.MULTILINE)

This regex doesn't work in the cross case because the version string doesn't start with "gcc". It starts with '<target-triple>-gcc', so that should be checked instead.

I'll fiddle with this patch some more. It looks like a good short-term solution to building OpenJDK on GCC 4 hosts.

For my own use case, we build in a lxc container based on Poky's build-appliance, so host compiler is whatever we set it to.

Quoted 15 lines
meta-java/recipes-core/openjdk/openjdk-8-common.inc +6 -0
+        if m and int(m.group(1)) < 6:
+            d.setVar('FLAGS_GCC6', '')
+}
+
+CFLAGS_append = " ${FLAGS_GCC6}"
+CXXFLAGS_append = " ${FLAGS_GCC6}"
 CXX_append = " -std=gnu++98"

Bye, Patrick

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw
Quoted 28 lines · Dan McGregor <danismostlikely <at> gmail.com> writes:
Quoted 27 lines · On 11 July 2016 at 05:29, Patrick Ohly <patrick.ohly <at> intel.com> wrote:
Quoted 10 lines · Dan McGregor <danismostlikely <at> gmail.com> writes:

From: Daniel McGregor <daniel.mcgregor <at> vecima.com>

GCC 6 sets the default C++ standard to C++14 and introduces dead store elimination by default. OpenJDK 8 is not ready for either of these changes, so set the C++ standard back to gnu++98 and disable dead store elimination.

Switched to using --with-extra-cflags, cxxflags, and ldflags. The added patch fixes building when using those flags, and are needed to get CFLAGS into the JDK build in the native case.

Has anyone tested this on a host system where gcc is still 4.x, like 4.9.2 on Debian Wheezy?

I'm finding that -fno-lifetime-dse is also getting passed to the gcc used for compiling native binaries (obviously in openjdk-8-native, but also for some helper executables in openjdk-8). This then breaks the compilation because older gcc rejects that flag.

I've briefly toyed with the patch below which worked for openjdk-8-native, but not for openjdk-8. I'm just going to work around it by staying on gcc 5.x and clearing these extra flags.

I'm not familiar enough with the openjdk-8 build process to propose a better solution, but perhaps someone else has an idea?

[...]

Quoted 6 lines

This regex doesn't work in the cross case because the version string doesn't start with "gcc". It starts with '<target-triple>-gcc', so that should be checked instead.

I'll fiddle with this patch some more. It looks like a good short-term solution to building OpenJDK on GCC 4 hosts.

Thanks for taking this further. But please really test on such an older system, because the patch alone is not enough. Something also needs to be done when configuring openjdk-8 such that it uses different flags when invoking the host compiler (old gcc) and the target compiler (gcc 6).

I haven't found a solution for that (not familiar enough with the Java build system).

Bye, Patrick

#10 lore raw
Quoted 37 lines · Patrick Ohly
Quoted 28 lines · Dan McGregor <danismostlikely <at> gmail.com> writes:
Quoted 27 lines · On 11 July 2016 at 05:29, Patrick Ohly <patrick.ohly <at> intel.com> wrote:
Quoted 10 lines · Dan McGregor <danismostlikely <at> gmail.com> writes:

From: Daniel McGregor <daniel.mcgregor <at> vecima.com>

GCC 6 sets the default C++ standard to C++14 and introduces dead store elimination by default. OpenJDK 8 is not ready for either of these changes, so set the C++ standard back to gnu++98 and disable dead store elimination.

Switched to using --with-extra-cflags, cxxflags, and ldflags. The added patch fixes building when using those flags, and are needed to get CFLAGS into the JDK build in the native case.

Has anyone tested this on a host system where gcc is still 4.x, like 4.9.2 on Debian Wheezy?

I'm finding that -fno-lifetime-dse is also getting passed to the gcc used for compiling native binaries (obviously in openjdk-8-native, but also for some helper executables in openjdk-8). This then breaks the compilation because older gcc rejects that flag.

I've briefly toyed with the patch below which worked for openjdk-8-native, but not for openjdk-8. I'm just going to work around it by staying on gcc 5.x and clearing these extra flags.

I'm not familiar enough with the openjdk-8 build process to propose a better solution, but perhaps someone else has an idea?

[...]

Quoted 6 lines

This regex doesn't work in the cross case because the version string doesn't start with "gcc". It starts with '<target-triple>-gcc', so that should be checked instead.

I'll fiddle with this patch some more. It looks like a good short-term solution to building OpenJDK on GCC 4 hosts.

Quoted 8 lines

Thanks for taking this further. But please really test on such an older system, because the patch alone is not enough. Something also needs to be done when configuring openjdk-8 such that it uses different flags when invoking the host compiler (old gcc) and the target compiler (gcc 6).

I haven't found a solution for that (not familiar enough with the Java build system).

Will-do. It's just somewhat difficult to find one for this. I'll maybe generate a build machine based on CentOS or Debian. I wonder why it's picking non-default CFLAGS for host tools though.

I'll keep poking.

Quoted 7 lines

Bye, Patrick

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel