All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/3] package/gobject-introspection: fix meson support
@ 2020-02-21 22:43 aduskett at gmail.com
  2020-02-21 22:43 ` [Buildroot] [PATCH 1/3] package/gobject-introspection: fix host-linking aduskett at gmail.com
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: aduskett at gmail.com @ 2020-02-21 22:43 UTC (permalink / raw)
  To: buildroot

From: Adam Duskett <Aduskett@gmail.com>

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(-)

-- 
2.24.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/3] package/gobject-introspection: fix host-linking
  2020-02-21 22:43 [Buildroot] [PATCH 0/3] package/gobject-introspection: fix meson support aduskett at gmail.com
@ 2020-02-21 22:43 ` aduskett at gmail.com
  2020-02-23 20:41   ` Yann E. MORIN
  2020-02-21 22:43 ` [Buildroot] [PATCH 2/3] package/gobject-introspection: export cc in g-ir-scanner aduskett at gmail.com
  2020-02-21 22:43 ` [Buildroot] [PATCH 3/3] package/meson: add gobject-introspection tools to cross-compilation.conf.in aduskett at gmail.com
  2 siblings, 1 reply; 7+ messages in thread
From: aduskett at gmail.com @ 2020-02-21 22:43 UTC (permalink / raw)
  To: buildroot

From: Adam Duskett <Aduskett@gmail.com>

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.

Signed-off-by: Adam Duskett <Aduskett@gmail.com>
---
 package/gobject-introspection/gobject-introspection.mk | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/package/gobject-introspection/gobject-introspection.mk b/package/gobject-introspection/gobject-introspection.mk
index 67e5e37dee..e719588437 100644
--- a/package/gobject-introspection/gobject-introspection.mk
+++ b/package/gobject-introspection/gobject-introspection.mk
@@ -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.
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 2/3] package/gobject-introspection: export cc in g-ir-scanner
  2020-02-21 22:43 [Buildroot] [PATCH 0/3] package/gobject-introspection: fix meson support aduskett at gmail.com
  2020-02-21 22:43 ` [Buildroot] [PATCH 1/3] package/gobject-introspection: fix host-linking aduskett at gmail.com
@ 2020-02-21 22:43 ` aduskett at gmail.com
  2020-02-23 20:45   ` Yann E. MORIN
  2020-02-21 22:43 ` [Buildroot] [PATCH 3/3] package/meson: add gobject-introspection tools to cross-compilation.conf.in aduskett at gmail.com
  2 siblings, 1 reply; 7+ messages in thread
From: aduskett at gmail.com @ 2020-02-21 22:43 UTC (permalink / raw)
  To: buildroot

From: Adam Duskett <Aduskett@gmail.com>

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 <Aduskett@gmail.com>
---
 package/gobject-introspection/g-ir-scanner.in          | 2 ++
 package/gobject-introspection/gobject-introspection.mk | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/package/gobject-introspection/g-ir-scanner.in b/package/gobject-introspection/g-ir-scanner.in
index 9f97497b7e..c5066bd635 100644
--- a/package/gobject-introspection/g-ir-scanner.in
+++ b/package/gobject-introspection/g-ir-scanner.in
@@ -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 \
diff --git a/package/gobject-introspection/gobject-introspection.mk b/package/gobject-introspection/gobject-introspection.mk
index e719588437..b24441b87a 100644
--- a/package/gobject-introspection/gobject-introspection.mk
+++ b/package/gobject-introspection/gobject-introspection.mk
@@ -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
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 3/3] package/meson: add gobject-introspection tools to cross-compilation.conf.in
  2020-02-21 22:43 [Buildroot] [PATCH 0/3] package/gobject-introspection: fix meson support aduskett at gmail.com
  2020-02-21 22:43 ` [Buildroot] [PATCH 1/3] package/gobject-introspection: fix host-linking aduskett at gmail.com
  2020-02-21 22:43 ` [Buildroot] [PATCH 2/3] package/gobject-introspection: export cc in g-ir-scanner aduskett at gmail.com
@ 2020-02-21 22:43 ` aduskett at gmail.com
  2020-02-23 20:58   ` Yann E. MORIN
  2 siblings, 1 reply; 7+ messages in thread
From: aduskett at gmail.com @ 2020-02-21 22:43 UTC (permalink / raw)
  To: buildroot

From: Adam Duskett <Aduskett@gmail.com>

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 <Aduskett@gmail.com>
---
 package/meson/cross-compilation.conf.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/package/meson/cross-compilation.conf.in b/package/meson/cross-compilation.conf.in
index 369e225b3e..565ea67240 100644
--- a/package/meson/cross-compilation.conf.in
+++ b/package/meson/cross-compilation.conf.in
@@ -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
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/3] package/gobject-introspection: fix host-linking
  2020-02-21 22:43 ` [Buildroot] [PATCH 1/3] package/gobject-introspection: fix host-linking aduskett at gmail.com
@ 2020-02-23 20:41   ` Yann E. MORIN
  0 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2020-02-23 20:41 UTC (permalink / raw)
  To: buildroot

Adam, All,

On 2020-02-21 14:43 -0800, aduskett at gmail.com spake thusly:
> From: Adam Duskett <Aduskett@gmail.com>
> 
> 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.
> 
> Signed-off-by: Adam Duskett <Aduskett@gmail.com>
> ---
>  package/gobject-introspection/gobject-introspection.mk | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/package/gobject-introspection/gobject-introspection.mk b/package/gobject-introspection/gobject-introspection.mk
> index 67e5e37dee..e719588437 100644
> --- a/package/gobject-introspection/gobject-introspection.mk
> +++ b/package/gobject-introspection/gobject-introspection.mk
> @@ -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"

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.

>  # Use the host gi-scanner to prevent the scanner from generating incorrect
>  # elf classes.
> -- 
> 2.24.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 2/3] package/gobject-introspection: export cc in g-ir-scanner
  2020-02-21 22:43 ` [Buildroot] [PATCH 2/3] package/gobject-introspection: export cc in g-ir-scanner aduskett at gmail.com
@ 2020-02-23 20:45   ` Yann E. MORIN
  0 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2020-02-23 20:45 UTC (permalink / raw)
  To: buildroot

Adam, All,

On 2020-02-21 14:43 -0800, aduskett at gmail.com spake thusly:
> From: Adam Duskett <Aduskett@gmail.com>
> 
> 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 <Aduskett@gmail.com>
> ---
>  package/gobject-introspection/g-ir-scanner.in          | 2 ++
>  package/gobject-introspection/gobject-introspection.mk | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/package/gobject-introspection/g-ir-scanner.in b/package/gobject-introspection/g-ir-scanner.in
> index 9f97497b7e..c5066bd635 100644
> --- a/package/gobject-introspection/g-ir-scanner.in
> +++ b/package/gobject-introspection/g-ir-scanner.in
> @@ -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 \
> diff --git a/package/gobject-introspection/gobject-introspection.mk b/package/gobject-introspection/gobject-introspection.mk
> index e719588437..b24441b87a 100644
> --- a/package/gobject-introspection/gobject-introspection.mk
> +++ b/package/gobject-introspection/gobject-introspection.mk
> @@ -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.

>  	# 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
> -- 
> 2.24.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 3/3] package/meson: add gobject-introspection tools to cross-compilation.conf.in
  2020-02-21 22:43 ` [Buildroot] [PATCH 3/3] package/meson: add gobject-introspection tools to cross-compilation.conf.in aduskett at gmail.com
@ 2020-02-23 20:58   ` Yann E. MORIN
  0 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2020-02-23 20:58 UTC (permalink / raw)
  To: buildroot

Adam, All,

On 2020-02-21 14:43 -0800, aduskett at gmail.com spake thusly:
> From: Adam Duskett <Aduskett@gmail.com>
> 
> 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 <Aduskett@gmail.com>
> ---
>  package/meson/cross-compilation.conf.in | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/package/meson/cross-compilation.conf.in b/package/meson/cross-compilation.conf.in
> index 369e225b3e..565ea67240 100644
> --- a/package/meson/cross-compilation.conf.in
> +++ b/package/meson/cross-compilation.conf.in
> @@ -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-scanner

And then packages that need themwould do:

    FOO_MESON_EXTRA_BINARIES = \
        g-ir-compiler=$(GIR_COMPILER) \
        g-ir-scanner=$(GIR_SCANNER)

Regards,
Yann E. MORIN.

>  [properties]
>  needs_exe_wrapper = true
> -- 
> 2.24.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-02-23 20:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-21 22:43 [Buildroot] [PATCH 0/3] package/gobject-introspection: fix meson support aduskett at gmail.com
2020-02-21 22:43 ` [Buildroot] [PATCH 1/3] package/gobject-introspection: fix host-linking aduskett at gmail.com
2020-02-23 20:41   ` Yann E. MORIN
2020-02-21 22:43 ` [Buildroot] [PATCH 2/3] package/gobject-introspection: export cc in g-ir-scanner aduskett at gmail.com
2020-02-23 20:45   ` Yann E. MORIN
2020-02-21 22:43 ` [Buildroot] [PATCH 3/3] package/meson: add gobject-introspection tools to cross-compilation.conf.in aduskett at gmail.com
2020-02-23 20:58   ` Yann E. MORIN

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.