Bug 14951 - Host tool contamination in cmake-native (libcurl cmake files)
Summary: Host tool contamination in cmake-native (libcurl cmake files)
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: 5.99
Hardware: All Multiple
: High normal
Target Milestone: 4.2 M1
Assignee: Richard Purdie
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2022-10-27 14:15 UTC by Bernhard Rosenkränzer
Modified: 2022-11-03 12:49 UTC (History)
4 users (show)

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


Attachments
Patch (1.77 KB, patch)
2022-10-27 15:36 UTC, Bernhard Rosenkränzer
bero: commit?
bero: copyright-waived+
bero: review?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bernhard Rosenkränzer 2022-10-27 14:15:56 UTC
Trying to build cmake-native on a host system where curl was built with cmake (resulting in CURLConfig.cmake and friends, which do not use the same naming schemes expected by cmake-native's build process, being installed to a system wide cmake directory like /usr/lib64/cmake/CURL) results in undefined references to all libcurl symbols.

The problem is that cmake-native sees and uses the system wide /usr/lib64/cmake/CURL/CURLConfig.cmake, which defines CURL::libcurl and CURL::curl as opposed to setting ${CURL_LIBRARIES} as expected by cmake-native.

find_package(CURL) (cmake-native's CMakeLists.txt, line 478) succeeds, but incorrectly uses the system wide CURLConfig.cmake, resulting CMAKE_CURL_LIBRARIES to be set to an empty string (cmake-native's CMakeLists.txt, line 484), causing the cmake-native build to miss -lcurl.

find_package(CURL) in the context should prefer Modules/FindCURL.cmake (in cmake-native's source) over a system CURLConfig.cmake.

As expected, the obvious workaround (removing the host curl's cmake files) works.
Comment 1 Bernhard Rosenkränzer 2022-10-27 15:36:32 UTC
Created attachment 4909 [details]
Patch

Attaching simple fix (also sending to ML)
Comment 2 Richard Purdie 2022-11-03 12:49:48 UTC
Thanks for the patch, this was merged:

https://git.yoctoproject.org/poky/commit/?id=bd156c4618aed51d2b0a3c3bc4f6d619c51d3989