Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/gobject-introspection: fix host version of .pc file for wrapper
@ 2020-05-02  6:04 James Hilliard
  2020-05-02 12:32 ` Thomas Petazzoni
  0 siblings, 1 reply; 11+ messages in thread
From: James Hilliard @ 2020-05-02  6:04 UTC (permalink / raw)
  To: buildroot

Since meson searches for gobject-introspection-1.0.pc in the host
pkgconfig PKG_CONFIG_LIBDIR we need to make sure it is useable.

Fixes:
http://autobuild.buildroot.net/results/90a/90a422419030f9e4408f2783d9e0e5c1f8922b66/build-end.log

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 .../gobject-introspection.mk                  | 30 +++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/package/gobject-introspection/gobject-introspection.mk b/package/gobject-introspection/gobject-introspection.mk
index eefb2c83f7..d98eaf945a 100644
--- a/package/gobject-introspection/gobject-introspection.mk
+++ b/package/gobject-introspection/gobject-introspection.mk
@@ -136,6 +136,36 @@ define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
 endef
 GOBJECT_INTROSPECTION_POST_INSTALL_STAGING_HOOKS += GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
 
+define HOST_GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
+	# Set prefix to /usr because pkg-config appends the sysroot directory
+	$(SED) "s%^prefix=.*%prefix=\/usr%g" \
+		$(HOST_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc
+	# 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
+	# uses $(prefix)/share as the directory, which
+	# causes the host /usr/share being used instead of $(STAGING_DIR)/usr/share.
+	# Change datarootdir to $(libdir)/../share which will prefix $(STAGING_DIR)
+	# to the correct location.
+	$(SED) "s%datarootdir=.*%datarootdir=\$${libdir}/../share%g" \
+		$(HOST_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc
+
+	# By default, girdir and typelibdir use datadir and libdir as their prefix,
+	# of which pkg-config appends the sysroot directory. This results in files
+	# being installed in $(STAGING_DIR)/$(STAGING_DIR)/path/to/files.
+	# Changing the prefix to exec_prefix prevents this error.
+	$(SED) "s%girdir=.*%girdir=\$${exec_prefix}/share/gir-1.0%g" \
+		$(HOST_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc
+
+	$(SED) "s%typelibdir=.*%typelibdir=\$${exec_prefix}/lib/girepository-1.0%g" \
+		$(HOST_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc
+
+	# Purge host-libffi cflags
+	$(SED) "s%^Cflags:.*%Cflags: -I\$${includedir}/gobject-introspection-1.0 %g" \
+		$(HOST_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc
+endef
+HOST_GOBJECT_INTROSPECTION_POST_INSTALL_HOOKS += HOST_GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
+
 # Only .typelib files are needed to run.
 define GOBJECT_INTROSPECTION_REMOVE_DEVELOPMENT_FILES
 	find $(TARGET_DIR)/usr/share \( -iname "*.gir" -o -iname \*.rnc \) -delete
-- 
2.20.1

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

* [Buildroot] [PATCH 1/1] package/gobject-introspection: fix host version of .pc file for wrapper
  2020-05-02  6:04 [Buildroot] [PATCH 1/1] package/gobject-introspection: fix host version of .pc file for wrapper James Hilliard
@ 2020-05-02 12:32 ` Thomas Petazzoni
  2020-05-02 19:36   ` James Hilliard
  2020-05-03  8:36   ` Nicolas Cavallari
  0 siblings, 2 replies; 11+ messages in thread
From: Thomas Petazzoni @ 2020-05-02 12:32 UTC (permalink / raw)
  To: buildroot

On Sat,  2 May 2020 00:04:35 -0600
James Hilliard <james.hilliard1@gmail.com> wrote:

> diff --git a/package/gobject-introspection/gobject-introspection.mk b/package/gobject-introspection/gobject-introspection.mk
> index eefb2c83f7..d98eaf945a 100644
> --- a/package/gobject-introspection/gobject-introspection.mk
> +++ b/package/gobject-introspection/gobject-introspection.mk
> @@ -136,6 +136,36 @@ define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
>  endef
>  GOBJECT_INTROSPECTION_POST_INSTALL_STAGING_HOOKS += GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
>  
> +define HOST_GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
> +	# Set prefix to /usr because pkg-config appends the sysroot directory
> +	$(SED) "s%^prefix=.*%prefix=\/usr%g" \
> +		$(HOST_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc

No, the host variant of pkg-config should not append the sysroot
directory. If it does, then it is wrong.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH 1/1] package/gobject-introspection: fix host version of .pc file for wrapper
  2020-05-02 12:32 ` Thomas Petazzoni
@ 2020-05-02 19:36   ` James Hilliard
  2020-05-03  6:14     ` James Hilliard
  2020-05-03 11:48     ` Thomas Petazzoni
  2020-05-03  8:36   ` Nicolas Cavallari
  1 sibling, 2 replies; 11+ messages in thread
From: James Hilliard @ 2020-05-02 19:36 UTC (permalink / raw)
  To: buildroot

On Sat, May 2, 2020 at 6:32 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> On Sat,  2 May 2020 00:04:35 -0600
> James Hilliard <james.hilliard1@gmail.com> wrote:
>
> > diff --git a/package/gobject-introspection/gobject-introspection.mk b/package/gobject-introspection/gobject-introspection.mk
> > index eefb2c83f7..d98eaf945a 100644
> > --- a/package/gobject-introspection/gobject-introspection.mk
> > +++ b/package/gobject-introspection/gobject-introspection.mk
> > @@ -136,6 +136,36 @@ define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
> >  endef
> >  GOBJECT_INTROSPECTION_POST_INSTALL_STAGING_HOOKS += GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
> >
> > +define HOST_GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
> > +     # Set prefix to /usr because pkg-config appends the sysroot directory
> > +     $(SED) "s%^prefix=.*%prefix=\/usr%g" \
> > +             $(HOST_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc
>
> No, the host variant of pkg-config should not append the sysroot
> directory. If it does, then it is wrong.
Well this was when building the target package that uses the host
pkgconfig libdir.
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

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

* [Buildroot] [PATCH 1/1] package/gobject-introspection: fix host version of .pc file for wrapper
  2020-05-02 19:36   ` James Hilliard
@ 2020-05-03  6:14     ` James Hilliard
  2020-05-03 11:48     ` Thomas Petazzoni
  1 sibling, 0 replies; 11+ messages in thread
From: James Hilliard @ 2020-05-03  6:14 UTC (permalink / raw)
  To: buildroot

On Sat, May 2, 2020 at 1:36 PM James Hilliard <james.hilliard1@gmail.com> wrote:
>
> On Sat, May 2, 2020 at 6:32 AM Thomas Petazzoni
> <thomas.petazzoni@bootlin.com> wrote:
> >
> > On Sat,  2 May 2020 00:04:35 -0600
> > James Hilliard <james.hilliard1@gmail.com> wrote:
> >
> > > diff --git a/package/gobject-introspection/gobject-introspection.mk b/package/gobject-introspection/gobject-introspection.mk
> > > index eefb2c83f7..d98eaf945a 100644
> > > --- a/package/gobject-introspection/gobject-introspection.mk
> > > +++ b/package/gobject-introspection/gobject-introspection.mk
> > > @@ -136,6 +136,36 @@ define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
> > >  endef
> > >  GOBJECT_INTROSPECTION_POST_INSTALL_STAGING_HOOKS += GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
> > >
> > > +define HOST_GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
> > > +     # Set prefix to /usr because pkg-config appends the sysroot directory
> > > +     $(SED) "s%^prefix=.*%prefix=\/usr%g" \
> > > +             $(HOST_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc
> >
> > No, the host variant of pkg-config should not append the sysroot
> > directory. If it does, then it is wrong.
> Well this was when building the target package that uses the host
> pkgconfig libdir.
I submitted a pull request upstream that would let us fix this a better way:
https://github.com/mesonbuild/meson/pull/7072
> >
> > Thomas
> > --
> > Thomas Petazzoni, CTO, Bootlin
> > Embedded Linux and Kernel engineering
> > https://bootlin.com

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

* [Buildroot] [PATCH 1/1] package/gobject-introspection: fix host version of .pc file for wrapper
  2020-05-02 12:32 ` Thomas Petazzoni
  2020-05-02 19:36   ` James Hilliard
@ 2020-05-03  8:36   ` Nicolas Cavallari
  2020-05-03  8:56     ` James Hilliard
  1 sibling, 1 reply; 11+ messages in thread
From: Nicolas Cavallari @ 2020-05-03  8:36 UTC (permalink / raw)
  To: buildroot

On 02/05/2020 14:32, Thomas Petazzoni wrote:
> On Sat,  2 May 2020 00:04:35 -0600
> James Hilliard <james.hilliard1@gmail.com> wrote:
> 
>> diff --git a/package/gobject-introspection/gobject-introspection.mk b/package/gobject-introspection/gobject-introspection.mk
>> index eefb2c83f7..d98eaf945a 100644
>> --- a/package/gobject-introspection/gobject-introspection.mk
>> +++ b/package/gobject-introspection/gobject-introspection.mk
>> @@ -136,6 +136,36 @@ define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
>>  endef
>>  GOBJECT_INTROSPECTION_POST_INSTALL_STAGING_HOOKS += GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
>>  
>> +define HOST_GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
>> +	# Set prefix to /usr because pkg-config appends the sysroot directory
>> +	$(SED) "s%^prefix=.*%prefix=\/usr%g" \
>> +		$(HOST_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc
> 
> No, the host variant of pkg-config should not append the sysroot
> directory. If it does, then it is wrong.

That's because meson currently uses the target pkg-config with
PKG_CONFIG_PATH=$(HOST_DIR)/lib/pkgconfig to find host packages.

from build/meson-logs/meson-log.txt:

Pkg-config binary for MachineChoice.BUILD is not cached.
None of 'PKG_CONFIG_FOR_BUILD' are defined in the environment, not
changing global flags.
Pkg-config binary missing from cross or native file, or env var undefined.
Trying a default Pkg-config fallback at pkg-config
Trying pkg-config binary pkg-config for machine MachineChoice.BUILD at
['/home/cavallar/br-test-pkg/br-arm-full/host/bin/pkg-config']
Found pkg-config:
/home/cavallar/br-test-pkg/br-arm-full/host/bin/pkg-config (1.6.1)
Determining dependency 'glib-2.0' with pkg-config executable
'/home/cavallar/br-test-pkg/br-arm-full/host/bin/pkg-config'
PKG_CONFIG_PATH: /home/cavallar/br-test-pkg/br-arm-full/host/lib/pkgconfig
Called `/home/cavallar/br-test-pkg/br-arm-full/host/bin/pkg-config
--modversion glib-2.0` -> 0
2.64.2
PKG_CONFIG_PATH: /home/cavallar/br-test-pkg/br-arm-full/host/lib/pkgconfig
Called `/home/cavallar/br-test-pkg/br-arm-full/host/bin/pkg-config
--cflags glib-2.0` -> 0
-I/home/cavallar/br-test-pkg/br-arm-full/host/bin/../arm-buildroot-linux-uclibcgnueabi/sysroot/home/cavallar/br-test-pkg/br-arm-full/host/include/glib-2.0
-I/home/cavallar/br-test-pkg/br-arm-full/host/bin/../arm-buildroot-linux-uclibcgnueabi/sysroot/home/cavallar/br-test-pkg/br-arm-full/host/lib/glib-2.0/include
-I/home/cavallar/br-test-pkg/br-arm-full/host/bin/../arm-buildroot-linux-uclibcgnueabi/sysroot/home/cavallar/br-test-pkg/br-arm-full/host/include


Compared to the target pkg-config, which is found correctly:


Pkg-config binary for MachineChoice.HOST is not cached.
Pkg-config binary for MachineChoice.HOST specified from cross file,
native file, or env var as
['/home/cavallar/br-test-pkg/br-arm-full/host/bin/pkgconf']
Trying pkg-config binary pkgconfig for machine MachineChoice.HOST at
['/home/cavallar/br-test-pkg/br-arm-full/host/bin/pkgconf']
Found pkg-config:
/home/cavallar/br-test-pkg/br-arm-full/host/bin/pkgconf (1.6.1)
Determining dependency 'glib-2.0' with pkg-config executable
'/home/cavallar/br-test-pkg/br-arm-full/host/bin/pkgconf'
PKG_CONFIG_PATH:
PKG_CONFIG_LIBDIR:
/home/cavallar/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/pkgconfig:/home/cavallar/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/share/pkgconfig
Called `/home/cavallar/br-test-pkg/br-arm-full/host/bin/pkgconf
--modversion glib-2.0` -> 0
2.64.2
PKG_CONFIG_PATH:
PKG_CONFIG_LIBDIR:
/home/cavallar/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/pkgconfig:/home/cavallar/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/share/pkgconfig
Called `/home/cavallar/br-test-pkg/br-arm-full/host/bin/pkgconf --cflags
glib-2.0` -> 0
-I/home/cavallar/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/glib-2.0
-I/home/cavallar/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/glib-2.0/include
-I/home/cavallar/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include

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

* [Buildroot] [PATCH 1/1] package/gobject-introspection: fix host version of .pc file for wrapper
  2020-05-03  8:36   ` Nicolas Cavallari
@ 2020-05-03  8:56     ` James Hilliard
  0 siblings, 0 replies; 11+ messages in thread
From: James Hilliard @ 2020-05-03  8:56 UTC (permalink / raw)
  To: buildroot

On Sun, May 3, 2020 at 2:36 AM Nicolas Cavallari
<nicolas.cavallari@green-communications.fr> wrote:
>
> On 02/05/2020 14:32, Thomas Petazzoni wrote:
> > On Sat,  2 May 2020 00:04:35 -0600
> > James Hilliard <james.hilliard1@gmail.com> wrote:
> >
> >> diff --git a/package/gobject-introspection/gobject-introspection.mk b/package/gobject-introspection/gobject-introspection.mk
> >> index eefb2c83f7..d98eaf945a 100644
> >> --- a/package/gobject-introspection/gobject-introspection.mk
> >> +++ b/package/gobject-introspection/gobject-introspection.mk
> >> @@ -136,6 +136,36 @@ define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
> >>  endef
> >>  GOBJECT_INTROSPECTION_POST_INSTALL_STAGING_HOOKS += GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
> >>
> >> +define HOST_GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
> >> +    # Set prefix to /usr because pkg-config appends the sysroot directory
> >> +    $(SED) "s%^prefix=.*%prefix=\/usr%g" \
> >> +            $(HOST_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc
> >
> > No, the host variant of pkg-config should not append the sysroot
> > directory. If it does, then it is wrong.
>
> That's because meson currently uses the target pkg-config with
> PKG_CONFIG_PATH=$(HOST_DIR)/lib/pkgconfig to find host packages.
Right, so native: true dependencies like g-ir-scanner are searched for in the
$(HOST_DIR)/lib/pkgconfig while we currently only have a working wrapper
that can be found by looking in the target pkg-config libdir.
>
> from build/meson-logs/meson-log.txt:
>
> Pkg-config binary for MachineChoice.BUILD is not cached.
> None of 'PKG_CONFIG_FOR_BUILD' are defined in the environment, not
> changing global flags.
> Pkg-config binary missing from cross or native file, or env var undefined.
> Trying a default Pkg-config fallback at pkg-config
> Trying pkg-config binary pkg-config for machine MachineChoice.BUILD at
> ['/home/cavallar/br-test-pkg/br-arm-full/host/bin/pkg-config']
> Found pkg-config:
> /home/cavallar/br-test-pkg/br-arm-full/host/bin/pkg-config (1.6.1)
> Determining dependency 'glib-2.0' with pkg-config executable
> '/home/cavallar/br-test-pkg/br-arm-full/host/bin/pkg-config'
> PKG_CONFIG_PATH: /home/cavallar/br-test-pkg/br-arm-full/host/lib/pkgconfig
> Called `/home/cavallar/br-test-pkg/br-arm-full/host/bin/pkg-config
> --modversion glib-2.0` -> 0
> 2.64.2
> PKG_CONFIG_PATH: /home/cavallar/br-test-pkg/br-arm-full/host/lib/pkgconfig
> Called `/home/cavallar/br-test-pkg/br-arm-full/host/bin/pkg-config
> --cflags glib-2.0` -> 0
> -I/home/cavallar/br-test-pkg/br-arm-full/host/bin/../arm-buildroot-linux-uclibcgnueabi/sysroot/home/cavallar/br-test-pkg/br-arm-full/host/include/glib-2.0
> -I/home/cavallar/br-test-pkg/br-arm-full/host/bin/../arm-buildroot-linux-uclibcgnueabi/sysroot/home/cavallar/br-test-pkg/br-arm-full/host/lib/glib-2.0/include
> -I/home/cavallar/br-test-pkg/br-arm-full/host/bin/../arm-buildroot-linux-uclibcgnueabi/sysroot/home/cavallar/br-test-pkg/br-arm-full/host/include
>
>
> Compared to the target pkg-config, which is found correctly:
Yeah, so basically what I was trying to do here was make the host
gobject pc file
identical to the target version since different packages/build systems look for
that in different places.
>
>
> Pkg-config binary for MachineChoice.HOST is not cached.
> Pkg-config binary for MachineChoice.HOST specified from cross file,
> native file, or env var as
> ['/home/cavallar/br-test-pkg/br-arm-full/host/bin/pkgconf']
> Trying pkg-config binary pkgconfig for machine MachineChoice.HOST at
> ['/home/cavallar/br-test-pkg/br-arm-full/host/bin/pkgconf']
> Found pkg-config:
> /home/cavallar/br-test-pkg/br-arm-full/host/bin/pkgconf (1.6.1)
> Determining dependency 'glib-2.0' with pkg-config executable
> '/home/cavallar/br-test-pkg/br-arm-full/host/bin/pkgconf'
> PKG_CONFIG_PATH:
> PKG_CONFIG_LIBDIR:
> /home/cavallar/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/pkgconfig:/home/cavallar/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/share/pkgconfig
> Called `/home/cavallar/br-test-pkg/br-arm-full/host/bin/pkgconf
> --modversion glib-2.0` -> 0
> 2.64.2
> PKG_CONFIG_PATH:
> PKG_CONFIG_LIBDIR:
> /home/cavallar/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/pkgconfig:/home/cavallar/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/share/pkgconfig
> Called `/home/cavallar/br-test-pkg/br-arm-full/host/bin/pkgconf --cflags
> glib-2.0` -> 0
> -I/home/cavallar/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/glib-2.0
> -I/home/cavallar/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/glib-2.0/include
> -I/home/cavallar/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include

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

* [Buildroot] [PATCH 1/1] package/gobject-introspection: fix host version of .pc file for wrapper
  2020-05-02 19:36   ` James Hilliard
  2020-05-03  6:14     ` James Hilliard
@ 2020-05-03 11:48     ` Thomas Petazzoni
  2020-05-03 11:56       ` James Hilliard
  2020-05-03 17:10       ` Nicolas Cavallari
  1 sibling, 2 replies; 11+ messages in thread
From: Thomas Petazzoni @ 2020-05-03 11:48 UTC (permalink / raw)
  To: buildroot

Hello James,

On Sat, 2 May 2020 13:36:04 -0600
James Hilliard <james.hilliard1@gmail.com> wrote:

> > > +define HOST_GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
> > > +     # Set prefix to /usr because pkg-config appends the sysroot directory
> > > +     $(SED) "s%^prefix=.*%prefix=\/usr%g" \
> > > +             $(HOST_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc  
> >
> > No, the host variant of pkg-config should not append the sysroot
> > directory. If it does, then it is wrong.  
> Well this was when building the target package that uses the host
> pkgconfig libdir.

And? According to 4e0bc29993376613d200e892d491e31ea5a49622, Meson has
some understanding of when it is using pkg-config to find libraries to
build native code or to build target code.

As you can see in this commit:

-pkgconfig = '@HOST_DIR@/usr/bin/pkg-config'
+pkgconfig = '@HOST_DIR@/bin/pkgconf'

Meson is no longer going through our pkg-config wrapper that passes the
right environment variables to ensure pkg-config returns values valid
for building target code.

Since Meson goes through $(HOST_DIR)/bin/pkgconf directly, we do not
pass any specific sysroot argument to pkg-config. It is up to Meson to
pass the appropriate sysroot value when working with target code, and
to not pass any sysroot value when working on native code.

See the commit log of 4e0bc29993376613d200e892d491e31ea5a49622:

    meson is able to distinguish between host (= native) and target (=
    cross) compilation. It will explicitly pass different options to
    pkg-config to distinguish them. Therefore, we don't need to use the
    pkg-config wrapper when using meson, and can instead pass the pkg-config
    settings through the cross-compilation.conf.
    
    This is important because in some situations (e.g. for the Python
    configuration), meson sets the PKG_CONFIG_LIBDIR variable to a different
    value before calling pkg-config. Relying on our wrapper script doesn't
    work in that case (except if the script would unconditionally set
    PKG_CONFIG_LIBDIR, which it doesn't do at the moment).
    
    Add the sys_root and pkg_config_lib settings to cross-compilation.conf
    and use pkgconf directly instead of the wrapper.
    
    Note that this requires us to substitute STAGING_DIR as well, with an
    absolute path. This is not a big deal since cross-compilation.conf is
    regenerated for every package.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH 1/1] package/gobject-introspection: fix host version of .pc file for wrapper
  2020-05-03 11:48     ` Thomas Petazzoni
@ 2020-05-03 11:56       ` James Hilliard
  2020-05-03 17:10       ` Nicolas Cavallari
  1 sibling, 0 replies; 11+ messages in thread
From: James Hilliard @ 2020-05-03 11:56 UTC (permalink / raw)
  To: buildroot

On Sun, May 3, 2020 at 5:48 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello James,
>
> On Sat, 2 May 2020 13:36:04 -0600
> James Hilliard <james.hilliard1@gmail.com> wrote:
>
> > > > +define HOST_GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
> > > > +     # Set prefix to /usr because pkg-config appends the sysroot directory
> > > > +     $(SED) "s%^prefix=.*%prefix=\/usr%g" \
> > > > +             $(HOST_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc
> > >
> > > No, the host variant of pkg-config should not append the sysroot
> > > directory. If it does, then it is wrong.
> > Well this was when building the target package that uses the host
> > pkgconfig libdir.
>
> And? According to 4e0bc29993376613d200e892d491e31ea5a49622, Meson has
> some understanding of when it is using pkg-config to find libraries to
> build native code or to build target code.
Right, that's not the problem, the problem is we install g-ir-scanner wrappers
only to target, in meson for some reason g-ir-scanner is considered a native
dependency and hence meson looks for the host version rather than the target.
See here:
https://github.com/mesonbuild/meson/blob/0.54.1/mesonbuild/modules/gnome.py#L420
>
> As you can see in this commit:
>
> -pkgconfig = '@HOST_DIR@/usr/bin/pkg-config'
> +pkgconfig = '@HOST_DIR@/bin/pkgconf'
>
> Meson is no longer going through our pkg-config wrapper that passes the
> right environment variables to ensure pkg-config returns values valid
> for building target code.
>
> Since Meson goes through $(HOST_DIR)/bin/pkgconf directly, we do not
> pass any specific sysroot argument to pkg-config. It is up to Meson to
> pass the appropriate sysroot value when working with target code, and
> to not pass any sysroot value when working on native code.
>
> See the commit log of 4e0bc29993376613d200e892d491e31ea5a49622:
>
>     meson is able to distinguish between host (= native) and target (=
>     cross) compilation. It will explicitly pass different options to
>     pkg-config to distinguish them. Therefore, we don't need to use the
>     pkg-config wrapper when using meson, and can instead pass the pkg-config
>     settings through the cross-compilation.conf.
>
>     This is important because in some situations (e.g. for the Python
>     configuration), meson sets the PKG_CONFIG_LIBDIR variable to a different
>     value before calling pkg-config. Relying on our wrapper script doesn't
>     work in that case (except if the script would unconditionally set
>     PKG_CONFIG_LIBDIR, which it doesn't do at the moment).
>
>     Add the sys_root and pkg_config_lib settings to cross-compilation.conf
>     and use pkgconf directly instead of the wrapper.
>
>     Note that this requires us to substitute STAGING_DIR as well, with an
>     absolute path. This is not a big deal since cross-compilation.conf is
>     regenerated for every package.
>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

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

* [Buildroot] [PATCH 1/1] package/gobject-introspection: fix host version of .pc file for wrapper
  2020-05-03 11:48     ` Thomas Petazzoni
  2020-05-03 11:56       ` James Hilliard
@ 2020-05-03 17:10       ` Nicolas Cavallari
  2020-05-03 19:45         ` Thomas Petazzoni
  1 sibling, 1 reply; 11+ messages in thread
From: Nicolas Cavallari @ 2020-05-03 17:10 UTC (permalink / raw)
  To: buildroot

On 03/05/2020 13:48, Thomas Petazzoni wrote:
> Hello James,
> 
> On Sat, 2 May 2020 13:36:04 -0600
> James Hilliard <james.hilliard1@gmail.com> wrote:
> 
>>>> +define HOST_GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
>>>> +     # Set prefix to /usr because pkg-config appends the sysroot directory
>>>> +     $(SED) "s%^prefix=.*%prefix=\/usr%g" \
>>>> +             $(HOST_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc  
>>>
>>> No, the host variant of pkg-config should not append the sysroot
>>> directory. If it does, then it is wrong.  
>> Well this was when building the target package that uses the host
>> pkgconfig libdir.
> 
> And? According to 4e0bc29993376613d200e892d491e31ea5a49622, Meson has
> some understanding of when it is using pkg-config to find libraries to
> build native code or to build target code.
> 
> As you can see in this commit:
> 
> -pkgconfig = '@HOST_DIR@/usr/bin/pkg-config'
> +pkgconfig = '@HOST_DIR@/bin/pkgconf'
> 
> Meson is no longer going through our pkg-config wrapper that passes the
> right environment variables to ensure pkg-config returns values valid
> for building target code.
> 
> Since Meson goes through $(HOST_DIR)/bin/pkgconf directly, we do not
> pass any specific sysroot argument to pkg-config. It is up to Meson to
> pass the appropriate sysroot value when working with target code, and
> to not pass any sysroot value when working on native code.

Look at the logs i posted in this thread. meson uses the 'pkgconfig' in
the cross-file only when finding target libraries. It does not use it
when finding native libraries.

Instead, for native libraries, it expects a native-file, which we don't
provide. As a fallback, it searches for $PKG_CONFIG_FOR_BUILD,
$PKG_CONFIG, or for a 'pkg-config' in $PATH. And we have a pkg-config in
$PATH, it is the target pkgconf wrapper.

The fix in 4e0bc29993376613d200e892d491e31ea5a49622 does not work.
Meson still uses the pkg-config wrapper when working with native code.

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

* [Buildroot] [PATCH 1/1] package/gobject-introspection: fix host version of .pc file for wrapper
  2020-05-03 17:10       ` Nicolas Cavallari
@ 2020-05-03 19:45         ` Thomas Petazzoni
  2020-05-03 22:53           ` James Hilliard
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Petazzoni @ 2020-05-03 19:45 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 3 May 2020 19:10:36 +0200
Nicolas Cavallari <nicolas.cavallari@green-communications.fr> wrote:

> > Since Meson goes through $(HOST_DIR)/bin/pkgconf directly, we do not
> > pass any specific sysroot argument to pkg-config. It is up to Meson to
> > pass the appropriate sysroot value when working with target code, and
> > to not pass any sysroot value when working on native code.  
> 
> Look at the logs i posted in this thread. meson uses the 'pkgconfig' in
> the cross-file only when finding target libraries. It does not use it
> when finding native libraries.
> 
> Instead, for native libraries, it expects a native-file, which we don't
> provide. As a fallback, it searches for $PKG_CONFIG_FOR_BUILD,
> $PKG_CONFIG, or for a 'pkg-config' in $PATH. And we have a pkg-config in
> $PATH, it is the target pkgconf wrapper.
> 
> The fix in 4e0bc29993376613d200e892d491e31ea5a49622 does not work.
> Meson still uses the pkg-config wrapper when working with native code.

Indeed, all what you explain here seems to contradict exactly what
4e0bc29993376613d200e892d491e31ea5a49622 claims. Arnout, do you have
the time to discuss this with us ?

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH 1/1] package/gobject-introspection: fix host version of .pc file for wrapper
  2020-05-03 19:45         ` Thomas Petazzoni
@ 2020-05-03 22:53           ` James Hilliard
  0 siblings, 0 replies; 11+ messages in thread
From: James Hilliard @ 2020-05-03 22:53 UTC (permalink / raw)
  To: buildroot

On Sun, May 3, 2020 at 1:45 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello,
>
> On Sun, 3 May 2020 19:10:36 +0200
> Nicolas Cavallari <nicolas.cavallari@green-communications.fr> wrote:
>
> > > Since Meson goes through $(HOST_DIR)/bin/pkgconf directly, we do not
> > > pass any specific sysroot argument to pkg-config. It is up to Meson to
> > > pass the appropriate sysroot value when working with target code, and
> > > to not pass any sysroot value when working on native code.
> >
> > Look at the logs i posted in this thread. meson uses the 'pkgconfig' in
> > the cross-file only when finding target libraries. It does not use it
> > when finding native libraries.
> >
> > Instead, for native libraries, it expects a native-file, which we don't
> > provide. As a fallback, it searches for $PKG_CONFIG_FOR_BUILD,
> > $PKG_CONFIG, or for a 'pkg-config' in $PATH. And we have a pkg-config in
> > $PATH, it is the target pkgconf wrapper.
> >
> > The fix in 4e0bc29993376613d200e892d491e31ea5a49622 does not work.
> > Meson still uses the pkg-config wrapper when working with native code.
>
> Indeed, all what you explain here seems to contradict exactly what
> 4e0bc29993376613d200e892d491e31ea5a49622 claims. Arnout, do you have
> the time to discuss this with us ?
I don't think this problem is related to that at all, what happened
was the fix in
5cff3a8bdfba92e9f61d0984df08f1ecd205c072 triggered this issue because
the gobject-introspection wrappers are only found by meson for native: false
pkgconfig search paths, while the meson gnome module looks for them only
under native: true pkgconfig search paths. I see 2 ways of fixing
this, basically
override the search path for the wrappers specifically or make it so that the
native: true pkgconfig search paths find valid wrappers in the same way as
the native: false search path does.
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

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

end of thread, other threads:[~2020-05-03 22:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-02  6:04 [Buildroot] [PATCH 1/1] package/gobject-introspection: fix host version of .pc file for wrapper James Hilliard
2020-05-02 12:32 ` Thomas Petazzoni
2020-05-02 19:36   ` James Hilliard
2020-05-03  6:14     ` James Hilliard
2020-05-03 11:48     ` Thomas Petazzoni
2020-05-03 11:56       ` James Hilliard
2020-05-03 17:10       ` Nicolas Cavallari
2020-05-03 19:45         ` Thomas Petazzoni
2020-05-03 22:53           ` James Hilliard
2020-05-03  8:36   ` Nicolas Cavallari
2020-05-03  8:56     ` James Hilliard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox