ruby: Remove __has_include and __has_include_next from preprocessed header file
PATCH 1/1 ruby: Remove __has_include and __has_include_next from preprocessed header file
one of the build steps ruby has is that it generated rb_mjit_header.h during configure using gcc preprocessor using -dD which emits built-in defines as well, problem happens when this header is later included in subsequent compiles, where compiler errors out stating that an existing internal define is redefined
| /tmp/20200123-2021083-2c601q.h:13849:9: error: "__has_include" cannot be used as a macro name | 13849 | #define __has_include __has_include | | ^~~~~~~~~~~~~ | compilation terminated due to -Wfatal-errors.
Since compiler already will take care of it internally we can edit it out from this header file
--- meta/recipes-devtools/ruby/ruby.inc | 7 +++++++ 1 file changed, 7 insertions(+)
meta/recipes-devtools/ruby/ruby.inc +7 -0
@@ -38,3 +38,10 @@ do_configure_prepend() { sed -i "s#%%TARGET_CFLAGS%%#$CFLAGS#; s#%%TARGET_LDFLAGS%%#$LDFLAGS#" ${S}/common.mk rm -rf ${S}/ruby/ } + +do_compile_prepend() { + if [ -e ${B}/rb_mjit_header.h ]; then + sed -i -e "/#define __has_include __has_include/d" ${B}/rb_mjit_header.h + sed -i -e "/#define __has_include_next __has_include_next/d" ${B}/rb_mjit_header.h + fi +}
Signature · 1 line
2.25.0
ignore it
Quoted 38 lines · Khem Raj
one of the build steps ruby has is that it generated
rb_mjit_header.hduring configure using gcc preprocessor using -dD which emits built-in defines as well, problem happens when this header is later included in subsequent compiles, where compiler errors out stating that an existing internal define is redefined| /tmp/20200123-2021083-2c601q.h:13849:9: error: "__has_include" cannot be used as a macro name | 13849 | #define __has_include __has_include | | ^~~~~~~~~~~~~ | compilation terminated due to -Wfatal-errors.Since compiler already will take care of it internally we can edit it out from this header file
Signed-off-by Khem Raj <[email protected]>--- meta/recipes-devtools/ruby/ruby.inc | 7 +++++++ 1 file changed, 7 insertions(+)meta/recipes-devtools/ruby/ruby.inc +7
-1@@ -38,3 +38,10 @@ do_configure_prepend() { sed -i "s#%%TARGET_CFLAGS%%#$CFLAGS#; s#%%TARGET_LDFLAGS%%#$LDFLAGS#" ${S}/common.mk rm -rf ${S}/ruby/ } + +do_compile_prepend() { + if [ -e ${B}/rb_mjit_header.h ]; then + sed -i -e "/#define __has_include __has_include/d" ${B}/rb_mjit_header.h + sed -i -e "/#define __has_include_next __has_include_next/d" ${B}/rb_mjit_header.h + fi +} --2.25.0
Quoted 6 lines · Khem Raj
one of the build steps ruby has is that it generated
rb_mjit_header.hduring configure using gcc preprocessor using -dD which emits built-in defines as well, problem happens when this header is later included in subsequent compiles, where compiler errors out stating that an existing internal define is redefined
Quoted 7 lines
| /tmp/20200123-2021083-2c601q.h:13849:9: error: "__has_include" cannot be used as a macro name | 13849 | #define __has_include __has_include | | ^~~~~~~~~~~~~ | compilation terminated due to -Wfatal-errors.Since compiler already will take care of it internally we can edit it out from this header file
Any idea what introduced this ? Hard to tell if this is backport worthy.
-armin
Quoted 21 lines
Signed-off-by Khem Raj <[email protected]>--- meta/recipes-devtools/ruby/ruby.inc | 7 +++++++ 1 file changed, 7 insertions(+)meta/recipes-devtools/ruby/ruby.inc +7
-0@@ -38,3 +38,10 @@ do_configure_prepend() { sed -i "s#%%TARGET_CFLAGS%%#$CFLAGS#; s#%%TARGET_LDFLAGS%%#$LDFLAGS#" ${S}/common.mk rm -rf ${S}/ruby/ } + +do_compile_prepend() { + if [ -e ${B}/rb_mjit_header.h ]; then + sed -i -e "/#define __has_include __has_include/d" ${B}/rb_mjit_header.h + sed -i -e "/#define __has_include_next __has_include_next/d" ${B}/rb_mjit_header.h + fi +}
Quoted 11 lines · On Thu, Jan 23, 2020 at 12:27 PM akuster808 <[email protected]> wrote:
Quoted 7 lines · Khem Raj
one of the build steps ruby has is that it generated
rb_mjit_header.hduring configure using gcc preprocessor using -dD which emits built-in defines as well, problem happens when this header is later included in subsequent compiles, where compiler errors out stating that an existing internal define is redefined|
/tmp/20200123-2021083-2c601q.h:13849:9: error: "__has_include" cannotbe used as a macro name
Quoted 9 lines
Quoted 6 lines
| 13849 | #define __has_include __has_include | | ^~~~~~~~~~~~~ | compilation terminated due to -Wfatal-errors.Since compiler already will take care of it internally we can edit it out from this header file
Any idea what introduced this ? Hard to tell if this is backport worthy.
You need gcc trunk for this to exhibit with release we won’t see this issue so it technically is not required on releases
Quoted 31 lines
-armin
Review
Quoted 7 lines
Signed-off-by Khem Raj <[email protected]>--- meta/recipes-devtools/ruby/ruby.inc | 7 +++++++ 1 file changed, 7 insertions(+)(quoted diff) +0
-0b/meta/recipes-devtools/ruby/ruby.inc
meta/recipes-devtools/ruby/ruby.inc do_configure_prepend() { · line 38
Quoted 5 lines
index
ce1b02f012..d5cd329e65100644meta/recipes-devtools/ruby/ruby.inc +0
-0@@ -38,3 +38,10 @@ do_configure_prepend() { sed -i "s#%%TARGET_CFLAGS%%#$CFLAGS#;s#%%TARGET_LDFLAGS%%#$LDFLAGS#"
${S}/common.mkmeta/recipes-devtools/ruby/ruby.inc do_configure_prepend() {
Quoted 6 lines
meta/recipes-devtools/ruby/ruby.inc +4
-0rm -rf ${S}/ruby/ } + +do_compile_prepend() { + if [ -e ${B}/rb_mjit_header.h ]; then + sed -i -e "/#define __has_include __has_include/d"
${B}/rb_mjit_header.hmeta/recipes-devtools/ruby/ruby.inc do_configure_prepend() { · line 45
Quoted 1 line
meta/recipes-devtools/ruby/ruby.inc +1
-0+ sed -i -e "/#define __has_include_next __has_include_next/d"
${B}/rb_mjit_header.hQuoted 4 lines
meta/recipes-devtools/ruby/ruby.inc +2
-0+ fi +}