Skip to contentSkip to conversation

support/misc/toolchainfile.cmake.in: don't set PKG_CONFIG_SYSROOT_DIR

PATCH In review James Hilliard 4 participants 11 messages Jul 27, 2022 – Aug 12, 2022 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/2 support/misc/toolchainfile.cmake.in: don't set PKG_CONFIG_SYSROOT_DIR

This doesn't appear to be required and seems to break for packages using meson's pkgconfig.relocatable format.

---
 support/misc/toolchainfile.cmake.in | 1 -
 1 file changed, 1 deletion(-)
support/misc/toolchainfile.cmake.in +0 -1
index 5d2b8695b4..24d2b401f0 100644
@@ -91,7 +91,6 @@ endif()
 if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
   set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
 endif()
-set(ENV{PKG_CONFIG_SYSROOT_DIR} "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
 
 # This toolchain file can be used both inside and outside Buildroot.
 if(NOT DEFINED CMAKE_C_COMPILER)
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH v5 2/2 package/pkg-meson: use meson to build/install packages

As of version 0.54.0 meson has had the ability to build and install packages rather than having to run ninja directly as before.

This will allow us to use features such as meson install tags in the future which require meson to be used for the installation.

Note that we've removed FOO_NINJA_ENV which may cause issues in the unlikely event an external package uses it.

We need to set --pkgconfig.relocatable so that pkg-config files are not generated with absolute paths which cause issues with per-package directories.

Remove conflicting host-systemd paths.

---
Changes v4 -> v5:
- don't set destdir for host install
Changes v3 -> v4:
- split out cmake fix
- cleanup config vars
- clearify commit message
Changes v2 -> v3:
- set pkgconfig to relocatable
- set cmake pkg-config prefix path
Changes v1 -> v2:
- update docs

---
 docs/manual/adding-packages-meson.txt         |  4 +-
 .../gobject-introspection.mk                  |  4 +-
 package/pkg-meson.mk                          | 67 ++++++++++++++-----
 package/systemd/systemd.mk                    |  9 +--
 4 files changed, 57 insertions(+), 27 deletions(-)
docs/manual/adding-packages-meson.txt +2 -2
index 029c8c2488..c8aed65c2f 100644
@@ -125,8 +125,8 @@ will therefore only use a few of them.
   +c_link_args+, +cpp_args+, +cpp_link_args+, +sys_root+, and
   +pkg_config_libdir+.
 
-* +FOO_NINJA_ENV+, to specify additional environment variables to pass to
-  +ninja+, meson companion tool in charge of the build operations. By default,
+* +FOO_MESON_ENV+, to specify additional environment variables to pass to
+  +meson+, meson tool in charge of the build/install operations. By default,
   empty.
 
 * +FOO_NINJA_OPTS+, to specify a space-separated list of targets to build. By
package/gobject-introspection/gobject-introspection.mk +2 -2
index 41d64171a7..ea5100247d 100644
@@ -30,14 +30,14 @@ HOST_GOBJECT_INTROSPECTION_DEPENDENCIES = \
 	host-python3
 
 # g-ir-scanner will default to /usr/bin/ld for linking if this is not set.
-GOBJECT_INTROSPECTION_NINJA_ENV += \
+GOBJECT_INTROSPECTION_MESON_ENV += \
 	CC="$(TARGET_CC)"
 
 # When building, gobject-introspection uses tools/g-ir-scanner to build several
 # .gir and .typelib files. g-ir-scanner does not use LDFLAGS, and by default,
 # links to the system-installed libglib2 path. To remedy this issue, defining
 # LD_LIBRARY_PATH forces g-ir-scanner to use our host installed libglib2 files.
-HOST_GOBJECT_INTROSPECTION_NINJA_ENV += \
+HOST_GOBJECT_INTROSPECTION_MESON_ENV += \
 	LD_LIBRARY_PATH="$(if $(LD_LIBRARY_PATH),$(LD_LIBRARY_PATH):)$(HOST_DIR)/lib"
 
 # Use the host gi-scanner to prevent the scanner from generating incorrect
package/pkg-meson.mk +51 -16

117 lines not on this page · raw message

package/systemd/systemd.mk +2 -7
index 47aaddf849..6efc8d636f 100644
@@ -749,7 +749,7 @@ endef
 SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SYSTEMD_PRESET_ALL
 
 SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV)
-SYSTEMD_NINJA_ENV = $(HOST_UTF8_LOCALE_ENV)
+SYSTEMD_MESON_ENV = $(HOST_UTF8_LOCALE_ENV)
 
 define SYSTEMD_LINUX_CONFIG_FIXUPS
 	$(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS)
@@ -777,10 +777,7 @@ endef
 HOST_SYSTEMD_CONF_OPTS = \
 	-Dsplit-bin=true \
 	-Dsplit-usr=false \
-	--prefix=/usr \
-	--libdir=lib \
-	--sysconfdir=/etc \
-	--localstatedir=/var \
+	-Drootprefix=$(HOST_DIR) \
 	-Dmode=release \
 	-Dutmp=false \
 	-Dhibernate=false \
@@ -852,8 +849,6 @@ HOST_SYSTEMD_DEPENDENCIES = \
 	host-gperf \
 	host-python-jinja2
 
-HOST_SYSTEMD_NINJA_ENV = DESTDIR=$(HOST_DIR)
-
 # Fix RPATH After installation
 # * systemd provides a install_rpath instruction to meson because the binaries
 #   need to link with libsystemd which is not in a standard path
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH v5 2/2] package/pkg-meson: use meson to build/install packages

Quoted 6 lines · James Hilliard

As of version 0.54.0 meson has had the ability to build and install packages rather than having to run ninja directly as before.

This will allow us to use features such as meson install tags in the future which require meson to be used for the installation.

Quoted 6 lines

Note that we've removed FOO_NINJA_ENV which may cause issues in the unlikely event an external package uses it.

We need to set --pkgconfig.relocatable so that pkg-config files are not generated with absolute paths which cause issues with per-package directories.

This still doesn't explain how it is related to using meson rather than ninja.
Are you saying that when calling ninja directly, PPD work perfectly fine, but if it's installed with meson, it doesn't? Then I'd really like to have a little more insight into what meson does to break it.

I suspect that the two are actually unrelated, and thus the patches should be
split.

Quoted 4 lines

Remove conflicting host-systemd paths.

[snip]

package/pkg-meson.mk define $(2)_CONFIGURE_CMDS · line 162

Quoted 9 lines
package/pkg-meson.mk +2 -2
@@ -156,10 +157,20 @@ define $(2)_CONFIGURE_CMDS
  	mkdir -p $$($$(PKG)_SRCDIR)/build
  	$$(HOST_CONFIGURE_OPTS) \
  	$$($$(PKG)_CONF_ENV) $$(MESON) \
+		--pkgconfig.relocatable \
  		--prefix=$$(HOST_DIR) \
-		--libdir=lib \
-		--sysconfdir=$$(HOST_DIR)/etc \
+		--bindir=$$(HOST_DIR)/bin \

bindir defaults to "bin", which means things will be installed in <prefix>/bin
and references to bindir in pkgconfig will use <prefix>/bin absolute paths as well (actually, as ${prefix}/bin). How does pkgconfig.relocatable change things that we suddenly need to override the default with an absolute path?

Quoted 44 lines
package/pkg-meson.mk +24 -4
+		--datadir=$$(HOST_DIR)/share \
+		--includedir=$$(HOST_DIR)/include \
+		--infodir=$$(HOST_DIR)/share/info \
+		--libdir=$$(HOST_DIR)/lib \
+		--libexecdir=$$(HOST_DIR)/libexec \
+		--localedir=$$(HOST_DIR)/share/locale \
  		--localstatedir=$$(HOST_DIR)/var \
+		--mandir=$$(HOST_DIR)/share/man \
+		--sbindir=$$(HOST_DIR)/sbin \
+		--sharedstatedir=$$(HOST_DIR)/com \
+		--sysconfdir=$$(HOST_DIR)/etc \
  		--default-library=shared \
  		--buildtype=release \
  		--wrap-mode=nodownload \
@@ -179,13 +190,23 @@ $(2)_DEPENDENCIES += host-meson
  ifndef $(2)_BUILD_CMDS
  ifeq ($(4),target)
  define $(2)_BUILD_CMDS
-	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
-		$$(NINJA) $$(NINJA_OPTS) $$($$(PKG)_NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build
+	$$(TARGET_MAKE_ENV) \
+	$$($$(PKG)_MESON_ENV) \
+	$$(MESON) \
+		compile \
+		$$(MESON_BUILD_OPTS) \
+		$$(if $$($$(PKG)_NINJA_OPTS),--ninja-args $$($$(PKG)_NINJA_OPTS)) \
+		-C $$($$(PKG)_SRCDIR)/build
  endef
  else
  define $(2)_BUILD_CMDS
-	$$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
-		$$(NINJA) $$(NINJA_OPTS) $$($$(PKG)_NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build
+	$$(HOST_MAKE_ENV) \
+	$$($$(PKG)_MESON_ENV) \
+	$$(MESON) \
+		compile \
+		$$(MESON_BUILD_OPTS) \
+		$$(if $$($$(PKG)_NINJA_OPTS),--ninja-args $$($$(PKG)_NINJA_OPTS)) \
+		-C $$($$(PKG)_SRCDIR)/build
  endef
  endif
  endif
@@ -196,8 +217,12 @@ endif
  #

package/pkg-meson.mk endif · line 225

Quoted 10 lines
package/pkg-meson.mk +6 -2
  ifndef $(2)_INSTALL_CMDS
  define $(2)_INSTALL_CMDS
-	$$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
-		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+	$$(HOST_MAKE_ENV) \
+	$$($$(PKG)_MESON_ENV) \
+	$$(MESON) \
+		install \
+		$$(MESON_INSTALL_OPTS) \
+		-C $$($$(PKG)_SRCDIR)/build

Why is there a --ninja-args in the build but not in the install?

Quoted 49 lines
package/pkg-meson.mk +14 -4
  endef
  endif
 
@@ -207,8 +232,13 @@ endif
  #
  ifndef $(2)_INSTALL_STAGING_CMDS
  define $(2)_INSTALL_STAGING_CMDS
-	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(STAGING_DIR) \
-		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+	$$(TARGET_MAKE_ENV) \
+	$$($$(PKG)_MESON_ENV) \
+	$$(MESON) \
+		install \
+		$$(MESON_INSTALL_OPTS) \
+		--destdir $$(STAGING_DIR) \
+		-C $$($$(PKG)_SRCDIR)/build
  endef
  endif
 
@@ -218,8 +248,13 @@ endif
  #
  ifndef $(2)_INSTALL_TARGET_CMDS
  define $(2)_INSTALL_TARGET_CMDS
-	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(TARGET_DIR) \
-		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+	$$(TARGET_MAKE_ENV) \
+	$$($$(PKG)_MESON_ENV) \
+	$$(MESON) \
+		install \
+		$$(MESON_INSTALL_OPTS) \
+		--destdir $$(TARGET_DIR) \
+		-C $$($$(PKG)_SRCDIR)/build
  endef
  endif
 
package/systemd/systemd.mk +1 -1
index 47aaddf849..6efc8d636f 100644
@@ -749,7 +749,7 @@ endef
  SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SYSTEMD_PRESET_ALL
 
  SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV)
-SYSTEMD_NINJA_ENV = $(HOST_UTF8_LOCALE_ENV)
+SYSTEMD_MESON_ENV = $(HOST_UTF8_LOCALE_ENV)
 
  define SYSTEMD_LINUX_CONFIG_FIXUPS
  	$(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS)

package/systemd/systemd.mk endef · line 780

Quoted 8 lines
package/systemd/systemd.mk +1 -4
@@ -777,10 +777,7 @@ endef
  HOST_SYSTEMD_CONF_OPTS = \
  	-Dsplit-bin=true \
  	-Dsplit-usr=false \
-	--prefix=/usr \
-	--libdir=lib \
-	--sysconfdir=/etc \
-	--localstatedir=/var \
+	-Drootprefix=$(HOST_DIR) \

This change looks like something we can apply independently of the rest of the
seris as well. It looks like a much better way of handling the special case of systemd. However, I'd like a much more detailed explanation about why this works now but didn't work in commit 35c11a027c88a3c943554eefbbed051fd2d98a50. That commit has an extensive explanation of the reasoning.

Regards,
Arnout

package/systemd/systemd.mk HOST_SYSTEMD_DEPENDENCIES = \ · line 854

Quoted 12 lines
package/systemd/systemd.mk +0 -2
  	-Dmode=release \
  	-Dutmp=false \
  	-Dhibernate=false \
@@ -852,8 +849,6 @@ HOST_SYSTEMD_DEPENDENCIES = \
  	host-gperf \
  	host-python-jinja2
 
-HOST_SYSTEMD_NINJA_ENV = DESTDIR=$(HOST_DIR)
-
  # Fix RPATH After installation
  # * systemd provides a install_rpath instruction to meson because the binaries
  #   need to link with libsystemd which is not in a standard path

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Re: [Buildroot] [PATCH v5 2/2] package/pkg-meson: use meson to build/install packages

Quoted 13 lines · Arnout Vandecappelle
Quoted 9 lines · James Hilliard

As of version 0.54.0 meson has had the ability to build and install packages rather than having to run ninja directly as before.

This will allow us to use features such as meson install tags in the future which require meson to be used for the installation.

Note that we've removed FOO_NINJA_ENV which may cause issues in the unlikely event an external package uses it.

Quoted 8 lines
Quoted 3 lines

We need to set --pkgconfig.relocatable so that pkg-config files are not generated with absolute paths which cause issues with per-package directories.

This still doesn't explain how it is related to using meson rather than ninja.
Are you saying that when calling ninja directly, PPD work perfectly fine, but if it's installed with meson, it doesn't? Then I'd really like to have a little more insight into what meson does to break it.

Well, the issue seems to be that without --pkgconfig.relocatable meson install messes up the paths during install due to generating absolute pkgconfig paths while ninja doesn't.

Quoted 10 lines

I suspect that the two are actually unrelated, and thus the patches should be
split.

Quoted 4 lines

Remove conflicting host-systemd paths.

[snip]

Quoted 14 lines

package/pkg-meson.mk define $(2)_CONFIGURE_CMDS · line 162

Quoted 9 lines
package/pkg-meson.mk +2 -2
@@ -156,10 +157,20 @@ define $(2)_CONFIGURE_CMDS
      mkdir -p $$($$(PKG)_SRCDIR)/build
      $$(HOST_CONFIGURE_OPTS) \
      $$($$(PKG)_CONF_ENV) $$(MESON) \
+             --pkgconfig.relocatable \
              --prefix=$$(HOST_DIR) \
-             --libdir=lib \
-             --sysconfdir=$$(HOST_DIR)/etc \
+             --bindir=$$(HOST_DIR)/bin \

bindir defaults to "bin", which means things will be installed in <prefix>/bin
and references to bindir in pkgconfig will use <prefix>/bin absolute paths as well (actually, as ${prefix}/bin). How does pkgconfig.relocatable change things that we suddenly need to override the default with an absolute path?

From my understanding pkgconfig.relocatable tells meson to calculate pkgconf paths relative to the prefix, so things work when both the prefix and bindir are set to absolute paths that produce the right relative paths when meson resolves the paths against each other during pkgconfig generation.

Quoted 113 lines
Quoted 45 lines
package/pkg-meson.mk +24 -4
+             --datadir=$$(HOST_DIR)/share \
+             --includedir=$$(HOST_DIR)/include \
+             --infodir=$$(HOST_DIR)/share/info \
+             --libdir=$$(HOST_DIR)/lib \
+             --libexecdir=$$(HOST_DIR)/libexec \
+             --localedir=$$(HOST_DIR)/share/locale \
              --localstatedir=$$(HOST_DIR)/var \
+             --mandir=$$(HOST_DIR)/share/man \
+             --sbindir=$$(HOST_DIR)/sbin \
+             --sharedstatedir=$$(HOST_DIR)/com \
+             --sysconfdir=$$(HOST_DIR)/etc \
              --default-library=shared \
              --buildtype=release \
              --wrap-mode=nodownload \
@@ -179,13 +190,23 @@ $(2)_DEPENDENCIES += host-meson
  ifndef $(2)_BUILD_CMDS
  ifeq ($(4),target)
  define $(2)_BUILD_CMDS
-     $$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
-             $$(NINJA) $$(NINJA_OPTS) $$($$(PKG)_NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build
+     $$(TARGET_MAKE_ENV) \
+     $$($$(PKG)_MESON_ENV) \
+     $$(MESON) \
+             compile \
+             $$(MESON_BUILD_OPTS) \
+             $$(if $$($$(PKG)_NINJA_OPTS),--ninja-args $$($$(PKG)_NINJA_OPTS)) \
+             -C $$($$(PKG)_SRCDIR)/build
  endef
  else
  define $(2)_BUILD_CMDS
-     $$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
-             $$(NINJA) $$(NINJA_OPTS) $$($$(PKG)_NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build
+     $$(HOST_MAKE_ENV) \
+     $$($$(PKG)_MESON_ENV) \
+     $$(MESON) \
+             compile \
+             $$(MESON_BUILD_OPTS) \
+             $$(if $$($$(PKG)_NINJA_OPTS),--ninja-args $$($$(PKG)_NINJA_OPTS)) \
+             -C $$($$(PKG)_SRCDIR)/build
  endef
  endif
  endif
@@ -196,8 +217,12 @@ endif
  #

package/pkg-meson.mk endif · line 225

Quoted 10 lines
package/pkg-meson.mk +6 -2
  ifndef $(2)_INSTALL_CMDS
  define $(2)_INSTALL_CMDS
-     $$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
-             $$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+     $$(HOST_MAKE_ENV) \
+     $$($$(PKG)_MESON_ENV) \
+     $$(MESON) \
+             install \
+             $$(MESON_INSTALL_OPTS) \
+             -C $$($$(PKG)_SRCDIR)/build

Why is there a --ninja-args in the build but not in the install?

Quoted 55 lines
package/pkg-meson.mk +14 -4
  endef
  endif
 
@@ -207,8 +232,13 @@ endif
  #
  ifndef $(2)_INSTALL_STAGING_CMDS
  define $(2)_INSTALL_STAGING_CMDS
-     $$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(STAGING_DIR) \
-             $$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+     $$(TARGET_MAKE_ENV) \
+     $$($$(PKG)_MESON_ENV) \
+     $$(MESON) \
+             install \
+             $$(MESON_INSTALL_OPTS) \
+             --destdir $$(STAGING_DIR) \
+             -C $$($$(PKG)_SRCDIR)/build
  endef
  endif
 
@@ -218,8 +248,13 @@ endif
  #
  ifndef $(2)_INSTALL_TARGET_CMDS
  define $(2)_INSTALL_TARGET_CMDS
-     $$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(TARGET_DIR) \
-             $$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+     $$(TARGET_MAKE_ENV) \
+     $$($$(PKG)_MESON_ENV) \
+     $$(MESON) \
+             install \
+             $$(MESON_INSTALL_OPTS) \
+             --destdir $$(TARGET_DIR) \
+             -C $$($$(PKG)_SRCDIR)/build
  endef
  endif
 
package/systemd/systemd.mk +1 -4
index 47aaddf849..6efc8d636f 100644
@@ -749,7 +749,7 @@ endef
  SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SYSTEMD_PRESET_ALL
 
  SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV)
-SYSTEMD_NINJA_ENV = $(HOST_UTF8_LOCALE_ENV)
+SYSTEMD_MESON_ENV = $(HOST_UTF8_LOCALE_ENV)
 
  define SYSTEMD_LINUX_CONFIG_FIXUPS
      $(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS)
@@ -777,10 +777,7 @@ endef
  HOST_SYSTEMD_CONF_OPTS = \
      -Dsplit-bin=true \
      -Dsplit-usr=false \
-     --prefix=/usr \
-     --libdir=lib \
-     --sysconfdir=/etc \
Quoted 8 lines

package/systemd/systemd.mk endef · line 780

Quoted 2 lines
package/systemd/systemd.mk +1 -1
-     --localstatedir=/var \
+     -Drootprefix=$(HOST_DIR) \

This change looks like something we can apply independently of the rest of the
seris as well. It looks like a much better way of handling the special case of systemd. However, I'd like a much more detailed explanation about why this works now but didn't work in commit 35c11a027c88a3c943554eefbbed051fd2d98a50. That commit has an extensive explanation of the reasoning.

Hmm, I'll look into this more.

Quoted 11 lines

Regards,
Arnout

Quoted 7 lines
package/systemd/systemd.mk +0 -0
      -Dmode=release \
      -Dutmp=false \
      -Dhibernate=false \
@@ -852,8 +849,6 @@ HOST_SYSTEMD_DEPENDENCIES = \
      host-gperf \
      host-python-jinja2
 
Quoted 5 lines

package/systemd/systemd.mk HOST_SYSTEMD_DEPENDENCIES = \ · line 854

Quoted 5 lines
package/systemd/systemd.mk +0 -2
-HOST_SYSTEMD_NINJA_ENV = DESTDIR=$(HOST_DIR)
-
  # Fix RPATH After installation
  # * systemd provides a install_rpath instruction to meson because the binaries
  #   need to link with libsystemd which is not in a standard path

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

Re: [Buildroot] [PATCH v5 2/2] package/pkg-meson: use meson to build/install packages

James, All,

On 2022-07-27 12:33 -0600, James Hilliard spake thusly:

Quoted 2 lines · Arnout Vandecappelle
Quoted 1 line · James Hilliard

[--SNIP--]

Quoted 10 lines
Quoted 7 lines
Quoted 3 lines

We need to set --pkgconfig.relocatable so that pkg-config files are not generated with absolute paths which cause issues with per-package directories.

This still doesn't explain how it is related to using meson rather than ninja.
Are you saying that when calling ninja directly, PPD work perfectly fine, but if it's installed with meson, it doesn't? Then I'd really like to have a little more insight into what meson does to break it.

Well, the issue seems to be that without --pkgconfig.relocatable meson install messes up the paths during install due to generating absolute pkgconfig paths while ninja doesn't.

But does that actually causes any real issue and build breakage?

For the non-PPD case, that should not be an issue, as the HOST_DIR (and STAGING_DIR, below it) are constant throughout the build.

For the PPD case, we have a prepare hook that fixes the paths in all text files, see b06294e9897e (core/pkg-generic: fixup all PPD paths in a generic fashion). So this should be covered.

For the SDK, there is a script that does something very similar to the PPD case, so again there should be no issue.

What is it that you actually want to achieve with relative paths, that is currently broken with absolute paths?

Regards,
Yann E. MORIN.

Signature · 10 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.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

Re: [Buildroot] [PATCH v5 2/2] package/pkg-meson: use meson to build/install packages

Quoted 14 lines · Yann E. MORIN

James, All,

On 2022-07-27 12:33 -0600, James Hilliard spake thusly:

Quoted 2 lines · Arnout Vandecappelle
Quoted 1 line · James Hilliard

[--SNIP--]

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

We need to set --pkgconfig.relocatable so that pkg-config files are not generated with absolute paths which cause issues with per-package directories.

This still doesn't explain how it is related to using meson rather than ninja.
Are you saying that when calling ninja directly, PPD work perfectly fine, but if it's installed with meson, it doesn't? Then I'd really like to have a little more insight into what meson does to break it.

Quoted 5 lines
Quoted 3 lines

Well, the issue seems to be that without --pkgconfig.relocatable meson install messes up the paths during install due to generating absolute pkgconfig paths while ninja doesn't.

But does that actually causes any real issue and build breakage?

Appears to break when using meson's install.

Quoted 8 lines

For the non-PPD case, that should not be an issue, as the HOST_DIR (and STAGING_DIR, below it) are constant throughout the build.

For the PPD case, we have a prepare hook that fixes the paths in all text files, see b06294e9897e (core/pkg-generic: fixup all PPD paths in a generic fashion). So this should be covered.

Quoted 5 lines

For the SDK, there is a script that does something very similar to the PPD case, so again there should be no issue.

What is it that you actually want to achieve with relative paths, that is currently broken with absolute paths?

Looks like the relocatable format works fine without meson's install:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Although the cmake prefix fix is also needed:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Quoted 11 lines

Regards,
Yann E. MORIN.

--
.-----------------.--------------------.------------------.--------------------.

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

'------------------------------^-------^------------------^--------------------'

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#6 lore raw

Re: [Buildroot] [PATCH v5 2/2] package/pkg-meson: use meson to build/install packages

In reply to James Hilliard

James, All,

On 2022-07-27 01:15 -0600, James Hilliard spake thusly:

Quoted 2 lines

As of version 0.54.0 meson has had the ability to build and install packages rather than having to run ninja directly as before.

[--SNIP--]

package/systemd/systemd.mk

Quoted 4 lines
package/systemd/systemd.mk +0 -0
index 47aaddf849..6efc8d636f 100644

[--SNIP--]

package/systemd/systemd.mk endef · line 780

Quoted 9 lines
package/systemd/systemd.mk +1 -4
@@ -777,10 +777,7 @@ endef
 HOST_SYSTEMD_CONF_OPTS = \
 	-Dsplit-bin=true \
 	-Dsplit-usr=false \
-	--prefix=/usr \
-	--libdir=lib \
-	--sysconfdir=/etc \
-	--localstatedir=/var \
+	-Drootprefix=$(HOST_DIR) \

Have you read the explanations in 35c11a027c8 (package/systemd: add host variant)? This change must expand on how it does not break things, with a very good and detailed commit log, and as a separate patch.

Also, if the HOST_SYSTEMD_FIX_RPATH hook still needed, then?

Regards,
Yann E. MORIN.

Quoted 18 lines
package/systemd/systemd.mk +0 -2
 	-Dutmp=false \
 	-Dhibernate=false \
@@ -852,8 +849,6 @@ HOST_SYSTEMD_DEPENDENCIES = \
 	host-gperf \
 	host-python-jinja2
 
-HOST_SYSTEMD_NINJA_ENV = DESTDIR=$(HOST_DIR)
-
 # Fix RPATH After installation
 # * systemd provides a install_rpath instruction to meson because the binaries
 #   need to link with libsystemd which is not in a standard path
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 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.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw

Re: [Buildroot] [PATCH v5 2/2] package/pkg-meson: use meson to build/install packages

Quoted 26 lines · Yann E. MORIN

James, All,

On 2022-07-27 01:15 -0600, James Hilliard spake thusly:

Quoted 2 lines

As of version 0.54.0 meson has had the ability to build and install packages rather than having to run ninja directly as before.

[--SNIP--]

package/systemd/systemd.mk

Quoted 4 lines
package/systemd/systemd.mk +0 -0
index 47aaddf849..6efc8d636f 100644

[--SNIP--]

package/systemd/systemd.mk endef · line 780

Quoted 9 lines
package/systemd/systemd.mk +1 -4
@@ -777,10 +777,7 @@ endef
 HOST_SYSTEMD_CONF_OPTS = \
      -Dsplit-bin=true \
      -Dsplit-usr=false \
-     --prefix=/usr \
-     --libdir=lib \
-     --sysconfdir=/etc \
-     --localstatedir=/var \
+     -Drootprefix=$(HOST_DIR) \

Have you read the explanations in 35c11a027c8 (package/systemd: add host variant)? This change must expand on how it does not break things, with a very good and detailed commit log, and as a separate patch.

Quoted 1 line

Also, if the HOST_SYSTEMD_FIX_RPATH hook still needed, then?

Well I think I did find a way to remove that:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Quoted 25 lines

Regards,
Yann E. MORIN.

Quoted 14 lines
package/systemd/systemd.mk +0 -3
      -Dutmp=false \
      -Dhibernate=false \
@@ -852,8 +849,6 @@ HOST_SYSTEMD_DEPENDENCIES = \
      host-gperf \
      host-python-jinja2
 
-HOST_SYSTEMD_NINJA_ENV = DESTDIR=$(HOST_DIR)
-
 # Fix RPATH After installation
 # * systemd provides a install_rpath instruction to meson because the binaries
 #   need to link with libsystemd which is not in a standard path
--

2.34.1

Quoted 4 lines

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

--
.-----------------.--------------------.------------------.--------------------.

Quoted 5 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.  |

'------------------------------^-------^------------------^--------------------'

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#8 lore raw
In reply to James Hilliard

Hello James,

Quoted 2 lines · On Wed, 27 Jul 2022 01:15:56 -0600 James Hilliard <[email protected]>…

This doesn't appear to be required and seems to break for packages using meson's pkgconfig.relocatable format.

Thanks for your contribution. However, if you want us to merge this can of contribution needs much, much, much better commit logs and explanations.

An explanation that starts with "this doesn't appear to be required" and continues with "seems to break" is the opposite of a convincing explanation.

Here is the sort of commit log that we need:

"""
Defining PKG_CONFIG_SYSROOT_DIR in the CMake toolchain file is not needed because it is already passed...

In addition, passing this in the CMake toolchain file causes breakage of the following defconfig, once meson's pkgconfig.relocatable is enabled, with the following failure:

[...]

This failure occurs because ...
"""

Note: I agree that passing PKG_CONFIG_SYSROOT_DIR in the CMake toolchain file is probably not needed because our pkg-config wrapper already passes the right value. However, I fail to see how that can make a difference. How something in the CMake toolchain file can affect the build of Meson based packages?

We very much appreciate all the improvements you are submitting, many of them are very relevant and very useful. However, to have them merged, we need detailed and convincing argumentation, no vague commit logs that seem to indicate the change is actually papering over a problem rather than addressing it for real.

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#9 lore raw
Quoted 29 lines · Thomas Petazzoni

Hello James,

Quoted 2 lines · On Wed, 27 Jul 2022 01:15:56 -0600 James Hilliard <[email protected]>…

This doesn't appear to be required and seems to break for packages using meson's pkgconfig.relocatable format.

Thanks for your contribution. However, if you want us to merge this can of contribution needs much, much, much better commit logs and explanations.

An explanation that starts with "this doesn't appear to be required" and continues with "seems to break" is the opposite of a convincing explanation.

Here is the sort of commit log that we need:

"""
Defining PKG_CONFIG_SYSROOT_DIR in the CMake toolchain file is not needed because it is already passed...

In addition, passing this in the CMake toolchain file causes breakage of the following defconfig, once meson's pkgconfig.relocatable is enabled, with the following failure:

[...]

Quoted 8 lines

This failure occurs because ...
"""

Note: I agree that passing PKG_CONFIG_SYSROOT_DIR in the CMake toolchain file is probably not needed because our pkg-config wrapper already passes the right value. However, I fail to see how that can make a difference. How something in the CMake toolchain file can affect the build of Meson based packages?

I think it's an issue with how it interacts with meson's pkg-config prefix in relocatable mode AFAIU, seems cmake wasn't setting the prefix correctly, which generally only seemed to cause issues with PKG_CONFIG_SYSROOT_DIR from what I could tell.

I recall someone mentioned PKG_CONFIG_SYSROOT_DIR was needed for external toolchains or something along those lines so I came up with an alternative
approach to avoid removing PKG_CONFIG_SYSROOT_DIR.

Quoted 6 lines

We very much appreciate all the improvements you are submitting, many of them are very relevant and very useful. However, to have them merged, we need detailed and convincing argumentation, no vague commit logs that seem to indicate the change is actually papering over a problem rather than addressing it for real.

This was superseded by:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

I separated the pkg-config and relocatable format change out from the ninja to meson build/install migration.

Quoted 8 lines

Thanks!

Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#10 lore raw
Quoted 46 lines · James Hilliard
Quoted 29 lines · Thomas Petazzoni

Hello James,

Quoted 2 lines · On Wed, 27 Jul 2022 01:15:56 -0600 James Hilliard <[email protected]>…

This doesn't appear to be required and seems to break for packages using meson's pkgconfig.relocatable format.

Thanks for your contribution. However, if you want us to merge this can of contribution needs much, much, much better commit logs and explanations.

An explanation that starts with "this doesn't appear to be required" and continues with "seems to break" is the opposite of a convincing explanation.

Here is the sort of commit log that we need:

"""
Defining PKG_CONFIG_SYSROOT_DIR in the CMake toolchain file is not needed because it is already passed...

In addition, passing this in the CMake toolchain file causes breakage of the following defconfig, once meson's pkgconfig.relocatable is enabled, with the following failure:

[...]

Quoted 8 lines

This failure occurs because ...
"""

Note: I agree that passing PKG_CONFIG_SYSROOT_DIR in the CMake toolchain file is probably not needed because our pkg-config wrapper already passes the right value. However, I fail to see how that can make a difference. How something in the CMake toolchain file can affect the build of Meson based packages?

I think it's an issue with how it interacts with meson's pkg-config prefix in relocatable mode AFAIU, seems cmake wasn't setting the prefix correctly, which generally only seemed to cause issues with PKG_CONFIG_SYSROOT_DIR from what I could tell.

Quoted 4 lines

I recall someone mentioned PKG_CONFIG_SYSROOT_DIR was needed for external toolchains or something along those lines so I came up with an alternative
approach to avoid removing PKG_CONFIG_SYSROOT_DIR.

Oh, it was apparently needed by external builds using the SDK, see:
https://lore.kernel.org/buildroot/[email protected]/

Quoted 10 lines
Quoted 7 lines

We very much appreciate all the improvements you are submitting, many of them are very relevant and very useful. However, to have them merged, we need detailed and convincing argumentation, no vague commit logs that seem to indicate the change is actually papering over a problem rather than addressing it for real.

This was superseded by:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

I avoided removing PKG_CONFIG_SYSROOT_DIR due to the SDK issue.

Quoted 13 lines

https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

I separated the pkg-config and relocatable format change out from the ninja to meson build/install migration.

Quoted 8 lines

Thanks!

Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot