[oe] [meta-java][PATCH] openjdk-8: make GCC6 happy

Khem Raj raj.khem at gmail.com
Mon Jul 11 14:33:46 UTC 2016


On Mon, Jul 11, 2016 at 4:29 AM, Patrick Ohly <patrick.ohly at intel.com> wrote:
> 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?
>
> diff --git a/meta-java/recipes-core/openjdk/openjdk-8-common.inc
> b/meta-java/recipes-core/openjdk/openjdk-8-common.inc
> index dd3d397..060d828 100644
> --- a/meta-java/recipes-core/openjdk/openjdk-8-common.inc
> +++ b/meta-java/recipes-core/openjdk/openjdk-8-common.inc
> @@ -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"

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

>
> Bye, Patrick
>
> --
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel



More information about the Openembedded-devel mailing list