package/gobject-introspection: fix meson support
cover package/gobject-introspection: fix meson support
From: Adam Duskett <[email protected]>
This patch series addresses two remaining issues with gobject-introspection.
1) host-goi doesn't build .typelib or .gir files. These missing files can be an issue when there is a host package that requires introspection, but they are missing.
2) Meson doesn't work due to linking issues.
This patch series fixes both issues.
Patch 1 exports LD_LIBRARY_PATH when building host-gobject-introspection, which allows GOI to link against the hosts libglib2 library.
Patch 2 explicitly exports CC in g-ir-scanner.in.
Patch 3 adds g-ir-scanner and g-ir-compiler paths to cross-compilation.conf.in
I tested this patch with a few autotools packages and with gstreamer1, and it works quite well!
Adam Duskett (3):
package/gobject-introspection: fix host-linking package/gobject-introspection: export cc in g-ir-scanner package/meson: add gobject-introspection tools to
cross-compilation.conf.in
package/gobject-introspection/g-ir-scanner.in | 2 ++ .../gobject-introspection/gobject-introspection.mk | 12 +++++++----- package/meson/cross-compilation.conf.in | 2 ++ 3 files changed, 11 insertions(+), 5 deletions(-)
Signature · 1 line
2.24.1
PATCH 1/3 package/gobject-introspection: fix host-linking
From: Adam Duskett <[email protected]>
The host-variant of gobject-introspection currently links against the host libraries. To resolve this, specify the LD_LIBRARY_PATH in HOST_GOBJECT_INTROSPECTION_NINJA_ENV.
This fix has the added benefit of allowing the host gobject-introspection to build the host .gir, .rnc, and .typelib files, which some packages may require.
--- package/gobject-introspection/gobject-introspection.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
package/gobject-introspection/gobject-introspection.mk +5 -5
@@ -33,11 +33,11 @@ HOST_GOBJECT_INTROSPECTION_DEPENDENCIES = \ GOBJECT_INTROSPECTION_NINJA_ENV += \ CC="$(TARGET_CC)" -# Disable introspection data on the host, as it is not needed and -# the package will attempt to use the systems libglib2 which will fail -# if the systems libglib2 version is older than 2.60. -HOST_GOBJECT_INTROSPECTION_CONF_OPTS = \ - -Denable-introspection-data=false +# g-ir-scanner will default to /usr/bin/ld for linking if this is not set, +# which will cause gobject-introspection to attempt to link against the hosts +# libglib2 +HOST_GOBJECT_INTROSPECTION_NINJA_ENV += \ + LD_LIBRARY_PATH="$(HOST_DIR)/lib" # Use the host gi-scanner to prevent the scanner from generating incorrect # elf classes.
Signature · 1 line
2.24.1
PATCH 2/3 package/gobject-introspection: export cc in g-ir-scanner
In reply to aduskett at gmail.comFrom: Adam Duskett <[email protected]>
Without this export, the host variant of g-ir-scanner will call the host gcc for linking.
For autotools packages, this is not an issue as they use Makefile.introspection, which will export the cross-cc, however for meson, this is not the case, and linking errors occur when meson packages generate .gir and .typelib files.
--- package/gobject-introspection/g-ir-scanner.in | 2 ++ package/gobject-introspection/gobject-introspection.mk | 2 ++ 2 files changed, 4 insertions(+)
package/gobject-introspection/g-ir-scanner.in +2 -0
@@ -1,6 +1,8 @@ #!/usr/bin/env bash export GI_SCANNER_DISABLE_CACHE=1 +export CC="@TARGET_CC@" + ${HOST_DIR}/bin/g-ir-scanner \ --lib-dirs-envvar=GIR_EXTRA_LIBS_PATH \ --use-binary-wrapper=$(dirname $0)/g-ir-scanner-qemuwrapper \
package/gobject-introspection/gobject-introspection.mk +2 -0
@@ -101,6 +101,8 @@ define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS $(INSTALL) -D -m 755 \ $(GOBJECT_INTROSPECTION_PKGDIR)/$(w).in $(STAGING_DIR)/usr/bin/$(w) ) + $(SED) "s%@TARGET_CC@%$(TARGET_CC)%g" $(STAGING_DIR)/usr/bin/g-ir-scanner + # Gobject-introspection installs Makefile.introspection in # $(STAGING_DIR)/usr/share which is needed for autotools-based programs to # build .gir and .typelib files. Unfortuantly, gobject-introspection-1.0.pc
Signature · 1 line
2.24.1
PATCH 3/3 package/meson: add gobject-introspection tools to cross-compilation.conf.in
In reply to aduskett at gmail.comFrom: Adam Duskett <[email protected]>
These paths are hardcoded by default to the host directory; however, because Buildroot is using wrappers for gobject-introspection, the sysroot paths to these tools must be explicitly called instead.
--- package/meson/cross-compilation.conf.in | 2 ++ 1 file changed, 2 insertions(+)
package/meson/cross-compilation.conf.in +2 -0
@@ -9,6 +9,8 @@ cpp = '@TARGET_CROSS at g++' ar = '@TARGET_CROSS at ar' strip = '@TARGET_CROSS at strip' pkgconfig = '@HOST_DIR@/bin/pkgconf' +g-ir-scanner = '@STAGING_DIR@/usr/bin/g-ir-scanner' +g-ir-compiler = '@STAGING_DIR@/usr/bin/g-ir-compiler' [properties] needs_exe_wrapper = true
Signature · 1 line
2.24.1
PATCH 1/3 package/gobject-introspection: fix host-linking
In reply to aduskett at gmail.comAdam, All,
On 2020-02-21 14:43 -0800, aduskett at gmail.com spake thusly:
Quoted 22 lines
From: Adam Duskett <[email protected]>
The host-variant of gobject-introspection currently links against the host libraries. To resolve this, specify the
LD_LIBRARY_PATHinHOST_GOBJECT_INTROSPECTION_NINJA_ENV.This fix has the added benefit of allowing the host gobject-introspection to build the host .gir, .rnc, and .typelib files, which some packages may require.
Signed-off-by Adam Duskett <[email protected]>--- package/gobject-introspection/gobject-introspection.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)package/gobject-introspection/gobject-introspection.mk +0
-0@@ -33,11 +33,11 @@ HOST_GOBJECT_INTROSPECTION_DEPENDENCIES = \ GOBJECT_INTROSPECTION_NINJA_ENV += \ CC="$(TARGET_CC)"
package/gobject-introspection/gobject-introspection.mk HOST_GOBJECT_INTROSPECTION_DEPENDENCIES = \ · line 40
Quoted 10 lines
package/gobject-introspection/gobject-introspection.mk +5
-5-# Disable introspection data on the host, as it is not needed and -# the package will attempt to use the systems libglib2 which will fail -# if the systems libglib2 version is older than 2.60. -HOST_GOBJECT_INTROSPECTION_CONF_OPTS = \ - -Denable-introspection-data=false +# g-ir-scanner will default to /usr/bin/ld for linking if this is not set, +# which will cause gobject-introspection to attempt to link against the hosts +# libglib2 +HOST_GOBJECT_INTROSPECTION_NINJA_ENV += \ + LD_LIBRARY_PATH="$(HOST_DIR)/lib"
As discussed on IRC: I am not too fond of using LD_LIBRARY_PATH.
In the past, we had problems because of LD_LIBRARY_PATH, so we ditched it and switched to using DT_RPATH embedded in the ELF files.
The real problem here, is to understand why our HOST_LDFLAGS are not passed down through the g-ir toolset. But as someone famously said: "We can always expect GOI to do the wrong thing".
Still LD_LIBRARY_PATH slightly irks me... Instead, I suggest we use LD_RUN_PATH (which existed at least as far back as binutils-2.10, relased in 2000), and you said on IRC that it seemed to work.
Care to dig deeper and respin, please?
Thanks! :-)
Regards,
Yann E. MORIN.
Quoted 9 lines
package/gobject-introspection/gobject-introspection.mk +0
-0# Use the host gi-scanner to prevent the scanner from generating incorrect # elf classes.Signature · 6 lines
2.24.1 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 2/3 package/gobject-introspection: export cc in g-ir-scanner
In reply to aduskett at gmail.comAdam, All,
On 2020-02-21 14:43 -0800, aduskett at gmail.com spake thusly:
Quoted 34 lines
From: Adam Duskett <[email protected]>
Without this export, the host variant of g-ir-scanner will call the host gcc for linking.
For autotools packages, this is not an issue as they use Makefile.introspection, which will export the cross-cc, however for meson, this is not the case, and linking errors occur when meson packages generate .gir and .typelib files.
Signed-off-by Adam Duskett <[email protected]>--- package/gobject-introspection/g-ir-scanner.in | 2 ++ package/gobject-introspection/gobject-introspection.mk | 2 ++ 2 files changed, 4 insertions(+)package/gobject-introspection/g-ir-scanner.in +2
-0@@ -1,6 +1,8 @@ #!/usr/bin/env bash export GI_SCANNER_DISABLE_CACHE=1 +export CC="@TARGET_CC@" + ${HOST_DIR}/bin/g-ir-scanner \ --lib-dirs-envvar=GIR_EXTRA_LIBS_PATH \ --use-binary-wrapper=$(dirname $0)/g-ir-scanner-qemuwrapper \package/gobject-introspection/gobject-introspection.mk +0
-0
package/gobject-introspection/gobject-introspection.mk define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS · line 104
Quoted 4 lines
package/gobject-introspection/gobject-introspection.mk +1
-0@@ -101,6 +101,8 @@ define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS $(INSTALL) -D -m 755 \ $(GOBJECT_INTROSPECTION_PKGDIR)/$(w).in $(STAGING_DIR)/usr/bin/$(w) ) + $(SED) "s%@TARGET_CC@%$(TARGET_CC)%g" $(STAGING_DIR)/usr/bin/g-ir-scanner
That makes the wrapper no longer relocatable... :-(
What about:
export CC="$(dirname "${0}")/@iBASENAME_TARGET_CC@"With:
$(SED) "s%@BASENAME_TARGET_CC@%$(notdir $(TARGET_CC))%g" $(STAGING_DIR)/usr/bin/g-ir-scanner
Regards,
Yann E. MORIN.
Quoted 10 lines
package/gobject-introspection/gobject-introspection.mk +0
-0# Gobject-introspection installs Makefile.introspection in # $(STAGING_DIR)/usr/share which is needed for autotools-based programs to # build .gir and .typelib files. Unfortuantly, gobject-introspection-1.0.pcSignature · 6 lines
2.24.1 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 3/3 package/meson: add gobject-introspection tools to cross-compilation.conf.in
In reply to aduskett at gmail.comAdam, All,
On 2020-02-21 14:43 -0800, aduskett at gmail.com spake thusly:
Quoted 16 lines
From: Adam Duskett <[email protected]>
These paths are hardcoded by default to the host directory; however, because Buildroot is using wrappers for gobject-introspection, the sysroot paths to these tools must be explicitly called instead.
Signed-off-by Adam Duskett <[email protected]>--- package/meson/cross-compilation.conf.in | 2 ++ 1 file changed, 2 insertions(+)package/meson/cross-compilation.conf.in +0
-0
package/meson/cross-compilation.conf.in cpp = '@TARGET_CROSS at g++' · line 13
Quoted 5 lines
package/meson/cross-compilation.conf.in +2
-0@@ -9,6 +9,8 @@ cpp = '@TARGET_CROSS at g++' ar = '@TARGET_CROSS at ar' strip = '@TARGET_CROSS at strip' pkgconfig = '@HOST_DIR@/bin/pkgconf' +g-ir-scanner = '@STAGING_DIR@/usr/bin/g-ir-scanner' +g-ir-compiler = '@STAGING_DIR@/usr/bin/g-ir-compiler'
On first sight, it would seem pretty obvious. However, not so much...
We already had a similar situation with llvm and llvm-config: packages, such as mesa3d, may need to know where it is stored, but we did not want the meson infra to hard-code all these per-package utilities.
Instead, packages that need them can specify them in their FOO_MESON_EXTRA_BINARIES, and they get added to that package's cross-compilation.conf.
So I'd like that the git toolset be handled the same.
Of course, to avoid repeating tedious path, you could have GOI set the variables:
GIR_COMPILER = $(STAGING_DIR)/usr/bin/g-ir-compiler
GIR_SCANNER = $(STAGING_DIR)/usr/bin/g-ir-scannerAnd then packages that need themwould do:
FOO_MESON_EXTRA_BINARIES = \
g-ir-compiler=$(GIR_COMPILER) \
g-ir-scanner=$(GIR_SCANNER)Regards,
Yann E. MORIN.
Quoted 9 lines
package/meson/cross-compilation.conf.in +0
-0[properties] needs_exe_wrapper = trueSignature · 6 lines
2.24.1 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'