support/misc/toolchainfile.cmake.in: set PKG_CONFIG/CMAKE prefix paths
PATCH 1/2 support/misc/toolchainfile.cmake.in: set PKG_CONFIG/CMAKE prefix paths
These appear to not be getting set correctly and are needed when using meson's relocatable pkgconfig format.
--- support/misc/toolchainfile.cmake.in | 6 ++++++ 1 file changed, 6 insertions(+)
support/misc/toolchainfile.cmake.in +6 -0
@@ -91,6 +91,12 @@ endif() if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_INCLUDE) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) endif() +if(NOT DEFINED PKG_CONFIG_USE_CMAKE_PREFIX_PATH) + set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON) +endif() +if(NOT DEFINED CMAKE_PREFIX_PATH) + set(CMAKE_PREFIX_PATH "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@/usr") +endif() set(ENV{PKG_CONFIG_SYSROOT_DIR} "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@") # This toolchain file can be used both inside and outside Buildroot.
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/2 package/pkg-meson: generate relocatable pkgconfigs
This format prevents pkgconfig path issues when using meson's built-in install functionality.
--- package/pkg-meson.mk | 2 ++ 1 file changed, 2 insertions(+)
package/pkg-meson.mk +2 -0
@@ -134,6 +134,7 @@ define $(2)_CONFIGURE_CMDS CXX_FOR_BUILD="$$(HOSTCXX)" \ $$($$(PKG)_CONF_ENV) \ $$(MESON) \ + --pkgconfig.relocatable \ --prefix=/usr \ --libdir=lib \ --default-library=$(if $(BR2_STATIC_LIBS),static,shared) \
@@ -154,6 +155,7 @@ 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 \
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 2/2] package/pkg-meson: generate relocatable pkgconfigs
Hi James,
Le 28/07/2022 à 03:44, James Hilliard a écrit :
Quoted 2 lines
This format prevents pkgconfig path issues when using meson's built-in install functionality.
Is any package currently affected by this issue?
I would add a reference link:
https://mesonbuild.com/Pkgconfig-module.html#relocatable-pkgconfig-files
Best regards,
Romain
Quoted 18 lines
Signed-off-by James Hilliard <[email protected]>--- package/pkg-meson.mk | 2 ++ 1 file changed, 2 insertions(+)package/pkg-meson.mk +1
-0@@ -134,6 +134,7 @@ define $(2)_CONFIGURE_CMDS CXX_FOR_BUILD="$$(HOSTCXX)" \ $$($$(PKG)_CONF_ENV) \ $$(MESON) \ + --pkgconfig.relocatable \ --prefix=/usr \ --libdir=lib \ --default-library=$(if $(BR2_STATIC_LIBS),static,shared) \
package/pkg-meson.mk define $(2)_CONFIGURE_CMDS · line 161
Quoted 7 lines
package/pkg-meson.mk +1
-0@@ -154,6 +155,7 @@ 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 \
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 2/2] package/pkg-meson: generate relocatable pkgconfigs
Quoted 8 lines · Romain Naour
Hi James,
Quoted 2 lines · James Hilliard
This format prevents pkgconfig path issues when using meson's built-in install functionality.
Is any package currently affected by this issue?
We currently aren't using meson's built-in install feature AFAIU so I don't think
there's currently any packages having issues here.
Quoted 25 lines
I would add a reference link:
https://mesonbuild.com/Pkgconfig-module.html#relocatable-pkgconfig-filesBest regards,
RomainQuoted 17 lines
Signed-off-by James Hilliard <[email protected]>--- package/pkg-meson.mk | 2 ++ 1 file changed, 2 insertions(+)package/pkg-meson.mk +1
-0@@ -134,6 +134,7 @@ define $(2)_CONFIGURE_CMDS CXX_FOR_BUILD="$$(HOSTCXX)" \ $$($$(PKG)_CONF_ENV) \ $$(MESON) \ + --pkgconfig.relocatable \ --prefix=/usr \ --libdir=lib \ --default-library=$(if $(BR2_STATIC_LIBS),static,shared) \
Quoted 9 lines
package/pkg-meson.mk define $(2)_CONFIGURE_CMDS · line 161
Quoted 8 lines
package/pkg-meson.mk +1
-0@@ -154,6 +155,7 @@ 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 \
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 2/2] package/pkg-meson: generate relocatable pkgconfigs
In reply to James HilliardJames, All,
On 2022-07-27 19:44 -0600, James Hilliard spake thusly:
Quoted 2 lines
This format prevents pkgconfig path issues when using meson's built-in install functionality.
"pkgconfig path issues" is vague: this is not helping understand why this change is needed.
Please explain what is currently broken, and how that patch fixes the issue. If there were a pointer to one or a few autobuild issues, that would also help, and would answers Romain's question: what package(s) is(are) impacted?
If I look at the pointer Romain provided, it states:
https://mesonbuild.com/Pkgconfig-module.html#relocatable-pkgconfig-files
By default, the files generated by pkg.generate contain a hardcoded prefix path.
Sure, I can see how that could be an issue. However, we already have two ways to fix that:
- for per-package directory, we have a generic fixup that replaces the PPD base with the one for the current package, see:
- package/pkg-generic.mk lines 95-onward and 109-onward.
- b06294e9897e core/pkg-generic: fixup all PPD paths in a generic fashion
- for the SDK, we have a similar fixup, see:
- Makefile lines 597-onward
- support/misc/relocate-sdk.sh
So, if those fixups are not enough, can you describe what they are missing, so that we can extend them?
This does not mean we can't apply this change (I even think it would be OK), but we really need to understand why we need it.
Regards,
Yann E. MORIN.
Quoted 32 lines
Signed-off-by James Hilliard <[email protected]>--- package/pkg-meson.mk | 2 ++ 1 file changed, 2 insertions(+)package/pkg-meson.mk +2
-0@@ -134,6 +134,7 @@ define $(2)_CONFIGURE_CMDS CXX_FOR_BUILD="$$(HOSTCXX)" \ $$($$(PKG)_CONF_ENV) \ $$(MESON) \ + --pkgconfig.relocatable \ --prefix=/usr \ --libdir=lib \ --default-library=$(if $(BR2_STATIC_LIBS),static,shared) \@@ -154,6 +155,7 @@ 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 \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
Re: [Buildroot] [PATCH 2/2] package/pkg-meson: generate relocatable pkgconfigs
Quoted 7 lines · Yann E. MORIN
James, All,
On 2022-07-27 19:44 -0600, James Hilliard spake thusly:
Quoted 2 lines
This format prevents pkgconfig path issues when using meson's built-in install functionality.
Quoted 7 lines
"pkgconfig path issues" is vague: this is not helping understand why this change is needed.
Please explain what is currently broken, and how that patch fixes the issue. If there were a pointer to one or a few autobuild issues, that would also help, and would answers Romain's question: what package(s) is(are) impacted?
Meson's install feature doesn't work correctly when using non-relocatable format if you are installing to multiple desdir's. There's no autobuild issues as we don't use meson's install feature yet.
Quoted 16 lines
If I look at the pointer Romain provided, it states:
https://mesonbuild.com/Pkgconfig-module.html#relocatable-pkgconfig-files
By default, the files generated by pkg.generate contain a hardcoded prefix path.
Sure, I can see how that could be an issue. However, we already have two ways to fix that:
- for per-package directory, we have a generic fixup that replaces the PPD base with the one for the current package, see:
-package/pkg-generic.mklines 95-onward and 109-onward.
-b06294e9897ecore/pkg-generic: fixup all PPD paths in a generic fashion
Quoted 6 lines
- for the SDK, we have a similar fixup, see:
-Makefilelines 597-onward
-support/misc/relocate-sdk.shSo, if those fixups are not enough, can you describe what they are missing, so that we can extend them?
The reason for making it relocatable via this meson flag is so that we can continue to use a single build stage for both staging and target installs for meson packages.
When using meson's install without relocatable the path's generated don't play nice with different destination directory meson native installs, they work with the ninja based different destination installs that we currently use however.
This is due to the non-relocatable paths being effectively locked to the expected
destination paths set at build time(which prevents destdir changing during staging/target installs) and meson's install feature doing some additional appending
manipulation in pkg-config files during install.
See previous discussion for more details:
https://lore.kernel.org/buildroot/CADvTj4qHOLX3cLsfc6Sc15-yJnKkjYFXLmQcRxhPapQOnbz0Vg@mail.gmail.com/
Quoted 42 lines
This does not mean we can't apply this change (I even think it would be OK), but we really need to understand why we need it.
Regards,
Yann E. MORIN.Quoted 28 lines
Signed-off-by James Hilliard <[email protected]>--- package/pkg-meson.mk | 2 ++ 1 file changed, 2 insertions(+)package/pkg-meson.mk +2
-1@@ -134,6 +134,7 @@ define $(2)_CONFIGURE_CMDS CXX_FOR_BUILD="$$(HOSTCXX)" \ $$($$(PKG)_CONF_ENV) \ $$(MESON) \ + --pkgconfig.relocatable \ --prefix=/usr \ --libdir=lib \ --default-library=$(if $(BR2_STATIC_LIBS),static,shared) \@@ -154,6 +155,7 @@ 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 \ --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
Hello James,
Le 28/07/2022 à 03:44, James Hilliard a écrit :
Quoted 2 lines
These appear to not be getting set correctly and are needed when using meson's relocatable pkgconfig format.
How this cmake file (toolchainfile.cmake.in) is used by a meson package ?
Best regards,
Romain
Quoted 13 lines
Signed-off-by James Hilliard <[email protected]>--- support/misc/toolchainfile.cmake.in | 6 ++++++ 1 file changed, 6 insertions(+)support/misc/toolchainfile.cmake.in +0
-0@@ -91,6 +91,12 @@ endif() if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_INCLUDE) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
support/misc/toolchainfile.cmake.in endif() · line 102
Quoted 10 lines
support/misc/toolchainfile.cmake.in +6
-0endif() +if(NOT DEFINED PKG_CONFIG_USE_CMAKE_PREFIX_PATH) + set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON) +endif() +if(NOT DEFINED CMAKE_PREFIX_PATH) + set(CMAKE_PREFIX_PATH "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@/usr") +endif() set(ENV{PKG_CONFIG_SYSROOT_DIR} "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@") # This toolchain file can be used both inside and outside Buildroot.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 7 lines · Romain Naour
Hello James,
Le 28/07/2022 à 03:44, James Hilliard a écrit :
Quoted 2 lines
These appear to not be getting set correctly and are needed when using meson's relocatable pkgconfig format.
How this cmake file (toolchainfile.cmake.in) is used by a meson package ?
I understand it as "a cmake package needs this to use a pkgconfig file generated by a meson package when meson is configured to generate relocatable pkgconfig files".
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Nicolas,
Le 11/01/2023 à 17:01, Nicolas Cavallari a écrit :
Quoted 12 lines · Romain Naour
Quoted 7 lines
Hello James,
Le 28/07/2022 à 03:44, James Hilliard a écrit :
Quoted 2 lines
These appear to not be getting set correctly and are needed when using meson's relocatable pkgconfig format.
How this cmake file (toolchainfile.cmake.in) is used by a meson package ?
I understand it as "a cmake package needs this to use a pkgconfig file generated by a meson package when meson is configured to generate relocatable pkgconfig files".
Ok thanks, I misunderstood what James wrote... my bad.
Best regards,
Romain
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Nicolas, James, All,
On 2023-01-11 17:01 +0100, Nicolas Cavallari spake thusly:
Quoted 8 lines · Romain Naour
Quoted 4 lines
Le 28/07/2022 à 03:44, James Hilliard a écrit :
Quoted 2 lines
These appear to not be getting set correctly and are needed when using meson's relocatable pkgconfig format.
How this cmake file (toolchainfile.cmake.in) is used by a meson package ?
I understand it as "a cmake package needs this to use a pkgconfig file generated by a meson package when meson is configured to generate relocatable pkgconfig files".
OK, but then I have a few questions:
- what are "relocatable pkgconfig files", and how do they fit in the pkgconfig spec?
- how do they differ from standard pkgconfig files? By "standard", I mean all the pkgconfig files we currently install and use from the hundreds, if not thousands, of packages that provided them.
- why is meson generating those pkgconfig files, rather than standard ones?
- and finally, if the "relocatable pkgconfig files" generated by meson are incorrect wrt the pkgconfig spec, can we tell meson not to do that?
This should be answered with explanations in the commit log, rather than providing reviewers with an elusive and confusing "appear to not be getting set correctly" without research and explanations...
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
Quoted 12 lines · Yann E. MORIN
Nicolas, James, All,
On 2023-01-11 17:01 +0100, Nicolas Cavallari spake thusly:
Quoted 8 lines · Romain Naour
Quoted 4 lines
Le 28/07/2022 à 03:44, James Hilliard a écrit :
Quoted 2 lines
These appear to not be getting set correctly and are needed when using meson's relocatable pkgconfig format.
How this cmake file (toolchainfile.cmake.in) is used by a meson package ?
I understand it as "a cmake package needs this to use a pkgconfig file generated by a meson package when meson is configured to generate relocatable pkgconfig files".
Quoted 7 lines
OK, but then I have a few questions:
- what are "relocatable pkgconfig files", and how do they fit in the pkgconfig spec? >
- how do they differ from standard pkgconfig files? By "standard", I mean all the pkgconfig files we currently install and use from the hundreds, if not thousands, of packages that provided them.
Reading the meson's source, they are merely standard pkgconfig files that use the ${pcfiledir} variable to define paths instead of hardcoding a prefix. These are not specific to meson and are supported by pkg-config. (It happen that some of our private packages uses that trick too, and they are not meson packages)
Quoted 2 lines
- why is meson generating those pkgconfig files, rather than standard ones?
Because patch 2/2 tells it to.
Quoted 3 lines
- and finally, if the "relocatable pkgconfig files" generated by meson are incorrect wrt the pkgconfig spec, can we tell meson not to do that?
They are not incorrect. From experience, autotools and meson packages handles them fine. cmake however, according to the commit message, does not and needs some extra variables.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Nicolas, James, All,
On 2023-01-11 18:35 +0100, Nicolas Cavallari spake thusly:
Quoted 19 lines · Yann E. MORIN
Quoted 10 lines
On 2023-01-11 17:01 +0100, Nicolas Cavallari spake thusly:
Quoted 8 lines · Romain Naour
Quoted 4 lines
Le 28/07/2022 à 03:44, James Hilliard a écrit :
Quoted 2 lines
These appear to not be getting set correctly and are needed when using meson's relocatable pkgconfig format.
How this cmake file (toolchainfile.cmake.in) is used by a meson package ?
I understand it as "a cmake package needs this to use a pkgconfig file generated by a meson package when meson is configured to generate relocatable pkgconfig files".
Quoted 7 lines
OK, but then I have a few questions:
- what are "relocatable pkgconfig files", and how do they fit in the pkgconfig spec? >
- how do they differ from standard pkgconfig files? By "standard", I mean all the pkgconfig files we currently install and use from the hundreds, if not thousands, of packages that provided them.
Quoted 5 lines
Reading the meson's source, they are merely standard pkgconfig files that use the ${pcfiledir} variable to define paths instead of hardcoding a prefix. These are not specific to meson and are supported by pkg-config. (It happen that some of our private packages uses that trick too, and they are not meson packages)
That. It has nothing meson specific, in fact. It just happens that meson is the only tool that generates .pc files with pcfiledir, and pcfiledir is not widely used either (we've never had a related issue so far, have we?) (and no, private tools and packages do not count! ;-] )
Quoted 3 lines
Quoted 2 lines
- why is meson generating those pkgconfig files, rather than standard ones?
Because patch 2/2 tells it to.
Ah, yes, I just replied to that second patch too, now. If a change is needed in preparation of another one, then it should be mentioned (with an abridged explanation of the problem that will be fixed in that later change, if possible). And a cover letter that explains the whole picture is more than welcome, too.
Quoted 6 lines
Quoted 3 lines
- and finally, if the "relocatable pkgconfig files" generated by meson are incorrect wrt the pkgconfig spec, can we tell meson not to do that?
They are not incorrect. From experience, autotools and meson packages handles them fine. cmake however, according to the commit message, does not and needs some extra variables.
Yes, this makes so much more sense now: it is a cmake issue first and foremost, that is exposed by .pc files generated by meson. Thanks for the explanations!
James, can you respin this one patch with all this discussion nicely aggregated and reformatted as a proper commit log, please?
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