Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 627242

Summary: [kde overlay] dev-util/kdevplatform-9999 fails to build - Target "test_highlighting" links to target "Qt5::Test" but the target was not found.
Product: Gentoo Linux Reporter: CT <zarathustra.zoroaster>
Component: Current packagesAssignee: Gentoo KDE team <kde>
Status: RESOLVED FIXED    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description CT 2017-08-07 13:35:36 UTC
On attempting to build kdevplatform-9999 from source, I was greeted with the following generation errors from CMake:

CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:110 (add_executable):
  Target "test_highlighting" links to target "Qt5::Test" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?
Call Stack (most recent call first):
  language/highlighting/tests/CMakeLists.txt:1 (ecm_add_test)
 
 
CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:110 (add_executable):
  Target "test_duchainshutdown" links to target "Qt5::Test" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?
Call Stack (most recent call first):
  language/duchain/tests/CMakeLists.txt:4 (ecm_add_test)
 
 
CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:110 (add_executable):
  Target "test_identifier" links to target "Qt5::Test" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  language/duchain/tests/CMakeLists.txt:7 (ecm_add_test)
 
 
CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:110 (add_executable):
  Target "test_duchain" links to target "Qt5::Test" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  language/duchain/tests/CMakeLists.txt:1 (ecm_add_test)
 
 
CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:110 (add_executable):
  Target "test_stringhelpers" links to target "Qt5::Test" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?
Call Stack (most recent call first):
  language/duchain/tests/CMakeLists.txt:10 (ecm_add_test)
 
 
CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:110 (add_executable):
  Target "bench_hashes" links to target "Qt5::Test" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  language/duchain/tests/CMakeLists.txt:14 (ecm_add_test)
 
 
CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:110 (add_executable):
  Target "test_backgroundparser" links to target "Qt5::Test" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?
Call Stack (most recent call first):
  language/backgroundparser/tests/CMakeLists.txt:4 (ecm_add_test)
 
 
CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:110 (add_executable):
  Target "test_templaterenderer" links to target "Qt5::Test" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?
Call Stack (most recent call first):
  language/codegen/tests/CMakeLists.txt:5 (ecm_add_test)
 
 
CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:110 (add_executable):
  Target "test_documentchangeset" links to target "Qt5::Test" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?
Call Stack (most recent call first):
  language/codegen/tests/CMakeLists.txt:1 (ecm_add_test)
 
 
CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:110 (add_executable):
  Target "test_templateclassgenerator" links to target "Qt5::Test" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?
Call Stack (most recent call first):
  language/codegen/tests/CMakeLists.txt:8 (ecm_add_test)
 
 
CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:110 (add_executable):
  Target "test_templatesmodel" links to target "Qt5::Test" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?
Call Stack (most recent call first):
  language/codegen/tests/CMakeLists.txt:11 (ecm_add_test)
 
 
CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:110 (add_executable):
  Target "test_kdevhash" links to target "Qt5::Test" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  language/util/tests/CMakeLists.txt:1 (ecm_add_test)
 
 
CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:110 (add_executable):
  Target "test_dvcsjob" links to target "Qt5::Test" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  vcs/dvcs/tests/CMakeLists.txt:1 (ecm_add_test)
 
 
CMake Error at /usr/share/ECM/modules/ECMAddTests.cmake:110 (add_executable):
  Target "test_models" links to target "Qt5::Test" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  vcs/models/tests/CMakeLists.txt:1 (ecm_add_test)

As the requisite package (Qt5Test) was indeed found during the configuration step, this seemed an odd error, and the kdevelop CI obviously wasn't having this issue. Stranger still, building kdevplatform (master) from source outside of portage proceeded without issue. Upon consultation with upstream developers, the issue seems to result from a faulty attempt at bypassing test-related targets in the upstream build system. Worryingly, the ebuild from the kde overlay contains the following in src_prepare():

# root tests subdirectory actually does not contain tests, installs stuff
    if ! use test; then
        sed -i -e "/add_subdirectory(tests)/ s/#DONOTCOMPILE //" \
            CMakeLists.txt || die "Failed to fix CMakeLists.txt"
        sed -i -e '1s/^/find_package(Qt5Test \$\{QT_MIN_VERSION\})\n/' \
            tests/CMakeLists.txt || die "Failed to fix tests/CMakeLists.txt"
    fi

There seems to be more complex machinery in the kde5 eclass pertaining to test targets which I am unfamiliar with, especially as one upstream dev noted that the kdevplatform build output seen on two separate gentoo machines (mine and someone else's) both seem to list Qt5Test as an optional dependency, whereas the upstream build system has them pegged as mandatory dependencies. It should also be noted that in consultation with upstream, patches to properly make building tests optional are welcome.

Reproducible: Always

Steps to Reproduce:
1.Try to build dev-util/kdevplatform-9999
Actual Results:  
Build fails

Expected Results:  
Build should complete successfully

Paranoid about possibly having a stale build environment (these are live ebuilds), I bumped both ECM and CMake to their latest, non-live versions and problem persisted, was initially concerned this might be an esoteric ECM issue, but in light of the contents of the kdevplatform ebuild, this seems an unlikely hypothesis.
Comment 1 Michael Palimaka (kensington) gentoo-dev 2017-08-07 13:42:23 UTC
This is definitely a downstream issue, as our patching to make tests optional is all custom.

Looking at sample failing target in language/highlighting/tests/CMakeLists.txt:
ecm_add_test(test_highlighting.cpp
    LINK_LIBRARIES KF5::TextEditor Qt5::Test KDev::Tests KDev::Language)

I suspect something elsewhere has changed, as IIRC ecm_add_test is a noop unless testing is enabled.
Comment 2 CT 2017-08-07 14:04:06 UTC
(In reply to Michael Palimaka (kensington) from comment #1)
> This is definitely a downstream issue, as our patching to make tests
> optional is all custom.
> 
> Looking at sample failing target in
> language/highlighting/tests/CMakeLists.txt:
> ecm_add_test(test_highlighting.cpp
>     LINK_LIBRARIES KF5::TextEditor Qt5::Test KDev::Tests KDev::Language)
> 
> I suspect something elsewhere has changed, as IIRC ecm_add_test is a noop
> unless testing is enabled.

It seems the expected noop is not actually its current behavior, re: this patch https://phabricator.kde.org/D7187.
Comment 3 Kevin Funk 2017-08-07 20:41:38 UTC
https://phabricator.kde.org/D7187 has been pushed. You might want to use that patch in the extra-cmake-modules recipe.

There have been a couple of commits to kdevplatform 5.1 branch, too, which allow building it without tests enabled.

Just pass -DBUILD_TESTING=OFF to cmake.
Comment 4 Andreas Sturmlechner gentoo-dev 2017-08-08 06:37:19 UTC
Thanks!

Commit: 632e3f1055402b7b1ba939e22bbe884f159262b5
From: Andreas Sturmlechner <asturm@gentoo.org>
Date: Mon, 7 Aug 2017 21:19:26 +0200
Subject: [PATCH] dev-util/kdevplatform: Switch KDE_TEST back to "true"

Upstream commit 274260d52e127f92551742e969e12c478c7d7dae
---
 dev-util/kdevplatform/kdevplatform-5.1.9999.ebuild | 2 +-
 dev-util/kdevplatform/kdevplatform-9999.ebuild     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Comment 5 Andreas Sturmlechner gentoo-dev 2017-08-08 08:27:51 UTC
(In reply to Kevin Funk from comment #3)
> https://phabricator.kde.org/D7187 has been pushed. You might want to use
> that patch in the extra-cmake-modules recipe.
It was backported to 5.37, thanks.