SUMMARY If a required dependency is missing in a project using the meson build system KDevelop keeps trying to reconfigure the project in an infinite loop. STEPS TO REPRODUCE 1. Clone a project that uses meson (eg horizon-eda) 2. Add a missing dependency or uninstall a required dependency 3. Configure the project in KDevelop or in a terminal OBSERVED RESULT KDevelop keeps trying to reconfigure in an infinite loop. EXPECTED RESULT It should run configure once, fail, then stop. SOFTWARE/OS VERSIONS Windows: macOS: Linux/KDE Plasma: 6.0.0 (available in About System) KDE Plasma Version: 6.0.0 KDE Frameworks Version: 6.0.0 Qt Version: 6.6.2 ADDITIONAL INFORMATION It seems like there is something triggering a reconfigure on a file change since running meson in a separate terminal in the build folder causes KDevelop to start reconfiguring.
A fix merge request at https://invent.kde.org/kdevelop/kdevelop/-/merge_requests is welcome. Note that few KDevelop developers use Meson, so the KDevMesonManager plugin is not actively maintained. But users occasionally contribute small fixes to Meson support.
(In reply to Igor Kushnir from comment #1) > A fix merge request at > https://invent.kde.org/kdevelop/kdevelop/-/merge_requests is welcome. Note > that few KDevelop developers use Meson, so the KDevMesonManager plugin is > not actively maintained. But users occasionally contribute small fixes to > Meson support. I pushed a branch that stops the loop to github https://github.com/KDE/kdevelop/compare/master...frmdstryr:kdevelop:meson-info-only-reparse-if-contents-changed . I had problems pushing to invent.
(In reply to frmdstryr from comment #2) > I pushed a branch that stops the loop to github > https://github.com/KDE/kdevelop/compare/master...frmdstryr:kdevelop:meson-info-only-reparse-if-contents-changed > . I had problems pushing to invent. What problem? Did you fork the KDevelop repository? Tried pushing to an SSH URL, e.g. git@invent.kde.org:frmdstryr/kdevelop.git ? If the bug is present only in the branch work/apol/kf6, target it in your merge request.
(In reply to Igor Kushnir from comment #3) > (In reply to frmdstryr from comment #2) > > I pushed a branch that stops the loop to github > > https://github.com/KDE/kdevelop/compare/master...frmdstryr:kdevelop:meson-info-only-reparse-if-contents-changed > > . I had problems pushing to invent. > What problem? Did you fork the KDevelop repository? Tried pushing to an SSH > URL, e.g. git@invent.kde.org:frmdstryr/kdevelop.git ? If the bug is present > only in the branch work/apol/kf6, target it in your merge request. I figured it out and pushed to https://invent.kde.org/frmdstryr/kdevelop/-/tree/meson-info-only-reparse-if-contents-changed?ref_type=heads . This issue is unrelated to KF6 from what I can tell. The file watcher triggers when the meson file stats change even if no contents changed.
(In reply to frmdstryr from comment #4) > This issue is unrelated to KF6 from what I can tell. The file watcher > triggers when the meson file stats change even if no contents changed. Rebase on master and create a merge request at https://invent.kde.org/kdevelop/kdevelop/-/merge_requests please. Maybe expand the commit message to explain the bug and the fix better. Add the following after a blank line at the bottom of the commit message to comment and automatically close this bug when merged: BUG: 482983 FIXED-IN: 5.14
A possibly relevant merge request was started @ https://invent.kde.org/kdevelop/kdevelop/-/merge_requests/545
I cannot reproduce the infinite loop when I add a bogus dependency to the simple meson project created from a KDevelop template (Standard=>Terminal=>Meson C++): ``` + bb=dependency('missingd', version:'>=5.0') executable('kdev-meson-cpp-test-project', 'main.cpp', include_directories : incdir + , dependencies : bb ``` The configuration job fails once and is not restarted: ``` Run-time dependency missingd found: NO (tried pkgconfig and cmake) meson.build:15:3: ERROR: Dependency "missingd" not found, tried pkgconfig and cmake A full log can be found at /path/to/kdev-meson-cpp-test-project/build/meson-logs/meson-log.txt *** Failure: Exit code 1 *** ``` Is some additional configuration of the project or KDevelop needed?
(In reply to Igor Kushnir from comment #7) > I cannot reproduce the infinite loop when I add a bogus dependency to the > simple meson project created from a KDevelop template > (Standard=>Terminal=>Meson C++): > ``` > + bb=dependency('missingd', version:'>=5.0') > executable('kdev-meson-cpp-test-project', > 'main.cpp', > include_directories : incdir > + , dependencies : bb > ``` > > The configuration job fails once and is not restarted: > ``` > Run-time dependency missingd found: NO (tried pkgconfig and cmake) > > meson.build:15:3: ERROR: Dependency "missingd" not found, tried pkgconfig > and cmake > > A full log can be found at > /path/to/kdev-meson-cpp-test-project/build/meson-logs/meson-log.txt > *** Failure: Exit code 1 *** > ``` > > Is some additional configuration of the project or KDevelop needed? Does the build/meson-info/meson-info.json file exist? It occurred for a project (https://github.com/horizon-eda/horizon) that was already imported and built but then I updated a library version that meson could not find.
(In reply to frmdstryr from comment #8) > (In reply to Igor Kushnir from comment #7) > > I cannot reproduce the infinite loop when I add a bogus dependency to the > > simple meson project created from a KDevelop template > > (Standard=>Terminal=>Meson C++): > > ``` > > + bb=dependency('missingd', version:'>=5.0') > > executable('kdev-meson-cpp-test-project', > > 'main.cpp', > > include_directories : incdir > > + , dependencies : bb > > ``` > > > > The configuration job fails once and is not restarted: > > ``` > > Run-time dependency missingd found: NO (tried pkgconfig and cmake) > > > > meson.build:15:3: ERROR: Dependency "missingd" not found, tried pkgconfig > > and cmake > > > > A full log can be found at > > /path/to/kdev-meson-cpp-test-project/build/meson-logs/meson-log.txt > > *** Failure: Exit code 1 *** > > ``` > > > > Is some additional configuration of the project or KDevelop needed? > > Does the build/meson-info/meson-info.json file exist? It occurred for a > project (https://github.com/horizon-eda/horizon) that was already imported > and built but then I updated a library version that meson could not find. I also cannot reproduce with the template project, let me see what else it required for this to happen.
(In reply to frmdstryr from comment #9) > (In reply to frmdstryr from comment #8) > > (In reply to Igor Kushnir from comment #7) > > > I cannot reproduce the infinite loop when I add a bogus dependency to the > > > simple meson project created from a KDevelop template > > > (Standard=>Terminal=>Meson C++): > > > ``` > > > + bb=dependency('missingd', version:'>=5.0') > > > executable('kdev-meson-cpp-test-project', > > > 'main.cpp', > > > include_directories : incdir > > > + , dependencies : bb > > > ``` > > > > > > The configuration job fails once and is not restarted: > > > ``` > > > Run-time dependency missingd found: NO (tried pkgconfig and cmake) > > > > > > meson.build:15:3: ERROR: Dependency "missingd" not found, tried pkgconfig > > > and cmake > > > > > > A full log can be found at > > > /path/to/kdev-meson-cpp-test-project/build/meson-logs/meson-log.txt > > > *** Failure: Exit code 1 *** > > > ``` > > > > > > Is some additional configuration of the project or KDevelop needed? > > > > Does the build/meson-info/meson-info.json file exist? It occurred for a > > project (https://github.com/horizon-eda/horizon) that was already imported > > and built but then I updated a library version that meson could not find. > > I also cannot reproduce with the template project, let me see what else it > required for this to happen. Ok, it was more complicated to reproduce: 1. Create the project using the meson template 2. Build the project 3. Add a line in meson.build to introduce an error like a non-existent library or missing version 4. Run prune 5. Run build or configure again and the loop should start There may be an better/easier way to fix it since it seems like a race condition because there is a watch on create and dirty it so the job appears to be running twice in parallel.
(In reply to frmdstryr from comment #10) > There may be an better/easier way to fix it since it seems like a race > condition because there is a watch on create and dirty it so the job appears > to be running twice in parallel. Sorry, haven't noticed the suggestion about a better fix before reviewing your merge request. I think the Meson configure job creates the file. The MESON_FAILED_CONFIGURATION branch in MesonBuilder::configure() is taken. But I don't know how to fix this properly. Detect the configure loop and break it somehow? Would that be better than the relatively simple and safe file hash sum approach in the merge request?
Git commit 341638803895bd9910f8d79a4942733b21f75ff3 by Igor Kushnir, on behalf of Jairus Martin. Committed on 05/04/2024 at 10:54. Pushed by igorkushnir into branch 'master'. Only reparse project if meson-info contents change Currently there is a file watcher that reloads the project when the meson-info.json file changes. If the project fails to configure, kdevelop keeps attempting to reconfigure in a loop because the meson-info.json file keeps getting rewritten. This change makes it only reconfigure if the contents of the watched file are actually changed avoiding the loop. FIXED-IN: 5.14 M +25 -0 plugins/meson/mesonmanager.cpp M +1 -0 plugins/meson/mesonmanager.h https://invent.kde.org/kdevelop/kdevelop/-/commit/341638803895bd9910f8d79a4942733b21f75ff3