From: Richard Purdie <richard.pur...@linuxfoundation.org>

To quote Zhuang <qiuguang....@alibaba-inc.com>:
"""
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
 ...

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
using the original proposed sort.
"""

This fixes the gcc patch as proposed as it does appear its been
broken over time.

(From OE-Core rev: dce28d8ac7fbae487cb6674b91fe2b574036b26d)

Signed-off-by: Richard Purdie <richard.pur...@linuxfoundation.org>
(cherry picked from commit 94eb5724b111cf3409219be3b169af79858eab7b)
Signed-off-by: Anuj Mittal <anuj.mit...@intel.com>
Signed-off-by: Steve Sakoman <st...@sakoman.com>
---
 .../gcc-9.3/0012-gcc-Fix-argument-list-too-long-error.patch | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/meta/recipes-devtools/gcc/gcc-9.3/0012-gcc-Fix-argument-list-too-long-error.patch
 
b/meta/recipes-devtools/gcc/gcc-9.3/0012-gcc-Fix-argument-list-too-long-error.patch
index 9d98878096..f0b79ee145 100644
--- 
a/meta/recipes-devtools/gcc/gcc-9.3/0012-gcc-Fix-argument-list-too-long-error.patch
+++ 
b/meta/recipes-devtools/gcc/gcc-9.3/0012-gcc-Fix-argument-list-too-long-error.patch
@@ -17,6 +17,10 @@ $(sort list) doesn't need this.
 Signed-off-by: Robert Yang <liezhi.y...@windriver.com>
 Signed-off-by: Khem Raj <raj.k...@gmail.com>
 
+RP: gcc then added *.h and *.def additions to this list, breaking the original
+fix. Add the sort to the original gcc code, leaving the tr+sort to fix the 
original
+issue but include the new files too as reported by Zhuang 
<qiuguang....@alibaba-inc.com>
+
 Upstream-Status: Pending
 ---
  gcc/Makefile.in | 2 +-
@@ -31,7 +35,7 @@ index fef6c4c61e3..57cf7804f0a 100644
  # files. All other files are flattened to a single directory.
        $(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
 -      headers=`echo $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def) | tr ' 
' '\012' | sort -u`; \
-+      headers="$(sort $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def))"; \
++      headers=`echo $(sort $(PLUGIN_HEADERS)) $$(cd $(srcdir); echo *.h 
*.def) | tr ' ' '\012' | sort -u`; \
        srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`; \
        for file in $$headers; do \
          if [ -f $$file ] ; then \
-- 
2.17.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#146570): 
https://lists.openembedded.org/g/openembedded-core/message/146570
Mute This Topic: https://lists.openembedded.org/mt/79585734/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to