Bug 14927 - Meson >= 59.0 fails to find Threads dependency using CMake
Summary: Meson >= 59.0 fails to find Threads dependency using CMake
Status: RESOLVED INVALID
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: 4.0.2
Hardware: x86 Multiple
: Undecided normal
Target Milestone: ---
Assignee: Unassigned
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2022-10-12 08:52 UTC by Toni Lammi
Modified: 2022-10-13 14:42 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Toni Lammi 2022-10-12 08:52:02 UTC
Meson fails when searching for Threads dependency using cmake:
dependency('Threads', method: 'cmake', modules: ['Threads::Threads'])

This issue was likely caused by an update to how Meson manages
CMake dependencies: https://github.com/mesonbuild/meson/pull/8812
See also issue in meson: https://github.com/mesonbuild/meson/issues/10384
The issue only occurs with meson >= 59.0


I studied this issue a bit and found a couple workarounds for this in Yocto:
First one is to modify cmake_toolchain_file in SDK's meson.cross from
cmake_toolchain_file='<sdkpath>/usr/share/cmake/OEToolchainConfig.cmake'
to
cmake_toolchain_file='<sdkpath>/usr/share/cmake/cortexa53-crypto-<distro>-toolchain.cmake'
Another one is to modify OEToolchainConfig.cmake from
file( GLOB toolchain_config_files "${CMAKE_CURRENT_LIST_FILE}.d/*.cmake" )
to
file( GLOB toolchain_config_files "${CMAKE_CURRENT_LIST_DIR}/*toolchain.cmake" )

To me it looks like the SDK's configuration is a bit off and meson therefore
fails to get the correct information from the environment.

I'm wondering if this behavior is a bug or if I'm doing something wrong here.
Comment 1 Toni Lammi 2022-10-12 11:53:55 UTC
Looking at this a bit more and I can see that the cmake_toolchain_file option
comes from our own layer so I think this is not actually an oe-core issue.

It seems that OE-core does not have support for this cmake-meson interoperability
out-of-the-box.
Comment 2 Randy MacLeod 2022-10-13 14:42:38 UTC
Seems to be specific to Toni's local layer.