* [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
* [Buildroot] [PATCH v2] package/gobject-introspection: fix host build when /bin/sh warns
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 ` Yegor Yefremov via buildroot
2026-10-21 18:59 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 3+ messages in thread
From: Yegor Yefremov via buildroot @ 2026-10-20 22:13 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
...
Backport the pending upstream merge request, 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>
---
Changes v1 -> v2:
- backport the earlier upstream MR !561 by Franciszek Stachura,
which makes the same change, instead of my duplicate MR !568
...2-giscanner-Do-parse-stderr-as-flags.patch | 56 +++++++++++++++++++
1 file changed, 56 insertions(+)
create mode 100644 package/gobject-introspection/0002-giscanner-Do-parse-stderr-as-flags.patch
diff --git a/package/gobject-introspection/0002-giscanner-Do-parse-stderr-as-flags.patch b/package/gobject-introspection/0002-giscanner-Do-parse-stderr-as-flags.patch
new file mode 100644
index 0000000000..f19d8ce092
--- /dev/null
+++ b/package/gobject-introspection/0002-giscanner-Do-parse-stderr-as-flags.patch
@@ -0,0 +1,56 @@
+From 5685062db8924fe0a58a9a2a3f435217614dcc9f Mon Sep 17 00:00:00 2001
+From: Franciszek Stachura <fbstachura@gmail.com>
+Date: Thu, 20 Aug 2026 20:23:16 +0200
+Subject: [PATCH] giscanner: Do parse stderr as flags
+
+check_output in pkgconfig.py returns stdout with stderr. If pkg-config
+prints something to stderr (ex. dynamic linker warnings, or warnings
+from program passed in PKG_CONFIG), it may get parsed as flags and
+passed to the compiler.
+
+Do not capture stderr in check_output at all.
+
+Upstream: https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/561
+Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
+---
+ giscanner/pkgconfig.py | 2 +-
+ tests/scanner/test_pkgconfig.py | 10 ++++++++++
+ 2 files changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/giscanner/pkgconfig.py b/giscanner/pkgconfig.py
+index 39db41d61..19c5953ea 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 8b654e38e..5da0eb4fc 100644
+--- a/tests/scanner/test_pkgconfig.py
++++ b/tests/scanner/test_pkgconfig.py
+@@ -104,6 +104,16 @@ class PkgConfigTest(unittest.TestCase):
+ flags = pkgconfig.cflags(['bar-3.0'], command=command)
+ self.assertEqual(flags, ['-DLOG="HELLO"'])
+
++ def test_pkgconfig_stderr(self):
++ s = """
++ import sys
++ print('warning: test', file=sys.stderr)
++ print('-ltest')
++ """
++ with pkg_config_script(s) as command:
++ flags = pkgconfig.cflags(['foo-2.0'], command=command)
++ self.assertEqual(flags, ['-ltest'])
++
+
+ if __name__ == '__main__':
+ unittest.main()
+--
+GitLab
+
--
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
* Re: [Buildroot] [PATCH v2] package/gobject-introspection: fix host build when /bin/sh warns
2026-10-20 22:13 ` [Buildroot] [PATCH v2] " Yegor Yefremov via buildroot
@ 2026-10-21 18:59 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2026-10-21 18:59 UTC (permalink / raw)
To: Yegor Yefremov; +Cc: buildroot
On Wed, Oct 21, 2026 at 12:13:09AM +0200, Yegor Yefremov via buildroot wrote:
> 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:
I've applied your patch because it is the most obvious direct
solution, but I find the above explanation rather worrying. It really
isn't great that we end up executing the system-provided bash with a
LD_LIBRARY_PATH pointing to our libraries. It happens to work by
chance because our ncurses is probably not too different from the
system-provided ncurses, but that seems like to be more luck than
correctness.
Shouldn't we investigate a different way that avoids having to pass
LD_LIBRARY_PATH? I honestly don't recall why passing LD_LIBRARY_PATH
is needed.
Thanks!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [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.