All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/gobject-introspection: fix host build when /bin/sh warns
@ 2026-10-20 21:22 Yegor Yefremov via buildroot
  2026-10-20 22:13 ` [Buildroot] [PATCH v2] " Yegor Yefremov via buildroot
  0 siblings, 1 reply; 3+ messages in thread
From: Yegor Yefremov via buildroot @ 2026-10-20 21:22 UTC (permalink / raw)
  To: buildroot

host-gobject-introspection is built with LD_LIBRARY_PATH pointing to
$(HOST_DIR)/lib. When g-ir-scanner calls pkg-config, which in Buildroot
is a /bin/sh wrapper script, the shell inherits that LD_LIBRARY_PATH.
On hosts where /bin/sh is bash linked against the system libreadline
(e.g. Arch Linux), and host-ncurses has already been built, the
dynamic loader picks up Buildroot's libncursesw, which has no symbol
versioning, and warns on stderr:

/bin/sh: .../host/lib/libncursesw.so.6: no version information available (required by /usr/lib/libreadline.so.8)

giscanner merges pkg-config's stderr into its stdout and parses the
result as compiler flags, so the build fails with:

gcc: error: /bin/sh:: linker input file not found: No such file or directory
gcc: error: .../host/lib/libncursesw.so.6:: linker input file not found: No such file or directory
gcc: error: no: linker input file not found: No such file or directory
...

Add a patch, submitted upstream, so that giscanner only parses
pkg-config's stdout.

This issue has been present since commit 8270fca228b1
("package/gobject-introspection: fix host-linking"), which started
setting LD_LIBRARY_PATH for the build, while giscanner has been
merging pkg-config's stderr since 2018. It only shows up on some build
hosts, when host-ncurses is built before host-gobject-introspection.
It therefore affects 2020.05 and later, including 2025.02.x and
2026.02.x.

Fixes:
https://autobuild.buildroot.org/results/615b6701c6c200f6e6f3081e784f981e4f4f644e

Fixes: 8270fca228b1892b699801536ce136460e4892e9 ("package/gobject-introspection: fix host-linking")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
 ...t-parse-pkg-config-s-stderr-as-flags.patch | 71 +++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 package/gobject-introspection/0002-giscanner-Don-t-parse-pkg-config-s-stderr-as-flags.patch

diff --git a/package/gobject-introspection/0002-giscanner-Don-t-parse-pkg-config-s-stderr-as-flags.patch b/package/gobject-introspection/0002-giscanner-Don-t-parse-pkg-config-s-stderr-as-flags.patch
new file mode 100644
index 0000000000..c0d951abbd
--- /dev/null
+++ b/package/gobject-introspection/0002-giscanner-Don-t-parse-pkg-config-s-stderr-as-flags.patch
@@ -0,0 +1,71 @@
+From 68770762fa69786ffddc3f5f5846c7140eaed624 Mon Sep 17 00:00:00 2001
+From: Yegor Yefremov <yegorslists@googlemail.com>
+Date: Tue, 20 Oct 2026 15:58:23 +0200
+Subject: [PATCH] giscanner: Don't parse pkg-config's stderr as flags
+
+check_output() merges pkg-config's stderr into its stdout, and the
+result is then split into compiler and linker flags. Anything printed
+on stderr thus ends up on the compiler command line.
+
+This breaks the build when pkg-config is a shell script wrapper and
+the shell emits a warning, e.g. a dynamic loader warning caused by
+LD_LIBRARY_PATH pointing to a different libncursesw than the one the
+shell's libreadline was linked against:
+
+  /bin/sh: .../host/lib/libncursesw.so.6: no version information available (required by /usr/lib/libreadline.so.8)
+
+which then results in:
+
+  gcc: error: /bin/sh:: linker input file not found: No such file or directory
+  gcc: error: no: linker input file not found: No such file or directory
+  ...
+
+Only use pkg-config's stdout. Its stderr is no longer captured, so
+warnings and error messages still reach the user's terminal.
+
+Upstream: https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/568
+Assisted-by: Claude:claude-opus-5-5
+Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
+---
+ giscanner/pkgconfig.py          |  2 +-
+ tests/scanner/test_pkgconfig.py | 11 +++++++++++
+ 2 files changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/giscanner/pkgconfig.py b/giscanner/pkgconfig.py
+index 39db41d6..19c5953e 100644
+--- a/giscanner/pkgconfig.py
++++ b/giscanner/pkgconfig.py
+@@ -31,7 +31,7 @@ def check_output(flags, ignore_errors, command=None):
+     argv = command[:]
+     argv.extend(flags)
+     try:
+-        return subprocess.check_output(argv, universal_newlines=True, stderr=subprocess.STDOUT)
++        return subprocess.check_output(argv, universal_newlines=True)
+     except subprocess.CalledProcessError as e:
+         output = e.output or ''
+         if ignore_errors:
+diff --git a/tests/scanner/test_pkgconfig.py b/tests/scanner/test_pkgconfig.py
+index 8b654e38..b7aa149e 100644
+--- a/tests/scanner/test_pkgconfig.py
++++ b/tests/scanner/test_pkgconfig.py
+@@ -104,6 +104,17 @@ class PkgConfigTest(unittest.TestCase):
+             flags = pkgconfig.cflags(['bar-3.0'], command=command)
+             self.assertEqual(flags, ['-DLOG="HELLO"'])
+ 
++    def test_stderr_ignored(self):
++        """Checks that pkg-config's stderr does not end up in the flags."""
++        s = """
++        import sys
++        sys.stderr.write('warning: no version information available\\n')
++        print('-I/usr/include/foo')
++        """
++        with pkg_config_script(s) as command:
++            flags = pkgconfig.cflags(['foo-1.0'], command=command)
++            self.assertEqual(flags, ['-I/usr/include/foo'])
++
+ 
+ if __name__ == '__main__':
+     unittest.main()
+-- 
+2.34.1
+
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-21 19:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-20 21:22 [Buildroot] [PATCH] package/gobject-introspection: fix host build when /bin/sh warns Yegor Yefremov via buildroot
2026-10-20 22:13 ` [Buildroot] [PATCH v2] " Yegor Yefremov via buildroot
2026-10-21 18:59   ` Thomas Petazzoni via buildroot

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.