Skip to contentSkip to conversation

recipes-devtools/gcc: gcc-Fix-argument-list-too-long-error.patch is buggy

DISCUSSION [email protected] 2 participants 2 messages Jul 26, 2020 – Jul 29, 2020

lore
Share & tools
lore
#0 lore raw

Hello,

A few days ago, I tried to compile a gcc plugin with the toolchain from poky sdk. It failed with errors about missing header files such as backend.h etc.

After investigation, I found that the problem was brought by a gcc patch:
0012-gcc-Fix-argument-list-too-long-error.patch ( https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/recipes-devtools/gcc/gcc-10.1/0012-gcc-Fix-argument-list-too-long-error.patch ) (which is considered derived from the original patch ( https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/recipes-devtools/gcc/gcc-4.7/gcc-argument-list-too-long.patch?h=yocto-1.4.1 ) )

- headers=echo $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u; \
+ headers="$(sort $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def))"; \

It changes the commands of install-plugin , making the sorting taken effect before the shell globs. Thus results in the header files under gcc $(srcdir) being not installed.

By checking log.do_install , we can find that the ` headers= ' statement to run is incorrect and will not work as expected:
headers=" $(cd *.def) *.h../../../../../../../work-shared/gcc-10.1.0-r0/gcc-10.1.0/gcc/../include/ansidecl.h ...

As the patch says,
"The PLUGIN_HEADERS is too long before sort, so the "echo" can't handle it, ..." my suggestion is that we can simply take care of PLUGIN_HEADERS :

- headers=echo $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u; \
+ headers= echo $(sort $(PLUGIN_HEADERS) ) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u; \

Thanks,
Zhuang

#1 lore raw
Quoted 15 lines · On Sun, 2020-07-26 at 08:20 -0700, [email protected] wrote:

A few days ago, I tried to compile a gcc plugin with the toolchain from poky sdk. It failed with errors about missing header files such as backend.h etc.

After investigation, I found that the problem was brought by a gcc patch:
0012-gcc-Fix-argument-list-too-long-error.patch (which is considered derived from the original patch)

- headers=echo $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u; \
+ headers="$(sort $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def))"; \

It changes the commands of install-plugin, making the sorting taken effect before the shell globs. Thus results in the header files under gcc $(srcdir) being not installed.

By checking log.do_install, we can find that the `headers=' statement to run is incorrect and will not work as expected:
headers="$(cd *.def) *.h ../../../../../../../work-shared/gcc-10.1.0-r0/gcc-10.1.0/gcc/../include/ansidecl.h ...

Quoted 6 lines

As the patch says,
"The PLUGIN_HEADERS is too long before sort, so the "echo" can't handle it, ..." my suggestion is that we can simply take care of PLUGIN_HEADERS:

- headers=echo $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u; \
+ headers=echo $(sort $(PLUGIN_HEADERS)) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u; \

Thanks for the report, I've submitted and later merged a patch to fix it.

Cheers,

Richard