Bug 460025 - When trying to generate makefile, I'm getting errors about not being able to link against KDev::Tests
Summary: When trying to generate makefile, I'm getting errors about not being able to ...
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CSS (other bugs)
Version First Reported In: git master
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-06 00:36 UTC by Timothy Hutchins
Modified: 2022-10-10 18:48 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Timothy Hutchins 2022-10-06 00:36:36 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Clone the repository (commit: d9162558095a5ee8a6f82591c292e5e599bd7f6c)
2. Make a build directory (mkdir build && cd build)
3. Run cmake ..

OBSERVED RESULT
I get a bunch of errors about a bunch of targets trying to link against target KDev::Tests but it could not be found.

EXPECTED RESULT
It generates the makefile.

SOFTWARE/OS VERSIONS
Windows: None
macOS: None
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.25.5
KDE Frameworks Version: 5.98.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION
According to this mail archive I will show below, by default, the KDev::Tests target is only built when BUILD_TESTING is enabled using CMake with KDevelop. With that information, the only way to get the target is to build kdevelop from source with that enabled.

https://www.mail-archive.com/search?l=kde-bugs-dist@kde.org&q=subject:%22%5C%5Bkdevplatform%5C%5D+%5C%5BBug+409951%5C%5D+Missing+component+KDev%5C%3A%5C%3ATests+required+for+Umbrello%22&o=newest&f=1
Comment 1 Igor Kushnir 2022-10-06 12:09:37 UTC
Which project are you trying to build? d9162558095a5ee8a6f82591c292e5e599bd7f6c does not refer to a commit in KDevelop repository.
Comment 2 Timothy Hutchins 2022-10-06 23:48:56 UTC
(In reply to Igor Kushnir from comment #1)
> Which project are you trying to build?
> d9162558095a5ee8a6f82591c292e5e599bd7f6c does not refer to a commit in
> KDevelop repository.

I am trying to build the kdev-css language support addon.
Comment 3 Timothy Hutchins 2022-10-07 00:28:37 UTC
(In reply to Timothy Hutchins from comment #2)
> (In reply to Igor Kushnir from comment #1)
> > Which project are you trying to build?
> > d9162558095a5ee8a6f82591c292e5e599bd7f6c does not refer to a commit in
> > KDevelop repository.
> 
> I am trying to build the kdev-css language support addon.

This is the relevant repository: https://invent.kde.org/kdevelop/kdev-css
Comment 4 Igor Kushnir 2022-10-07 09:00:48 UTC
1. Doesn't Ubuntu provide a package with KDev::Tests?
2. Have you tried turning off BUILD_TESTING CMake variable in kdev-css?
Comment 5 Timothy Hutchins 2022-10-07 15:28:59 UTC
(In reply to Igor Kushnir from comment #4)
> 1. Doesn't Ubuntu provide a package with KDev::Tests?
> 2. Have you tried turning off BUILD_TESTING CMake variable in kdev-css?

1 > kdevelop provides it, but it has to be compiled from source manually with BUILD_TESTING set to on, in the release builds that get pushed to the repositories that option is set to off.
2 > I did try, and looked in the CMakeLists.txt file and I don't think that the project implements that option.
Comment 6 Igor Kushnir 2022-10-07 16:55:36 UTC
According to kdev-css git history, it always unconditionally depended on KDev::Tests. So either something has changed elsewhere recently, or there is some issue on your system.
> 1 > kdevelop provides it, but it has to be compiled from source manually with BUILD_TESTING set to on, in the release builds that get pushed to the repositories that option is set to off.
I thought that Ubuntu could provide a separate (split) package with KDev::Tests, but maybe it doesn't.
> 2 > I did try, and looked in the CMakeLists.txt file and I don't think that the project implements that option.
https://api.kde.org/ecm/module/ECMMarkAsTest.html?highlight=build_testing
Did you reconfigure CMake after disabling BUILD_TESTING?
Comment 7 Timothy Hutchins 2022-10-07 22:45:10 UTC
(In reply to Igor Kushnir from comment #6)
> According to kdev-css git history, it always unconditionally depended on
> KDev::Tests. So either something has changed elsewhere recently, or there is
> some issue on your system.
> > 1 > kdevelop provides it, but it has to be compiled from source manually with BUILD_TESTING set to on, in the release builds that get pushed to the repositories that option is set to off.
> I thought that Ubuntu could provide a separate (split) package with
If it is, then it must not be well documented, I tried looking and ended up empty handed.
> KDev::Tests, but maybe it doesn't.
> > 2 > I did try, and looked in the CMakeLists.txt file and I don't think that the project implements that option.
> https://api.kde.org/ecm/module/ECMMarkAsTest.html?highlight=build_testing
> Did you reconfigure CMake after disabling BUILD_TESTING?
Yes, many times, all yealding the same result. If kdev-css depends on it, then I believe I would have to compile KDevelop manual.
Would you possibly know what target I would have to build to build KDev::Tests so that I won't have to build the entire thing?
Comment 8 Igor Kushnir 2022-10-08 07:56:52 UTC
I think you are right that something is wrong in kdev-css. See e.g. https://invent.kde.org/kdevelop/kdev-php/-/blob/master/parser/CMakeLists.txt

Try to enclose the test code in kdev-css/CMakeLists.txt in the `if (BUILD_TESTING)` block. If it works well, please create a merge request.
Comment 9 Timothy Hutchins 2022-10-08 16:28:15 UTC
(In reply to Igor Kushnir from comment #8)
> I think you are right that something is wrong in kdev-css. See e.g.
> https://invent.kde.org/kdevelop/kdev-php/-/blob/master/parser/CMakeLists.txt
> 
> Try to enclose the test code in kdev-css/CMakeLists.txt in the `if
> (BUILD_TESTING)` block. If it works well, please create a merge request.

The issue has been resolved and a relevant merge request has been created at https://invent.kde.org/kdevelop/kdev-css/-/merge_requests/2
Comment 10 Igor Kushnir 2022-10-10 18:48:16 UTC
Git commit 0f762acc3e4f00990b31a5e1b94c4866ff2c65f7 by Igor Kushnir, on behalf of Timothy Hutchins.
Committed on 10/10/2022 at 08:37.
Pushed by igorkushnir into branch 'master'.

Don't build tests if BUILD_TESTING CMake option is off

Neither kdevelop package nor any extra split package on Ubuntu contains
KDev::Tests library. Now instead of rebuilding the kdevelop package with
test support, the users can simply turn the BUILD_TESTING option off
while building this plugin.

M  +53   -51   CMakeLists.txt
M  +27   -25   parser/CMakeLists.txt

https://invent.kde.org/kdevelop/kdev-css/commit/0f762acc3e4f00990b31a5e1b94c4866ff2c65f7