All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] meson-package: prevent cmake find_package() picking up host libraries
@ 2022-04-21 15:25 Andreas Ziegler
  2022-04-21 19:44 ` Yann E. MORIN
  2022-05-24 12:51 ` Peter Korsgaard
  0 siblings, 2 replies; 3+ messages in thread
From: Andreas Ziegler @ 2022-04-21 15:25 UTC (permalink / raw)
  To: buildroot; +Cc: Eric Le Bihan, Andreas Ziegler

The meson build system uses (1) pkg-config and (2) cmake find_package to locate 
dependencies and stops only if a package is found. Cmake uses a toolchain file 
that is generated by meson from the existing configuration [1]. 

The cmake toolchain file misses CMAKE_FIND_ROOT_PATH and CMAKE_FIND_ROOT_PATH_* 
settings, and find_package() falls back to the default behaviour and looks for 
dependencies on the build machine (the Buildroot HOST_DIR). 

Use a feature introduced in meson 0.56.0 [2] to pass the Buildroot toolchain 
file to cmake instead of using a meson-generated one. 

Fixes the following build failures:
http://autobuild.buildroot.org/results/056/05673ed04c6f044f1b56b9d5342d61653be43a18/
http://autobuild.buildroot.org/results/f0a/f0a9e719114f19dc9d20622ed85dd4f8e968c20f/
http://autobuild.buildroot.org/results/527/527ee199813abbacd61c3fa32b517ea60af60659/

[1[ see mesonbuild/cmake/toolchain.py
[2] see https://mesonbuild.com/CMake-module.html#cross-compilation

Signed-off-by: Andreas Ziegler <br015@umbiko.net>
---
 package/pkg-meson.mk                   | 1 +
 support/misc/cross-compilation.conf.in | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
index 9e70d49b60..f1390a18d0 100644
--- a/package/pkg-meson.mk
+++ b/package/pkg-meson.mk
@@ -81,6 +81,7 @@ define PKG_MESON_CROSSCONFIG_SED
         -e "s%@TARGET_CXXFLAGS@%$(call make-sq-comma-list,$($(strip $(2))))%g" \
         -e "s%@BR2_CMAKE@%$(BR2_CMAKE)%g" \
         -e "s%@PKGCONF_HOST_BINARY@%$(HOST_DIR)/bin/pkgconf%g" \
+        -e "s%@HOST_DIR@%$(HOST_DIR)%g" \
         -e "s%@STAGING_DIR@%$(STAGING_DIR)%g" \
         -e "s%@STATIC@%$(if $(BR2_STATIC_LIBS),true,false)%g" \
         $(TOPDIR)/support/misc/cross-compilation.conf.in
diff --git a/support/misc/cross-compilation.conf.in b/support/misc/cross-compilation.conf.in
index 1977a83501..235e5a8495 100644
--- a/support/misc/cross-compilation.conf.in
+++ b/support/misc/cross-compilation.conf.in
@@ -26,6 +26,9 @@ needs_exe_wrapper = true
 sys_root = '@STAGING_DIR@'
 pkg_config_libdir = '@STAGING_DIR@/usr/lib/pkgconfig:@STAGING_DIR@/usr/share/pkgconfig'
 pkg_config_static = '@STATIC@'
+# enable meson build to pass a toolchain file to cmake
+cmake_toolchain_file = '@HOST_DIR@/share/buildroot/toolchainfile.cmake'
+cmake_defaults = false
 
 [host_machine]
 system = 'linux'
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] meson-package: prevent cmake find_package() picking up host libraries
  2022-04-21 15:25 [Buildroot] [PATCH 1/1] meson-package: prevent cmake find_package() picking up host libraries Andreas Ziegler
@ 2022-04-21 19:44 ` Yann E. MORIN
  2022-05-24 12:51 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Yann E. MORIN @ 2022-04-21 19:44 UTC (permalink / raw)
  To: Andreas Ziegler; +Cc: Eric Le Bihan, buildroot

Andreas, All,

On 2022-04-21 17:25 +0200, Andreas Ziegler spake thusly:
> The meson build system uses (1) pkg-config and (2) cmake find_package to locate 
> dependencies and stops only if a package is found. Cmake uses a toolchain file 
> that is generated by meson from the existing configuration [1]. 
> 
> The cmake toolchain file misses CMAKE_FIND_ROOT_PATH and CMAKE_FIND_ROOT_PATH_* 
> settings, and find_package() falls back to the default behaviour and looks for 
> dependencies on the build machine (the Buildroot HOST_DIR). 
> 
> Use a feature introduced in meson 0.56.0 [2] to pass the Buildroot toolchain 
> file to cmake instead of using a meson-generated one. 
> 
> Fixes the following build failures:
> http://autobuild.buildroot.org/results/056/05673ed04c6f044f1b56b9d5342d61653be43a18/
> http://autobuild.buildroot.org/results/f0a/f0a9e719114f19dc9d20622ed85dd4f8e968c20f/
> http://autobuild.buildroot.org/results/527/527ee199813abbacd61c3fa32b517ea60af60659/
> 
> [1[ see mesonbuild/cmake/toolchain.py
> [2] see https://mesonbuild.com/CMake-module.html#cross-compilation
> 
> Signed-off-by: Andreas Ziegler <br015@umbiko.net>

Thanks for the detailed commit log.

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
>  package/pkg-meson.mk                   | 1 +
>  support/misc/cross-compilation.conf.in | 3 +++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
> index 9e70d49b60..f1390a18d0 100644
> --- a/package/pkg-meson.mk
> +++ b/package/pkg-meson.mk
> @@ -81,6 +81,7 @@ define PKG_MESON_CROSSCONFIG_SED
>          -e "s%@TARGET_CXXFLAGS@%$(call make-sq-comma-list,$($(strip $(2))))%g" \
>          -e "s%@BR2_CMAKE@%$(BR2_CMAKE)%g" \
>          -e "s%@PKGCONF_HOST_BINARY@%$(HOST_DIR)/bin/pkgconf%g" \
> +        -e "s%@HOST_DIR@%$(HOST_DIR)%g" \
>          -e "s%@STAGING_DIR@%$(STAGING_DIR)%g" \
>          -e "s%@STATIC@%$(if $(BR2_STATIC_LIBS),true,false)%g" \
>          $(TOPDIR)/support/misc/cross-compilation.conf.in
> diff --git a/support/misc/cross-compilation.conf.in b/support/misc/cross-compilation.conf.in
> index 1977a83501..235e5a8495 100644
> --- a/support/misc/cross-compilation.conf.in
> +++ b/support/misc/cross-compilation.conf.in
> @@ -26,6 +26,9 @@ needs_exe_wrapper = true
>  sys_root = '@STAGING_DIR@'
>  pkg_config_libdir = '@STAGING_DIR@/usr/lib/pkgconfig:@STAGING_DIR@/usr/share/pkgconfig'
>  pkg_config_static = '@STATIC@'
> +# enable meson build to pass a toolchain file to cmake
> +cmake_toolchain_file = '@HOST_DIR@/share/buildroot/toolchainfile.cmake'
> +cmake_defaults = false
>  
>  [host_machine]
>  system = 'linux'
> -- 
> 2.34.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] meson-package: prevent cmake find_package() picking up host libraries
  2022-04-21 15:25 [Buildroot] [PATCH 1/1] meson-package: prevent cmake find_package() picking up host libraries Andreas Ziegler
  2022-04-21 19:44 ` Yann E. MORIN
@ 2022-05-24 12:51 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2022-05-24 12:51 UTC (permalink / raw)
  To: Andreas Ziegler; +Cc: Eric Le Bihan, buildroot

>>>>> "Andreas" == Andreas Ziegler <br015@umbiko.net> writes:

 > The meson build system uses (1) pkg-config and (2) cmake find_package to locate 
 > dependencies and stops only if a package is found. Cmake uses a toolchain file 
 > that is generated by meson from the existing configuration [1]. 

 > The cmake toolchain file misses CMAKE_FIND_ROOT_PATH and CMAKE_FIND_ROOT_PATH_* 
 > settings, and find_package() falls back to the default behaviour and looks for 
 > dependencies on the build machine (the Buildroot HOST_DIR). 

 > Use a feature introduced in meson 0.56.0 [2] to pass the Buildroot toolchain 
 > file to cmake instead of using a meson-generated one. 

 > Fixes the following build failures:
 > http://autobuild.buildroot.org/results/056/05673ed04c6f044f1b56b9d5342d61653be43a18/
 > http://autobuild.buildroot.org/results/f0a/f0a9e719114f19dc9d20622ed85dd4f8e968c20f/
 > http://autobuild.buildroot.org/results/527/527ee199813abbacd61c3fa32b517ea60af60659/

 > [1[ see mesonbuild/cmake/toolchain.py
 > [2] see https://mesonbuild.com/CMake-module.html#cross-compilation

 > Signed-off-by: Andreas Ziegler <br015@umbiko.net>

Committed to 2022.02.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2022-05-24 12:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21 15:25 [Buildroot] [PATCH 1/1] meson-package: prevent cmake find_package() picking up host libraries Andreas Ziegler
2022-04-21 19:44 ` Yann E. MORIN
2022-05-24 12:51 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.