[Buildroot] [PATCH 1/1] package/gobject-introspection: do not use host-prelink-cross

Adam Duskett adam.duskett at amarulasolutions.com
Thu Nov 9 19:06:23 UTC 2023


Internally, gobject-introspection processes the output of ldd with regexes,
and works properly with what objdump -p is printing. Gobject-introspection only
resolves the library name as passed to the linker to the library file name and
does not need the recursive resolution that ldd is doing and objdump is not.

This change also allows us to remove patches 0002 and 0003 as they are
prelink-rtld specific.

Tested on Fedora 39 and Debian 11, with AArch64, X86_64, and S390x.
Also tested with:
./support/testing/run-tests tests.package.test_python_gobject

Signed-off-by: Adam Duskett <adam.duskett at amarulasolutions.com>
---
 .../0002-Add-rpath-links-to-ccompiler.patch   | 29 -----------------
 ...-error-return-codes-from-ldd-wrapper.patch | 31 -------------------
 .../g-ir-scanner-lddwrapper.in                |  2 +-
 .../gobject-introspection.mk                  |  4 +--
 4 files changed, 3 insertions(+), 63 deletions(-)
 delete mode 100644 package/gobject-introspection/0002-Add-rpath-links-to-ccompiler.patch
 delete mode 100644 package/gobject-introspection/0003-giscanner-ignore-error-return-codes-from-ldd-wrapper.patch

diff --git a/package/gobject-introspection/0002-Add-rpath-links-to-ccompiler.patch b/package/gobject-introspection/0002-Add-rpath-links-to-ccompiler.patch
deleted file mode 100644
index a8cf332f21..0000000000
--- a/package/gobject-introspection/0002-Add-rpath-links-to-ccompiler.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 952e2e2bb6a22ec8824223b03b65cb28361c6e34 Mon Sep 17 00:00:00 2001
-From: Adam Duskett <aduskett at gmail.com>
-Date: Wed, 14 Mar 2018 12:07:10 -0400
-Subject: [PATCH] Add rpath links to ccompiler
-
-This patch allows gobject-introspection to process extra paths passed to the
-compiler via the GIR_EXTRA_LIBS_PATH variable.
-
-Signed-off-by: Adam Duskett <aduskett at gmail.com>
----
- giscanner/ccompiler.py | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py
-index cb97e76f..d29b28c8 100644
---- a/giscanner/ccompiler.py
-+++ b/giscanner/ccompiler.py
-@@ -266,6 +266,8 @@ class CCompiler(object):
- 
-         for envvar in runtime_path_envvar:
-             if envvar in os.environ:
-+                for envvar_path in os.environ[envvar].split(':'):
-+                    args.append("-Wl,-rpath-link," + envvar_path)
-                 os.environ[envvar] = \
-                     os.pathsep.join(runtime_paths + [os.environ[envvar]])
-             else:
--- 
-2.25.1
-
diff --git a/package/gobject-introspection/0003-giscanner-ignore-error-return-codes-from-ldd-wrapper.patch b/package/gobject-introspection/0003-giscanner-ignore-error-return-codes-from-ldd-wrapper.patch
deleted file mode 100644
index f1ea518954..0000000000
--- a/package/gobject-introspection/0003-giscanner-ignore-error-return-codes-from-ldd-wrapper.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From e0fc4a2a5161a36483ddc518be9bb14390f11b19 Mon Sep 17 00:00:00 2001
-From: Alexander Kanavin <alex.kanavin at gmail.com>
-Date: Wed, 5 Sep 2018 16:46:52 +0200
-Subject: [PATCH] giscanner: ignore error return codes from ldd-wrapper
-
-prelink-rtld, which we use instead of ldd returns 127 when it can't find a library.
-It is not an error per se, but it breaks subprocess.check_output().
-
-Upstream-Status: Inappropriate [oe-core specific]
-Signed-off-by: Alexander Kanavin <alex.kanavin at gmail.com>
-Signed-off-by: Adam Duskett <aduskett at gmail.com>
----
- giscanner/shlibs.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/giscanner/shlibs.py b/giscanner/shlibs.py
-index 9f8ab5df..7a1a72fe 100644
---- a/giscanner/shlibs.py
-+++ b/giscanner/shlibs.py
-@@ -103,7 +103,7 @@ def _resolve_non_libtool(options, binary, libraries):
-             args.extend(['otool', '-L', binary.args[0]])
-         else:
-             args.extend(['ldd', binary.args[0]])
--        output = subprocess.check_output(args)
-+        output = subprocess.run(args, check=False, stdout=subprocess.PIPE).stdout
-         if isinstance(output, bytes):
-             output = output.decode("utf-8", "replace")
- 
--- 
-2.25.1
-
diff --git a/package/gobject-introspection/g-ir-scanner-lddwrapper.in b/package/gobject-introspection/g-ir-scanner-lddwrapper.in
index 2f09bca77a..10393feae2 100644
--- a/package/gobject-introspection/g-ir-scanner-lddwrapper.in
+++ b/package/gobject-introspection/g-ir-scanner-lddwrapper.in
@@ -1,3 +1,3 @@
 #!/usr/bin/env sh
 
-"${HOST_DIR}"/sbin/prelink-rtld --root="$(dirname "$0")/../../" "$@"
+ at OBJDUMP@ -p "$@"
diff --git a/package/gobject-introspection/gobject-introspection.mk b/package/gobject-introspection/gobject-introspection.mk
index f0c7fcd2ca..7786fa74fe 100644
--- a/package/gobject-introspection/gobject-introspection.mk
+++ b/package/gobject-introspection/gobject-introspection.mk
@@ -15,7 +15,6 @@ GOBJECT_INTROSPECTION_LICENSE_FILES = COPYING.LGPL COPYING.GPL giscanner/scanner
 GOBJECT_INTROSPECTION_DEPENDENCIES = \
 	host-autoconf-archive \
 	host-gobject-introspection \
-	host-prelink-cross \
 	host-qemu \
 	libffi \
 	libglib2 \
@@ -78,7 +77,8 @@ define GOBJECT_INTROSPECTION_INSTALL_PRE_WRAPPERS
 
 	$(INSTALL) -D -m 755 $(GOBJECT_INTROSPECTION_PKGDIR)/g-ir-scanner-lddwrapper.in \
 		$(STAGING_DIR)/usr/bin/g-ir-scanner-lddwrapper
-
+	$(SED) "s%@OBJDUMP@%$(TARGET_OBJDUMP)%g" \
+		$(STAGING_DIR)/usr/bin/g-ir-scanner-lddwrapper
 	$(INSTALL) -D -m 755 $(GOBJECT_INTROSPECTION_PKGDIR)/g-ir-scanner-qemuwrapper.in \
 		$(STAGING_DIR)/usr/bin/g-ir-scanner-qemuwrapper
 	$(SED) "s%@QEMU_USER@%$(QEMU_USER)%g" \
-- 
2.41.0




More information about the buildroot mailing list