Bug 395627 - CMAKE_{PREFIX,MODULE}_PATH not set at all
Summary: CMAKE_{PREFIX,MODULE}_PATH not set at all
Status: RESOLVED FIXED
Alias: None
Product: kdesrc-build
Classification: Developer tools
Component: general (show other bugs)
Version: Git
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Michael Pyne
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-19 21:08 UTC by Denis Kurz
Modified: 2018-07-01 23:18 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 18.08
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Kurz 2018-06-19 21:08:06 UTC
I set up a new KDE dev environment with an adapted kdesrc-buildrc file that used to work (see below). When I invoke "kdesrc-build kde/pim", CMAKE_PREFIX_PATH is already set. However, in the build directory created by kdesrc-build, that variable is set to "/usr" in the CMake env, as revealed by "ccmake ." or "grep -R CMAKE_PREFIX_PATH".

As a consequence, all KF5*_DIR variables are set to /usr/lib64/cmake/..., and building, e.g., kmail fails because of an API break in kontactinterface.

I also tried (all?) combinations of --include-dependencies and adding "-DCMAKE_PREFIX_PATH" to cmake-options in kdesrc-buildrc, to no avail. The CMAKE_BUILD_TYPE, however, is correctly set; I set this one as a cmake-option in the same line in kdesrc-buildrc, see below. After each config change, I ran "kdesrc-build --rc-file=<the-one-below> kmail".

I can fix the build failure of kmail by simply setting KF5KontactInterface_DIR manually. However, this does not scale for all those dependencies in all the PIM projects.

This is my current kdesrc-buildrc:

global
    branch-group stable-kf5-qt5
    qtdir /usr

    source-dir /home/denis/kde/stable/src
    build-dir  /home/denis/kde/stable/build
    log-dir    /home/denis/kde/stable/log
    kdedir     /home/denis/kde/stable/usr

    ignore-kde-structure true
    cmake-options -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=/home/denis/kde/stable/usr
    make-options -j9
end global

include /home/denis/kde/master/src/kdesrc-build/kf5-qt5-build-include
Comment 1 Denis Kurz 2018-06-20 18:52:59 UTC
Using git bisect, I found the commit that broke it for me:

https://phabricator.kde.org/R365:51f20932df47f0b96b41ef22960b5600e0e65800

I don't know perl, so I can only guess that /something/ (that involves CMAKE_PREFIX_PATH) happens if $qtdir != $prefix. If $prefix is kdedir, and $qtdir is qtdir from the config file, then those two clearly differ in my config.

As a workaround, both of the following steps cured the problem for me:
 * Revert the above commit on master, or alternatively
 * Removing the "qtdir /usr" line from my config, which was not needed anyway.

(not both steps are required; they each fix it separately)
Comment 2 Michael Pyne 2018-06-21 02:47:56 UTC
Knowing the git commit helps. I'll revert for now and then see if I can fix and add a testcase to prevent recurrence.
Comment 3 Michael Pyne 2018-06-21 02:54:47 UTC
Actually now that I look at the revert, that fixed a different bug too.

The problem here was that CMAKE_PREFIX_PATH *was* being set (to Qt's path, under /usr). The bug is that we shouldn't have replaced the CMAKE_PREFIX_PATH you'd already set, if we were going to add Qt's then that needs to be an addition, not a replacement.

So I'll hold off on reverting but this does still need to be fixed properly.
Comment 4 Michael Pyne 2018-07-01 23:18:29 UTC
Git commit 7f92da7b307c784deec804f65137b10733e6a88e by Michael Pyne.
Committed on 01/07/2018 at 23:15.
Pushed by mpyne into branch 'master'.

Don't double-set CMAKE_PREFIX_PATH if set by user.

This fixes bug 395627, where the error is actually that we set
CMAKE_PREFIX_PATH twice if qtdir is set to a non-system path and the
user is also setting CMAKE_PREFIX_PATH.

Unfortunately the second value overrides the first (the one the user
set).

Also added a test for this, which fails before the fix and passes
afterwards. The full test suite (all 5...) pass.
FIXED-IN:18.08

M  +5    -2    modules/ksb/BuildSystem/KDE4.pm
A  +78   -0    t/bug-395627-keep-cmake-prefix.t
A  +26   -0    t/data/bug-395627/kdesrc-buildrc

https://commits.kde.org/kdesrc-build/7f92da7b307c784deec804f65137b10733e6a88e