Bug 6972 - breaks build of software using cmake packages due to hardcoded paths
Summary: breaks build of software using cmake packages due to hardcoded paths
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: configuration (show other bugs)
Version: 1.7
Hardware: x86 Multiple
: Medium normal
Target Milestone: 2.2
Assignee: Alexander Kanavin
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2014-11-16 22:16 UTC by Matthieu Gallien
Modified: 2016-10-05 12:57 UTC (History)
2 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 Matthieu Gallien 2014-11-16 22:16:54 UTC
In d3995ac14ba05c0420f15f264f7e9d0c3af71f74, the cmake call have been changed to provide all paths with hardcoded values. This is causing hardcoded paths in package files generated by cmake (i.e. exampleTargets-noconfig.cmake).
Those packages then fail when one depends on them because the paths are hardwired to /usr/lib or /usr/include.
In Dora, the same packages build fine.
The files generated by cmake should not contain hardcoded path since the files they reference should be located with relative path.

The error is the following:
| CMake Error at /home/mgallien/boards/poky/build/tmp/sysroots/netsam9x25/usr/lib/cmake/KF5DNSSD/KF5DNSSDTargets.cmake:64 (message):
|   The imported target "KF5::DNSSD" references the file
| 
|      "/usr/lib/libKF5DNSSD.so.5.4.0"
| 
|   but this file does not exist.  Possible reasons include:
| 
|   * The file was deleted, renamed, or moved to another location.
| 
|   * An install or uninstall procedure did not complete successfully.
| 
|   * The installation package was faulty and contained
| 
|      "/home/mgallien/boards/poky/build/tmp/sysroots/netsam9x25/usr/lib/cmake/KF5DNSSD/KF5DNSSDTargets.cmake"
| 
|   but not all the files it references.

I believe the problem is not in cmake itself because we are asking it to use absolute paths. Those absolute paths will then trigger differing behavior in cmake when generating package files. Those package files no longer work.

Best regards
Comment 1 Matthieu Gallien 2014-11-17 10:22:17 UTC
Please have a look to this bug I reported some time ago against cmake for details about why hard coded paths may create problems (http://public.kitware.com/Bug/print_bug_page.php?bug_id=14041).

Best regards
Comment 2 Jussi Kukkonen 2016-10-05 12:57:14 UTC
I believe this has been fixed by following commit. Please reopen if this is not the case.

commit 7afa09db2e10896c8da91f7d19a569b13e34a7b7
Author: Thomas Witt <Thomas.Witt@bmw.de>
Date:   Mon Aug 22 16:27:11 2016 +0200

    cmake.bbclass: call cmake with a relative path
    
    CMake wants a relative path for CMAKE_INSTALL_*DIR, an absolute path
    breaks cross-compilation. This fact is documented in the following
    ticket: https://cmake.org/Bug/view.php?id=14367
    
    $sysconfdir and $localstatedir are not relative to $prefix, so they are
    still set as absolute paths. With his change ${PROJECT}Targets.cmake
    that are generated by cmakes "export" function will contain relative
    paths instead of absolute ones.
    
    (From OE-Core rev: c03b32bd71dbe04f2f239556fea0b53215e403d7)