Skip to contentSkip to conversation

package/gobject-introspection: fix host version of .pc file for wrapper

PATCH New James Hilliard 3 participants 11 messages May 2, 2020 – May 3, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/gobject-introspection: fix host version of .pc file for wrapper

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

---
 .../gobject-introspection.mk                  | 30 +++++++++++++++++++
 1 file changed, 30 insertions(+)
package/gobject-introspection/gobject-introspection.mk +30 -0
index eefb2c83f7..d98eaf945a 100644
@@ -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
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 package/gobject-introspection: fix host version of .pc file for wrapper

package/gobject-introspection/gobject-introspection.mk define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS · line 142

Quoted 12 lines · On Sat, 2 May 2020 00:04:35 -0600 James Hilliard <[email protected]>…
package/gobject-introspection/gobject-introspection.mk +4 -0
index eefb2c83f7..d98eaf945a 100644
@@ -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

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 package/gobject-introspection: fix host version of .pc file for wrapper

Quoted 12 lines · Thomas Petazzoni
Quoted 8 lines · On Sat, 2 May 2020 00:04:35 -0600 James Hilliard <[email protected]>…
package/gobject-introspection/gobject-introspection.mk +0 -0
index eefb2c83f7..d98eaf945a 100644
@@ -136,6 +136,36 @@ define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
 endef
 GOBJECT_INTROSPECTION_POST_INSTALL_STAGING_HOOKS += GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
 
Quoted 7 lines

package/gobject-introspection/gobject-introspection.mk define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS · line 142

Quoted 4 lines
package/gobject-introspection/gobject-introspection.mk +4 -0
+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.

Quoted 6 lines

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

#3 lore raw

PATCH 1/1 package/gobject-introspection: fix host version of .pc file for wrapper

Quoted 22 lines · James Hilliard
Quoted 12 lines · Thomas Petazzoni
Quoted 8 lines · On Sat, 2 May 2020 00:04:35 -0600 James Hilliard <[email protected]>…
package/gobject-introspection/gobject-introspection.mk +0 -0
index eefb2c83f7..d98eaf945a 100644
@@ -136,6 +136,36 @@ define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
 endef
 GOBJECT_INTROSPECTION_POST_INSTALL_STAGING_HOOKS += GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
 
Quoted 7 lines

package/gobject-introspection/gobject-introspection.mk define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS · line 142

Quoted 4 lines
package/gobject-introspection/gobject-introspection.mk +4 -0
+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.

Quoted 2 lines

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

Quoted 6 lines
Quoted 6 lines

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

#4 lore raw

PATCH 1/1 package/gobject-introspection: fix host version of .pc file for wrapper

In reply to James Hilliard

Hello James,

Quoted 9 lines · On Sat, 2 May 2020 13:36:04 -0600 James Hilliard <[email protected]>…
Quoted 7 lines

package/gobject-introspection/gobject-introspection.mk define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS · line 142

Quoted 4 lines
package/gobject-introspection/gobject-introspection.mk +4 -0
+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

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#5 lore raw

PATCH 1/1 package/gobject-introspection: fix host version of .pc file for wrapper

Quoted 11 lines · Thomas Petazzoni

Hello James,

Quoted 5 lines · On Sat, 2 May 2020 13:36:04 -0600 James Hilliard <[email protected]>…
Quoted 5 lines
Quoted 4 lines
package/gobject-introspection/gobject-introspection.mk +4 -0
+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
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

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

Quoted 43 lines

As you can see in this commit:

(quoted diff) +1 -1
-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

#6 lore raw

PATCH 1/1 package/gobject-introspection: fix host version of .pc file for wrapper

In reply to Thomas Petazzoni
Quoted 24 lines · Thomas Petazzoni

Hello James,

Quoted 9 lines · On Sat, 2 May 2020 13:36:04 -0600 James Hilliard <[email protected]>…
Quoted 7 lines

package/gobject-introspection/gobject-introspection.mk define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS · line 142

Quoted 4 lines
package/gobject-introspection/gobject-introspection.mk +4 -0
+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:

(quoted diff) +1 -1
-pkgconfig = '@HOST_DIR@/usr/bin/pkg-config'
+pkgconfig = '@HOST_DIR@/bin/pkgconf'
Quoted 8 lines

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.

#7 lore raw

PATCH 1/1 package/gobject-introspection: fix host version of .pc file for wrapper

Hello,

Quoted 9 lines · On Sun, 3 May 2020 19:10:36 +0200 Nicolas Cavallari…
Quoted 4 lines

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.

Quoted 7 lines

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

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#8 lore raw

PATCH 1/1 package/gobject-introspection: fix host version of .pc file for wrapper

Quoted 20 lines · Thomas Petazzoni

Hello,

Quoted 14 lines · On Sun, 3 May 2020 19:10:36 +0200 Nicolas Cavallari…
Quoted 4 lines

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.

Quoted 6 lines
Quoted 2 lines

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.

Quoted 6 lines

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

#9 lore raw

PATCH 1/1 package/gobject-introspection: fix host version of .pc file for wrapper

In reply to Thomas Petazzoni
Quoted 11 lines · Thomas Petazzoni
Quoted 8 lines · On Sat, 2 May 2020 00:04:35 -0600 James Hilliard <[email protected]>…
package/gobject-introspection/gobject-introspection.mk +0 -0
index eefb2c83f7..d98eaf945a 100644
@@ -136,6 +136,36 @@ define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
 endef
 GOBJECT_INTROSPECTION_POST_INSTALL_STAGING_HOOKS += GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
 
Quoted 7 lines

package/gobject-introspection/gobject-introspection.mk define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS · line 142

Quoted 4 lines
package/gobject-introspection/gobject-introspection.mk +4 -0
+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

#10 lore raw

PATCH 1/1 package/gobject-introspection: fix host version of .pc file for wrapper

Quoted 21 lines · Nicolas Cavallari
Quoted 11 lines · Thomas Petazzoni
Quoted 8 lines · On Sat, 2 May 2020 00:04:35 -0600 James Hilliard <[email protected]>…
package/gobject-introspection/gobject-introspection.mk +0 -0
index eefb2c83f7..d98eaf945a 100644
@@ -136,6 +136,36 @@ define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
 endef
 GOBJECT_INTROSPECTION_POST_INSTALL_STAGING_HOOKS += GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
 
Quoted 7 lines

package/gobject-introspection/gobject-introspection.mk define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS · line 142

Quoted 4 lines
package/gobject-introspection/gobject-introspection.mk +4 -0
+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.

Quoted 2 lines

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.

Quoted 26 lines

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

(quoted diff) +0 -3
-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
Quoted 1 line

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.

Quoted 26 lines

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

(quoted diff) +0 -3
-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