gobject-introspection: replace prelink-rtld with objdump -p

g-i internally processes the output with regexes, and seems
happy with what objdump is printing. It only needs to resolve
the library name as passed to the linker to the library file name.
Also recursive resolution (that ldd is doing and objdump is not)
is not necessary.

(From OE-Core rev: 767e0880d4d729e659e859dd99c1cdb084b8ba51)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alexander Kanavin
2022-01-27 11:20:05 +01:00
committed by Richard Purdie
parent 8b562100df
commit 1adbf5ba27
3 changed files with 3 additions and 41 deletions

View File

@@ -29,7 +29,7 @@ EXTRA_OEMESON:prepend:class-nativesdk = "${@['', '${GIRMESONBUILD}'][d.getVar('G
# Generating introspection data depends on a combination of native and target
# introspection tools, and qemu to run the target tools.
DEPENDS:append:class-target = " gobject-introspection gobject-introspection-native qemu-native prelink-native"
DEPENDS:append:class-target = " gobject-introspection gobject-introspection-native qemu-native"
# Even though introspection is disabled on -native, gobject-introspection package is still
# needed for m4 macros.

View File

@@ -1,28 +0,0 @@
From f742da8b3913f4818d3f419117076afe62f4dbf4 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@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@gmail.com>
---
giscanner/shlibs.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/giscanner/shlibs.py b/giscanner/shlibs.py
index d67df95..80352a6 100644
--- a/giscanner/shlibs.py
+++ b/giscanner/shlibs.py
@@ -102,7 +102,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")

View File

@@ -14,7 +14,6 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=c434e8128a68bedd59b80b2ac1eb1c4a \
"
SRC_URI = "${GNOME_MIRROR}/${BPN}/${@oe.utils.trim_version("${PV}", 2)}/${BPN}-${PV}.tar.xz \
file://0001-giscanner-ignore-error-return-codes-from-ldd-wrapper.patch \
file://0001-build-Avoid-the-doctemplates-hack.patch \
"
@@ -33,9 +32,7 @@ DEPENDS += " libffi zlib glib-2.0 python3 flex-native bison-native autoconf-arch
# target build needs qemu to run temporary introspection binaries created
# on the fly by g-ir-scanner and a native version of itself to run
# native versions of its own tools during build.
# Also prelink-rtld is used to find out library dependencies of introspection binaries
# (standard ldd doesn't work when cross-compiling).
DEPENDS:append:class-target = " gobject-introspection-native qemu-native prelink-native"
DEPENDS:append:class-target = " gobject-introspection-native qemu-native"
# needed for writing out the qemu wrapper script
export STAGING_DIR_HOST
@@ -55,13 +52,6 @@ EXTRA_OEMESON:class-target = " \
${@'-Dgir_dir_prefix=${libdir}' if d.getVar('MULTILIBS') else ''} \
"
# Need to ensure ld.so.conf exists so prelink-native works
# both before we build and if we install from sstate
do_configure[prefuncs] += "gobject_introspection_preconfigure"
python gobject_introspection_preconfigure () {
oe.utils.write_ld_so_conf(d)
}
do_configure:prepend:class-native() {
# Tweak the native python scripts so that they don't refer to the
# full path of native python binary (the solution is taken from glib-2.0 recipe)
@@ -113,7 +103,7 @@ EOF
# for a different architecture
cat > ${B}/g-ir-scanner-lddwrapper << EOF
#!/bin/sh
prelink-rtld --root=$STAGING_DIR_HOST "\$@"
$OBJDUMP -p "\$@"
EOF
chmod +x ${B}/g-ir-scanner-lddwrapper