* [meta-java][PATCH] openjdk-8-common: Fix the issue of building failed adlc on host with gcc < 6 @ 2017-09-30 2:24 fupan.li 2017-10-03 10:14 ` [oe] " Andrew Goodbody 2018-08-09 11:04 ` André Draszik 0 siblings, 2 replies; 7+ messages in thread From: fupan.li @ 2017-09-30 2:24 UTC (permalink / raw) To: openembedded-devel From: Fupan Li <fupan.li@windriver.com> The patch recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-adlc-flags.patch had tried to fix this issue, and it tried to filter out the TARGET_FLAGS/TARGET_ CXXFLGAS, but for the flags such as "-fno-lifetime-dse" was added to CFLAGS/CXXFLAGS, directly, thus that patch failed to filter it out. To fix this issue, it's better to add those GCC version specific flags to BUILD_CFLAGS/ BUILD_CXXFLAGS and TARGET_CFLAGS/TARGET_CXXFLAGS separatedly, thus that patch can work as expected. Signed-off-by: Fupan Li <fupan.li@windriver.com> --- recipes-core/openjdk/openjdk-8-common.inc | 36 ++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes-core/openjdk/openjdk-8-common.inc index 83828e1..c609232 100644 --- a/recipes-core/openjdk/openjdk-8-common.inc +++ b/recipes-core/openjdk/openjdk-8-common.inc @@ -231,27 +231,39 @@ 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): +def version_specific_cflags(d, toolchain): extraflags = None version = None - if bb.data.inherits_class('native', d): - from subprocess import Popen, PIPE + from subprocess import Popen, PIPE + cmd = d.expand('%s -dumpversion' % toolchain ).split() + cc = Popen(cmd, stdout=PIPE, stderr=PIPE) + version = cc.communicate()[0].decode('utf-8')[0] - cmd = d.expand('${CC} -dumpversion').split() - cc = Popen(cmd, stdout=PIPE, stderr=PIPE) - version = cc.communicate()[0].decode('utf-8')[0] + if version.isdigit(): + extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' + return extraflags + return '' + +python __anonymous() { + if bb.data.inherits_class('native', d): + toolchain = d.getVar('CC', True) + extraflags = version_specific_cflags(d, toolchain) + d.appendVar("CFLAGS", ' ' + extraflags) + d.appendVar("CXXFLAGS", ' ' + extraflags) 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] - - if version.isdigit(): extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' - return extraflags - return '' + d.appendVar("TARGET_CFLAGS", ' ' + extraflags) + d.appendVar("TARGET_CXXFLAGS", ' ' + extraflags) + + toolchain = d.getVar('BUILD_CC', True) + extraflags = version_specific_cflags(d, toolchain) + d.appendVar("BUILD_CFLAGS", ' ' + extraflags) + d.appendVar("BUILD_CXXFLAGS", ' ' + extraflags) +} -CFLAGS_append = " ${@version_specific_cflags(d)}" -CXXFLAGS_append = " ${@version_specific_cflags(d)}" CXX_append = " -std=gnu++98" -- 2.11.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [oe] [meta-java][PATCH] openjdk-8-common: Fix the issue of building failed adlc on host with gcc < 6 2017-09-30 2:24 [meta-java][PATCH] openjdk-8-common: Fix the issue of building failed adlc on host with gcc < 6 fupan.li @ 2017-10-03 10:14 ` Andrew Goodbody 2017-10-09 3:06 ` fupan 2017-10-12 2:23 ` fupan 2018-08-09 11:04 ` André Draszik 1 sibling, 2 replies; 7+ messages in thread From: Andrew Goodbody @ 2017-10-03 10:14 UTC (permalink / raw) To: fupan.li, openembedded-core > -----Original Message----- > From: Fupan Li <fupan.li@windriver.com> > > The patch recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-adlc- > flags.patch > had tried to fix this issue, and it tried to filter out the > TARGET_FLAGS/TARGET_ > CXXFLGAS, but for the flags such as "-fno-lifetime-dse" was added to > CFLAGS/CXXFLAGS, > directly, thus that patch failed to filter it out. > > To fix this issue, it's better to add those GCC version specific flags to > BUILD_CFLAGS/ > BUILD_CXXFLAGS and TARGET_CFLAGS/TARGET_CXXFLAGS separatedly, > thus that patch can work > as expected. > > Signed-off-by: Fupan Li <fupan.li@windriver.com> > --- > recipes-core/openjdk/openjdk-8-common.inc | 36 > ++++++++++++++++++++----------- > 1 file changed, 24 insertions(+), 12 deletions(-) > > diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes- > core/openjdk/openjdk-8-common.inc > index 83828e1..c609232 100644 > --- a/recipes-core/openjdk/openjdk-8-common.inc > +++ b/recipes-core/openjdk/openjdk-8-common.inc > @@ -231,27 +231,39 @@ 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): > +def version_specific_cflags(d, toolchain): > extraflags = None > version = None > > - if bb.data.inherits_class('native', d): > - from subprocess import Popen, PIPE > + from subprocess import Popen, PIPE > + cmd = d.expand('%s -dumpversion' % toolchain ).split() > + cc = Popen(cmd, stdout=PIPE, stderr=PIPE) > + version = cc.communicate()[0].decode('utf-8')[0] > > - cmd = d.expand('${CC} -dumpversion').split() > - cc = Popen(cmd, stdout=PIPE, stderr=PIPE) > - version = cc.communicate()[0].decode('utf-8')[0] > + if version.isdigit(): > + extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' > + return extraflags > + return '' > + > +python __anonymous() { > + if bb.data.inherits_class('native', d): > + toolchain = d.getVar('CC', True) > + extraflags = version_specific_cflags(d, toolchain) > + d.appendVar("CFLAGS", ' ' + extraflags) > + d.appendVar("CXXFLAGS", ' ' + extraflags) > 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] > - > - if version.isdigit(): > extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' > - return extraflags > - return '' > + d.appendVar("TARGET_CFLAGS", ' ' + extraflags) > + d.appendVar("TARGET_CXXFLAGS", ' ' + extraflags) > + > + toolchain = d.getVar('BUILD_CC', True) > + extraflags = version_specific_cflags(d, toolchain) > + d.appendVar("BUILD_CFLAGS", ' ' + extraflags) > + d.appendVar("BUILD_CXXFLAGS", ' ' + extraflags) > +} > > -CFLAGS_append = " ${@version_specific_cflags(d)}" > -CXXFLAGS_append = " ${@version_specific_cflags(d)}" > CXX_append = " -std=gnu++98" > -- > 2.11.0 I get the following build failure with the above patch now, backing it out makes the build work OK. ERROR: /home/andrew/src/camol3/camol/layers/meta-java/recipes-core/openjdk/openjre-8_102b14.bb: Error executing a python function in <code>: The stack trace of python calls that resulted in this exception/failure was: File: '<code>', lineno: 13, function: <module> 0009:__anon_35__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_devshell_bbclass(d) 0010:__anon_101__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_sstate_bbclass(d) 0011:__anon_313__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_package_ipk_bbclass(d) 0012:__anon_154__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_siteinfo_bbclass(d) *** 0013:__anon_267__home_andrew_src_camol3_camol_layers_meta_java_recipes_core_openjdk_openjdk_8_common_inc(d) 0014:__anon_108__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_update_alternatives_bbclass(d) File: '/home/andrew/src/camol3/camol/layers/meta-java/recipes-core/openjdk/openjdk-8-common.inc', lineno: 260, function: __anon_267__home_andrew_src_camol3_camol_layers_meta_java_recipes_core_openjdk_openjdk_8_common_inc 0256: # work if the native toolchain is Clang, but as of this writing that 0257: # doesn't work anyway. 0258: version = d.getVar('GCCVERSION', expand=True)[0] 0259: extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' *** 0260: d.appendVar("TARGET_CFLAGS", ' ' + extraflags) 0261: d.appendVar("TARGET_CXXFLAGS", ' ' + extraflags) 0262: 0263: toolchain = d.getVar('BUILD_CC', True) 0264: extraflags = version_specific_cflags(d, toolchain) Exception: ValueError: invalid literal for int() with base 10: 'l' ERROR: Failed to parse recipe: /home/andrew/src/camol3/camol/layers/meta-java/recipes-core/openjdk/openjre-8_102b14.bb ERROR: /home/andrew/src/camol3/camol/layers/meta-java/recipes-core/openjdk/openjdk-8_102b14.bb: Error executing a python function in <code>: The stack trace of python calls that resulted in this exception/failure was: File: '<code>', lineno: 13, function: <module> 0009:__anon_35__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_devshell_bbclass(d) 0010:__anon_101__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_sstate_bbclass(d) 0011:__anon_313__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_package_ipk_bbclass(d) 0012:__anon_154__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_siteinfo_bbclass(d) *** 0013:__anon_267__home_andrew_src_camol3_camol_layers_meta_java_recipes_core_openjdk_openjdk_8_common_inc(d) 0014:__anon_108__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_update_alternatives_bbclass(d) File: '/home/andrew/src/camol3/camol/layers/meta-java/recipes-core/openjdk/openjdk-8-common.inc', lineno: 260, function: __anon_267__home_andrew_src_camol3_camol_layers_meta_java_recipes_core_openjdk_openjdk_8_common_inc 0256: # work if the native toolchain is Clang, but as of this writing that 0257: # doesn't work anyway. 0258: version = d.getVar('GCCVERSION', expand=True)[0] 0259: extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' *** 0260: d.appendVar("TARGET_CFLAGS", ' ' + extraflags) 0261: d.appendVar("TARGET_CXXFLAGS", ' ' + extraflags) 0262: 0263: toolchain = d.getVar('BUILD_CC', True) 0264: extraflags = version_specific_cflags(d, toolchain) Exception: ValueError: invalid literal for int() with base 10: 'l' Andrew ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [oe] [meta-java][PATCH] openjdk-8-common: Fix the issue of building failed adlc on host with gcc < 6 2017-10-03 10:14 ` [oe] " Andrew Goodbody @ 2017-10-09 3:06 ` fupan 2017-10-12 2:23 ` fupan 1 sibling, 0 replies; 7+ messages in thread From: fupan @ 2017-10-09 3:06 UTC (permalink / raw) To: Andrew Goodbody, openembedded-core [-- Attachment #1: Type: text/plain, Size: 7416 bytes --] On 2017/10/3 18:14, Andrew Goodbody wrote: >> -----Original Message----- >> From: Fupan Li <fupan.li@windriver.com> >> >> The patch recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-adlc- >> flags.patch >> had tried to fix this issue, and it tried to filter out the >> TARGET_FLAGS/TARGET_ >> CXXFLGAS, but for the flags such as "-fno-lifetime-dse" was added to >> CFLAGS/CXXFLAGS, >> directly, thus that patch failed to filter it out. >> >> To fix this issue, it's better to add those GCC version specific flags to >> BUILD_CFLAGS/ >> BUILD_CXXFLAGS and TARGET_CFLAGS/TARGET_CXXFLAGS separatedly, >> thus that patch can work >> as expected. >> >> Signed-off-by: Fupan Li <fupan.li@windriver.com> >> --- >> recipes-core/openjdk/openjdk-8-common.inc | 36 >> ++++++++++++++++++++----------- >> 1 file changed, 24 insertions(+), 12 deletions(-) >> >> diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes- >> core/openjdk/openjdk-8-common.inc >> index 83828e1..c609232 100644 >> --- a/recipes-core/openjdk/openjdk-8-common.inc >> +++ b/recipes-core/openjdk/openjdk-8-common.inc >> @@ -231,27 +231,39 @@ 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): >> +def version_specific_cflags(d, toolchain): >> extraflags = None >> version = None >> >> - if bb.data.inherits_class('native', d): >> - from subprocess import Popen, PIPE >> + from subprocess import Popen, PIPE >> + cmd = d.expand('%s -dumpversion' % toolchain ).split() >> + cc = Popen(cmd, stdout=PIPE, stderr=PIPE) >> + version = cc.communicate()[0].decode('utf-8')[0] >> >> - cmd = d.expand('${CC} -dumpversion').split() >> - cc = Popen(cmd, stdout=PIPE, stderr=PIPE) >> - version = cc.communicate()[0].decode('utf-8')[0] >> + if version.isdigit(): >> + extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' >> + return extraflags >> + return '' >> + >> +python __anonymous() { >> + if bb.data.inherits_class('native', d): >> + toolchain = d.getVar('CC', True) >> + extraflags = version_specific_cflags(d, toolchain) >> + d.appendVar("CFLAGS", ' ' + extraflags) >> + d.appendVar("CXXFLAGS", ' ' + extraflags) >> 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] >> - >> - if version.isdigit(): >> extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' >> - return extraflags >> - return '' >> + d.appendVar("TARGET_CFLAGS", ' ' + extraflags) >> + d.appendVar("TARGET_CXXFLAGS", ' ' + extraflags) >> + >> + toolchain = d.getVar('BUILD_CC', True) >> + extraflags = version_specific_cflags(d, toolchain) >> + d.appendVar("BUILD_CFLAGS", ' ' + extraflags) >> + d.appendVar("BUILD_CXXFLAGS", ' ' + extraflags) >> +} >> >> -CFLAGS_append = " ${@version_specific_cflags(d)}" >> -CXXFLAGS_append = " ${@version_specific_cflags(d)}" >> CXX_append = " -std=gnu++98" >> -- >> 2.11.0 Hi, Andrew Can you try this latest patch I attached? Thanks! Fupan > I get the following build failure with the above patch now, backing it out makes the build work OK. > > ERROR: /home/andrew/src/camol3/camol/layers/meta-java/recipes-core/openjdk/openjre-8_102b14.bb: Error executing a python function in <code>: > > The stack trace of python calls that resulted in this exception/failure was: > File: '<code>', lineno: 13, function: <module> > 0009:__anon_35__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_devshell_bbclass(d) > 0010:__anon_101__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_sstate_bbclass(d) > 0011:__anon_313__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_package_ipk_bbclass(d) > 0012:__anon_154__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_siteinfo_bbclass(d) > *** 0013:__anon_267__home_andrew_src_camol3_camol_layers_meta_java_recipes_core_openjdk_openjdk_8_common_inc(d) > 0014:__anon_108__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_update_alternatives_bbclass(d) > File: '/home/andrew/src/camol3/camol/layers/meta-java/recipes-core/openjdk/openjdk-8-common.inc', lineno: 260, function: __anon_267__home_andrew_src_camol3_camol_layers_meta_java_recipes_core_openjdk_openjdk_8_common_inc > 0256: # work if the native toolchain is Clang, but as of this writing that > 0257: # doesn't work anyway. > 0258: version = d.getVar('GCCVERSION', expand=True)[0] > 0259: extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' > *** 0260: d.appendVar("TARGET_CFLAGS", ' ' + extraflags) > 0261: d.appendVar("TARGET_CXXFLAGS", ' ' + extraflags) > 0262: > 0263: toolchain = d.getVar('BUILD_CC', True) > 0264: extraflags = version_specific_cflags(d, toolchain) > Exception: ValueError: invalid literal for int() with base 10: 'l' > > ERROR: Failed to parse recipe: /home/andrew/src/camol3/camol/layers/meta-java/recipes-core/openjdk/openjre-8_102b14.bb > ERROR: /home/andrew/src/camol3/camol/layers/meta-java/recipes-core/openjdk/openjdk-8_102b14.bb: Error executing a python function in <code>: > > The stack trace of python calls that resulted in this exception/failure was: > File: '<code>', lineno: 13, function: <module> > 0009:__anon_35__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_devshell_bbclass(d) > 0010:__anon_101__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_sstate_bbclass(d) > 0011:__anon_313__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_package_ipk_bbclass(d) > 0012:__anon_154__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_siteinfo_bbclass(d) > *** 0013:__anon_267__home_andrew_src_camol3_camol_layers_meta_java_recipes_core_openjdk_openjdk_8_common_inc(d) > 0014:__anon_108__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_update_alternatives_bbclass(d) > File: '/home/andrew/src/camol3/camol/layers/meta-java/recipes-core/openjdk/openjdk-8-common.inc', lineno: 260, function: __anon_267__home_andrew_src_camol3_camol_layers_meta_java_recipes_core_openjdk_openjdk_8_common_inc > 0256: # work if the native toolchain is Clang, but as of this writing that > 0257: # doesn't work anyway. > 0258: version = d.getVar('GCCVERSION', expand=True)[0] > 0259: extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' > *** 0260: d.appendVar("TARGET_CFLAGS", ' ' + extraflags) > 0261: d.appendVar("TARGET_CXXFLAGS", ' ' + extraflags) > 0262: > 0263: toolchain = d.getVar('BUILD_CC', True) > 0264: extraflags = version_specific_cflags(d, toolchain) > Exception: ValueError: invalid literal for int() with base 10: 'l' > > Andrew > [-- Attachment #2: 0001-openjdk-8-common-Fix-the-issue-of-building-failed-ad.patch --] [-- Type: text/plain, Size: 3308 bytes --] From 78929ea09f37069e7826b06bf214feb9a2b1a310 Mon Sep 17 00:00:00 2001 From: Fupan Li <fupan.li@windriver.com> Date: Fri, 29 Sep 2017 19:00:31 -0700 Subject: [PATCH] openjdk-8-common: Fix the issue of building failed adlc on host with gcc < 6 The patch recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-adlc-flags.patch had tried to fix this issue, and it tried to filter out the TARGET_FLAGS/TARGET_ CXXFLGAS, but for the flags such as "-fno-lifetime-dse" was added to CFLAGS/CXXFLAGS, directly, thus that patch failed to filter it out. To fix this issue, it's better to add those GCC version specific flags to BUILD_CFLAGS/ BUILD_CXXFLAGS and TARGET_CFLAGS/TARGET_CXXFLAGS separatedly, thus that patch can work as expected. Signed-off-by: Fupan Li <fupan.li@windriver.com> --- recipes-core/openjdk/openjdk-8-common.inc | 39 ++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes-core/openjdk/openjdk-8-common.inc index 83828e1..be35bfe 100644 --- a/recipes-core/openjdk/openjdk-8-common.inc +++ b/recipes-core/openjdk/openjdk-8-common.inc @@ -231,27 +231,40 @@ 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): +def version_specific_cflags(d, toolchain): extraflags = None version = None - if bb.data.inherits_class('native', d): - from subprocess import Popen, PIPE + from subprocess import Popen, PIPE + cmd = d.expand('%s -dumpversion' % toolchain ).split() + cc = Popen(cmd, stdout=PIPE, stderr=PIPE) + version = cc.communicate()[0].decode('utf-8')[0] - cmd = d.expand('${CC} -dumpversion').split() - cc = Popen(cmd, stdout=PIPE, stderr=PIPE) - version = cc.communicate()[0].decode('utf-8')[0] + if version.isdigit(): + extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' + return extraflags + return '' + +python __anonymous() { + if bb.data.inherits_class('native', d): + toolchain = d.getVar('CC', True) + extraflags = version_specific_cflags(d, toolchain) + d.appendVar("CFLAGS", ' ' + extraflags) + d.appendVar("CXXFLAGS", ' ' + extraflags) 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] + if version.isdigit(): + extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' + d.appendVar("TARGET_CFLAGS", ' ' + extraflags) + d.appendVar("TARGET_CXXFLAGS", ' ' + extraflags) + + toolchain = d.getVar('BUILD_CC', True) + extraflags = version_specific_cflags(d, toolchain) + d.appendVar("BUILD_CFLAGS", ' ' + extraflags) + d.appendVar("BUILD_CXXFLAGS", ' ' + extraflags) +} - 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)}" CXX_append = " -std=gnu++98" -- 2.11.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [oe] [meta-java][PATCH] openjdk-8-common: Fix the issue of building failed adlc on host with gcc < 6 2017-10-03 10:14 ` [oe] " Andrew Goodbody 2017-10-09 3:06 ` fupan @ 2017-10-12 2:23 ` fupan 1 sibling, 0 replies; 7+ messages in thread From: fupan @ 2017-10-12 2:23 UTC (permalink / raw) To: Andrew Goodbody, openembedded-core On 2017/10/3 18:14, Andrew Goodbody wrote: >> -----Original Message----- >> From: Fupan Li <fupan.li@windriver.com> >> >> The patch recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-adlc- >> flags.patch >> had tried to fix this issue, and it tried to filter out the >> TARGET_FLAGS/TARGET_ >> CXXFLGAS, but for the flags such as "-fno-lifetime-dse" was added to >> CFLAGS/CXXFLAGS, >> directly, thus that patch failed to filter it out. >> >> To fix this issue, it's better to add those GCC version specific flags to >> BUILD_CFLAGS/ >> BUILD_CXXFLAGS and TARGET_CFLAGS/TARGET_CXXFLAGS separatedly, >> thus that patch can work >> as expected. >> >> Signed-off-by: Fupan Li <fupan.li@windriver.com> >> --- >> recipes-core/openjdk/openjdk-8-common.inc | 36 >> ++++++++++++++++++++----------- >> 1 file changed, 24 insertions(+), 12 deletions(-) >> >> diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes- >> core/openjdk/openjdk-8-common.inc >> index 83828e1..c609232 100644 >> --- a/recipes-core/openjdk/openjdk-8-common.inc >> +++ b/recipes-core/openjdk/openjdk-8-common.inc >> @@ -231,27 +231,39 @@ 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): >> +def version_specific_cflags(d, toolchain): >> extraflags = None >> version = None >> >> - if bb.data.inherits_class('native', d): >> - from subprocess import Popen, PIPE >> + from subprocess import Popen, PIPE >> + cmd = d.expand('%s -dumpversion' % toolchain ).split() >> + cc = Popen(cmd, stdout=PIPE, stderr=PIPE) >> + version = cc.communicate()[0].decode('utf-8')[0] >> >> - cmd = d.expand('${CC} -dumpversion').split() >> - cc = Popen(cmd, stdout=PIPE, stderr=PIPE) >> - version = cc.communicate()[0].decode('utf-8')[0] >> + if version.isdigit(): >> + extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' >> + return extraflags >> + return '' >> + >> +python __anonymous() { >> + if bb.data.inherits_class('native', d): >> + toolchain = d.getVar('CC', True) >> + extraflags = version_specific_cflags(d, toolchain) >> + d.appendVar("CFLAGS", ' ' + extraflags) >> + d.appendVar("CXXFLAGS", ' ' + extraflags) >> 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] >> - >> - if version.isdigit(): >> extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' >> - return extraflags >> - return '' >> + d.appendVar("TARGET_CFLAGS", ' ' + extraflags) >> + d.appendVar("TARGET_CXXFLAGS", ' ' + extraflags) >> + >> + toolchain = d.getVar('BUILD_CC', True) >> + extraflags = version_specific_cflags(d, toolchain) >> + d.appendVar("BUILD_CFLAGS", ' ' + extraflags) >> + d.appendVar("BUILD_CXXFLAGS", ' ' + extraflags) >> +} >> >> -CFLAGS_append = " ${@version_specific_cflags(d)}" >> -CXXFLAGS_append = " ${@version_specific_cflags(d)}" >> CXX_append = " -std=gnu++98" >> -- >> 2.11.0 > I get the following build failure with the above patch now, backing it out makes the build work OK. Hi, Andrew What's your build host, and can you give me the steps to reproduce this issue on my side? Thanks! Fupan > > ERROR: /home/andrew/src/camol3/camol/layers/meta-java/recipes-core/openjdk/openjre-8_102b14.bb: Error executing a python function in <code>: > > The stack trace of python calls that resulted in this exception/failure was: > File: '<code>', lineno: 13, function: <module> > 0009:__anon_35__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_devshell_bbclass(d) > 0010:__anon_101__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_sstate_bbclass(d) > 0011:__anon_313__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_package_ipk_bbclass(d) > 0012:__anon_154__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_siteinfo_bbclass(d) > *** 0013:__anon_267__home_andrew_src_camol3_camol_layers_meta_java_recipes_core_openjdk_openjdk_8_common_inc(d) > 0014:__anon_108__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_update_alternatives_bbclass(d) > File: '/home/andrew/src/camol3/camol/layers/meta-java/recipes-core/openjdk/openjdk-8-common.inc', lineno: 260, function: __anon_267__home_andrew_src_camol3_camol_layers_meta_java_recipes_core_openjdk_openjdk_8_common_inc > 0256: # work if the native toolchain is Clang, but as of this writing that > 0257: # doesn't work anyway. > 0258: version = d.getVar('GCCVERSION', expand=True)[0] > 0259: extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' > *** 0260: d.appendVar("TARGET_CFLAGS", ' ' + extraflags) > 0261: d.appendVar("TARGET_CXXFLAGS", ' ' + extraflags) > 0262: > 0263: toolchain = d.getVar('BUILD_CC', True) > 0264: extraflags = version_specific_cflags(d, toolchain) > Exception: ValueError: invalid literal for int() with base 10: 'l' > > ERROR: Failed to parse recipe: /home/andrew/src/camol3/camol/layers/meta-java/recipes-core/openjdk/openjre-8_102b14.bb > ERROR: /home/andrew/src/camol3/camol/layers/meta-java/recipes-core/openjdk/openjdk-8_102b14.bb: Error executing a python function in <code>: > > The stack trace of python calls that resulted in this exception/failure was: > File: '<code>', lineno: 13, function: <module> > 0009:__anon_35__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_devshell_bbclass(d) > 0010:__anon_101__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_sstate_bbclass(d) > 0011:__anon_313__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_package_ipk_bbclass(d) > 0012:__anon_154__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_siteinfo_bbclass(d) > *** 0013:__anon_267__home_andrew_src_camol3_camol_layers_meta_java_recipes_core_openjdk_openjdk_8_common_inc(d) > 0014:__anon_108__home_andrew_src_camol3_camol_layers_openembedded_core_meta_classes_update_alternatives_bbclass(d) > File: '/home/andrew/src/camol3/camol/layers/meta-java/recipes-core/openjdk/openjdk-8-common.inc', lineno: 260, function: __anon_267__home_andrew_src_camol3_camol_layers_meta_java_recipes_core_openjdk_openjdk_8_common_inc > 0256: # work if the native toolchain is Clang, but as of this writing that > 0257: # doesn't work anyway. > 0258: version = d.getVar('GCCVERSION', expand=True)[0] > 0259: extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' > *** 0260: d.appendVar("TARGET_CFLAGS", ' ' + extraflags) > 0261: d.appendVar("TARGET_CXXFLAGS", ' ' + extraflags) > 0262: > 0263: toolchain = d.getVar('BUILD_CC', True) > 0264: extraflags = version_specific_cflags(d, toolchain) > Exception: ValueError: invalid literal for int() with base 10: 'l' > > Andrew > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [meta-java][PATCH] openjdk-8-common: Fix the issue of building failed adlc on host with gcc < 6 2017-09-30 2:24 [meta-java][PATCH] openjdk-8-common: Fix the issue of building failed adlc on host with gcc < 6 fupan.li 2017-10-03 10:14 ` [oe] " Andrew Goodbody @ 2018-08-09 11:04 ` André Draszik 2018-08-09 11:19 ` Maxin B. John 1 sibling, 1 reply; 7+ messages in thread From: André Draszik @ 2018-08-09 11:04 UTC (permalink / raw) To: openembedded-devel, Maxin B. John Hi Maxin, You reverted this patch, do you remember what the problem was? It looks useful, and I believe a solution similar to this one is actually needed... Cheers, Andre' On Fri, 2017-09-29 at 19:24 -0700, fupan.li@windriver.com wrote: > From: Fupan Li <fupan.li@windriver.com> > > The patch recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-adlc- > flags.patch > had tried to fix this issue, and it tried to filter out the > TARGET_FLAGS/TARGET_ > CXXFLGAS, but for the flags such as "-fno-lifetime-dse" was added to > CFLAGS/CXXFLAGS, > directly, thus that patch failed to filter it out. > > To fix this issue, it's better to add those GCC version specific flags to > BUILD_CFLAGS/ > BUILD_CXXFLAGS and TARGET_CFLAGS/TARGET_CXXFLAGS separatedly, thus that > patch can work > as expected. > > Signed-off-by: Fupan Li <fupan.li@windriver.com> > --- > recipes-core/openjdk/openjdk-8-common.inc | 36 ++++++++++++++++++++---- > ------- > 1 file changed, 24 insertions(+), 12 deletions(-) > > diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes- > core/openjdk/openjdk-8-common.inc > index 83828e1..c609232 100644 > --- a/recipes-core/openjdk/openjdk-8-common.inc > +++ b/recipes-core/openjdk/openjdk-8-common.inc > @@ -231,27 +231,39 @@ 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): > +def version_specific_cflags(d, toolchain): > extraflags = None > version = None > > - if bb.data.inherits_class('native', d): > - from subprocess import Popen, PIPE > + from subprocess import Popen, PIPE > + cmd = d.expand('%s -dumpversion' % toolchain ).split() > + cc = Popen(cmd, stdout=PIPE, stderr=PIPE) > + version = cc.communicate()[0].decode('utf-8')[0] > > - cmd = d.expand('${CC} -dumpversion').split() > - cc = Popen(cmd, stdout=PIPE, stderr=PIPE) > - version = cc.communicate()[0].decode('utf-8')[0] > + if version.isdigit(): > + extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' > + return extraflags > + return '' > + > +python __anonymous() { > + if bb.data.inherits_class('native', d): > + toolchain = d.getVar('CC', True) > + extraflags = version_specific_cflags(d, toolchain) > + d.appendVar("CFLAGS", ' ' + extraflags) > + d.appendVar("CXXFLAGS", ' ' + extraflags) > 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] > - > - if version.isdigit(): > extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' > - return extraflags > - return '' > + d.appendVar("TARGET_CFLAGS", ' ' + extraflags) > + d.appendVar("TARGET_CXXFLAGS", ' ' + extraflags) > + > + toolchain = d.getVar('BUILD_CC', True) > + extraflags = version_specific_cflags(d, toolchain) > + d.appendVar("BUILD_CFLAGS", ' ' + extraflags) > + d.appendVar("BUILD_CXXFLAGS", ' ' + extraflags) > +} > > -CFLAGS_append = " ${@version_specific_cflags(d)}" > -CXXFLAGS_append = " ${@version_specific_cflags(d)}" > CXX_append = " -std=gnu++98" > -- > 2.11.0 > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [meta-java][PATCH] openjdk-8-common: Fix the issue of building failed adlc on host with gcc < 6 2018-08-09 11:04 ` André Draszik @ 2018-08-09 11:19 ` Maxin B. John 2018-08-09 17:16 ` Matthew McClain 0 siblings, 1 reply; 7+ messages in thread From: Maxin B. John @ 2018-08-09 11:19 UTC (permalink / raw) To: André Draszik; +Cc: openembedded-devel Hi Andre', On Thu, Aug 09, 2018 at 12:04:01PM +0100, André Draszik wrote: > Hi Maxin, > > You reverted this patch, do you remember what the problem was? It looks > useful, and I believe a solution similar to this one is actually needed... IIRC, this patch caused build error on one machine with gcc version 5.1.1. > Cheers, > Andre' Best Regards, Maxin > On Fri, 2017-09-29 at 19:24 -0700, fupan.li@windriver.com wrote: > > From: Fupan Li <fupan.li@windriver.com> > > > > The patch recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-adlc- > > flags.patch > > had tried to fix this issue, and it tried to filter out the > > TARGET_FLAGS/TARGET_ > > CXXFLGAS, but for the flags such as "-fno-lifetime-dse" was added to > > CFLAGS/CXXFLAGS, > > directly, thus that patch failed to filter it out. > > > > To fix this issue, it's better to add those GCC version specific flags to > > BUILD_CFLAGS/ > > BUILD_CXXFLAGS and TARGET_CFLAGS/TARGET_CXXFLAGS separatedly, thus that > > patch can work > > as expected. > > > > Signed-off-by: Fupan Li <fupan.li@windriver.com> > > --- > > recipes-core/openjdk/openjdk-8-common.inc | 36 ++++++++++++++++++++---- > > ------- > > 1 file changed, 24 insertions(+), 12 deletions(-) > > > > diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes- > > core/openjdk/openjdk-8-common.inc > > index 83828e1..c609232 100644 > > --- a/recipes-core/openjdk/openjdk-8-common.inc > > +++ b/recipes-core/openjdk/openjdk-8-common.inc > > @@ -231,27 +231,39 @@ 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): > > +def version_specific_cflags(d, toolchain): > > extraflags = None > > version = None > > > > - if bb.data.inherits_class('native', d): > > - from subprocess import Popen, PIPE > > + from subprocess import Popen, PIPE > > + cmd = d.expand('%s -dumpversion' % toolchain ).split() > > + cc = Popen(cmd, stdout=PIPE, stderr=PIPE) > > + version = cc.communicate()[0].decode('utf-8')[0] > > > > - cmd = d.expand('${CC} -dumpversion').split() > > - cc = Popen(cmd, stdout=PIPE, stderr=PIPE) > > - version = cc.communicate()[0].decode('utf-8')[0] > > + if version.isdigit(): > > + extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' > > + return extraflags > > + return '' > > + > > +python __anonymous() { > > + if bb.data.inherits_class('native', d): > > + toolchain = d.getVar('CC', True) > > + extraflags = version_specific_cflags(d, toolchain) > > + d.appendVar("CFLAGS", ' ' + extraflags) > > + d.appendVar("CXXFLAGS", ' ' + extraflags) > > 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] > > - > > - if version.isdigit(): > > extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' > > - return extraflags > > - return '' > > + d.appendVar("TARGET_CFLAGS", ' ' + extraflags) > > + d.appendVar("TARGET_CXXFLAGS", ' ' + extraflags) > > + > > + toolchain = d.getVar('BUILD_CC', True) > > + extraflags = version_specific_cflags(d, toolchain) > > + d.appendVar("BUILD_CFLAGS", ' ' + extraflags) > > + d.appendVar("BUILD_CXXFLAGS", ' ' + extraflags) > > +} > > > > -CFLAGS_append = " ${@version_specific_cflags(d)}" > > -CXXFLAGS_append = " ${@version_specific_cflags(d)}" > > CXX_append = " -std=gnu++98" > > -- > > 2.11.0 > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [meta-java][PATCH] openjdk-8-common: Fix the issue of building failed adlc on host with gcc < 6 2018-08-09 11:19 ` Maxin B. John @ 2018-08-09 17:16 ` Matthew McClain 0 siblings, 0 replies; 7+ messages in thread From: Matthew McClain @ 2018-08-09 17:16 UTC (permalink / raw) To: Maxin B. John, André Draszik; +Cc: openembedded-devel On 8/9/18 6:19 AM, Maxin B. John wrote: > On Thu, Aug 09, 2018 at 12:04:01PM +0100, André Draszik wrote: >> Hi Maxin, >> >> You reverted this patch, do you remember what the problem was? It looks >> useful, and I believe a solution similar to this one is actually needed... > IIRC, this patch caused build error on one machine with gcc version 5.1.1. I'm interested in the correct solution for this too. I'm building on top of CentOS 7 which uses GCC 4.8.5. I've currently got variables like the following in a .bbappend to get around building adlc which uses the system's compiler. TARGET_CFLAGS = " -fno-lifetime-dse" TARGET_CXXFLAGS = " -fno-lifetime-dse" I read as much as I could find on the meta-java list before I settled on this. http://lists.openembedded.org/pipermail/openembedded-devel/2016-March/106599.html Erkka Kääriä: > Adlc is a native tool that openjdk builds and uses during its build process. > Bitbake however passes target machine specific CFLAGS and CXXFLAGS because we > are crosscompiling openjdk for the target architecture. This can cause issues, > if these flags contains values, that work for the Yocto provided crosscompiler > but not for the system compiler. > > As an example, compilation will fail on Ubuntu 14.04 if > -fstack-protector-strong is specified in the distro security flags. Ubuntu > 14.04 ships with GCC 4.8, whereas this flag is only supported by GCC 4.9+. http://lists.openembedded.org/pipermail/openembedded-devel/2017-May/112703.html Khem Raj: > see if you can check -fno-lifetime-dse options is supported in Makefiles > before using the option, that way you can ensure that its only used with > compilers which support it I don't think this was ever acted upon. Thanks, Matthew >> On Fri, 2017-09-29 at 19:24 -0700, fupan.li@windriver.com wrote: >>> From: Fupan Li <fupan.li@windriver.com> >>> >>> The patch recipes-core/openjdk/patches-openjdk-8/openjdk8-fix-adlc- >>> flags.patch >>> had tried to fix this issue, and it tried to filter out the >>> TARGET_FLAGS/TARGET_ >>> CXXFLGAS, but for the flags such as "-fno-lifetime-dse" was added to >>> CFLAGS/CXXFLAGS, >>> directly, thus that patch failed to filter it out. >>> >>> To fix this issue, it's better to add those GCC version specific flags to >>> BUILD_CFLAGS/ >>> BUILD_CXXFLAGS and TARGET_CFLAGS/TARGET_CXXFLAGS separatedly, thus that >>> patch can work >>> as expected. >>> >>> Signed-off-by: Fupan Li <fupan.li@windriver.com> >>> --- >>> recipes-core/openjdk/openjdk-8-common.inc | 36 ++++++++++++++++++++---- >>> ------- >>> 1 file changed, 24 insertions(+), 12 deletions(-) >>> >>> diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes- >>> core/openjdk/openjdk-8-common.inc >>> index 83828e1..c609232 100644 >>> --- a/recipes-core/openjdk/openjdk-8-common.inc >>> +++ b/recipes-core/openjdk/openjdk-8-common.inc >>> @@ -231,27 +231,39 @@ 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): >>> +def version_specific_cflags(d, toolchain): >>> extraflags = None >>> version = None >>> >>> - if bb.data.inherits_class('native', d): >>> - from subprocess import Popen, PIPE >>> + from subprocess import Popen, PIPE >>> + cmd = d.expand('%s -dumpversion' % toolchain ).split() >>> + cc = Popen(cmd, stdout=PIPE, stderr=PIPE) >>> + version = cc.communicate()[0].decode('utf-8')[0] >>> >>> - cmd = d.expand('${CC} -dumpversion').split() >>> - cc = Popen(cmd, stdout=PIPE, stderr=PIPE) >>> - version = cc.communicate()[0].decode('utf-8')[0] >>> + if version.isdigit(): >>> + extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' >>> + return extraflags >>> + return '' >>> + >>> +python __anonymous() { >>> + if bb.data.inherits_class('native', d): >>> + toolchain = d.getVar('CC', True) >>> + extraflags = version_specific_cflags(d, toolchain) >>> + d.appendVar("CFLAGS", ' ' + extraflags) >>> + d.appendVar("CXXFLAGS", ' ' + extraflags) >>> 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] >>> - >>> - if version.isdigit(): >>> extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or '' >>> - return extraflags >>> - return '' >>> + d.appendVar("TARGET_CFLAGS", ' ' + extraflags) >>> + d.appendVar("TARGET_CXXFLAGS", ' ' + extraflags) >>> + >>> + toolchain = d.getVar('BUILD_CC', True) >>> + extraflags = version_specific_cflags(d, toolchain) >>> + d.appendVar("BUILD_CFLAGS", ' ' + extraflags) >>> + d.appendVar("BUILD_CXXFLAGS", ' ' + extraflags) >>> +} >>> >>> -CFLAGS_append = " ${@version_specific_cflags(d)}" >>> -CXXFLAGS_append = " ${@version_specific_cflags(d)}" >>> CXX_append = " -std=gnu++98" >>> -- >>> 2.11.0 >>> ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-08-09 17:16 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-09-30 2:24 [meta-java][PATCH] openjdk-8-common: Fix the issue of building failed adlc on host with gcc < 6 fupan.li 2017-10-03 10:14 ` [oe] " Andrew Goodbody 2017-10-09 3:06 ` fupan 2017-10-12 2:23 ` fupan 2018-08-09 11:04 ` André Draszik 2018-08-09 11:19 ` Maxin B. John 2018-08-09 17:16 ` Matthew McClain
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.