package/gobject-introspection: fix host build when /bin/sh warns
PATCH 1/1 package/gobject-introspection: fix host build when /bin/sh warns
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
--- ...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
package/gobject-introspection/0002-giscanner-Don-t-parse-pkg-config-s-stderr-as-flags.patch new file +71 -0
@@ -0,0 +1,71 @@ +From 68770762fa69786ffddc3f5f5846c7140eaed624 Mon Sep 17 00:00:00 2001 +From: Yegor Yefremov <[email protected]> +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 <[email protected]> +--- + 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 +
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 1/1 package/gobject-introspection: fix host build when /bin/sh warns
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
---
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
package/gobject-introspection/0002-giscanner-Do-parse-stderr-as-flags.patch new file +56 -0
@@ -0,0 +1,56 @@ +From 5685062db8924fe0a58a9a2a3f435217614dcc9f Mon Sep 17 00:00:00 2001 +From: Franciszek Stachura <[email protected]> +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 <[email protected]> +--- + 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 +
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 7 lines · Yegor Yefremov via buildroot
host-gobject-introspection is built with
LD_LIBRARY_PATHpointing to $(HOST_DIR)/lib. When g-ir-scanner calls pkg-config, which in Buildroot is a/bin/shwrapper script, the shell inherits thatLD_LIBRARY_PATH. On hosts where/bin/shis 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
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Raphaël Mélotte via buildroot
AppliedIn reply of:
Quoted 29 lines
host-gobject-introspection is built with
LD_LIBRARY_PATHpointing to $(HOST_DIR)/lib. When g-ir-scanner calls pkg-config, which in Buildroot is a/bin/shwrapper script, the shell inherits thatLD_LIBRARY_PATH. On hosts where/bin/shis 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 settingLD_LIBRARY_PATHfor 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.
Quoted 6 lines
Fixes:
https://autobuild.buildroot.org/results/615b6701c6c200f6e6f3081e784f981e4f4f644eFixes 8270fca228b1892b699801536ce136460e4892e9 ("package/gobject-introspection: fix host-linking")Assisted-by Claude:claude-opus-5-5Signed-off-by Yegor Yefremov <[email protected]>
Applied to 2025.02.x, 2026.08.x. Thanks
Quoted 61 lines
---
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.patchpackage/gobject-introspection/0002-giscanner-Do-parse-stderr-as-flags.patch new file +46
-0@@ -0,0 +1,56 @@ +From 5685062db8924fe0a58a9a2a3f435217614dcc9f Mon Sep 17 00:00:00 2001 +From: Franciszek Stachura <[email protected]> +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 <[email protected]> +--- + 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') ++ """
package/gobject-introspection/0002-giscanner-Do-parse-stderr-as-flags.patch line 56
Quoted 10 lines
package/gobject-introspection/0002-giscanner-Do-parse-stderr-as-flags.patch new file +10
-0++ 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 +
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot