Bug 266389 - devel/qtcreator configure fails if yaml-cpp is installed, also does not build if googletest installed
Summary: devel/qtcreator configure fails if yaml-cpp is installed, also does not build...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-kde (group)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-13 00:42 UTC by alt2600
Modified: 2022-11-14 12:34 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (kde)


Attachments
configure log (10.18 KB, text/plain)
2022-09-13 00:42 UTC, alt2600
no flags Details
CMakeOutput.log (16.08 KB, text/plain)
2022-09-13 00:42 UTC, alt2600
no flags Details
git-patch_fix_if_yaml-cpp_googletest_installed.diff (1.64 KB, patch)
2022-09-15 00:23 UTC, alt2600
no flags Details | Diff
git-patch_fix_if_yaml-cpp_googletest_installed-Rev1.diff (588 bytes, patch)
2022-09-23 23:37 UTC, alt2600
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description alt2600 2022-09-13 00:42:08 UTC
Created attachment 236523 [details]
configure log

two issues I've had with this thing, it hasn't built for me for a while, and i noticed cmake brings in googletest if its found which isn't a listed dependency so I was looking for the CMAKE_ARG to disable but it doesn't seem to be a switch. I think I can force it to be disabled by forcing the cmake environment of GOOGLETEST_DIR to a known place if cannot be found, or patching it out if that fails, but I ran into an issue trying to just get things configured to even test making some sort of patch. Here is a snippet, I've attached the full log as well. This is new, previously it was building and long in the process it failed with odd errors about missing googletest types, with oddly misnamed/mangled names of items that did seem to exist in the headers it found. Either way, I cannot now get it to configure, not sure if this is due to changes in how the QT.mk files getting ready for QT 6. I've included the Cmakelog as well, but I don't see any outright errors in it.

-- The following features have been disabled:

 * Build online documentation
 * Build tests
 * Build with sanitize, SANITIZE_FLAGS=''
 * Build with Crashpad
 * Library KSyntaxHighlighting
 * Library Nanotrace
 * Build Qbs
 * Native WebKit help viewer, with CONDITION FWWebKit AND FWAppKit AND Qt5_VERSION VERSION_LESS 6.0.0
 * Plugin ClangTools, with CONDITION TARGET yaml-cpp
 * Plugin QmlDesigner, with CONDITION Qt5_VERSION VERSION_GREATER_EQUAL 6.2.0 AND TARGET Qt5::QuickWidgets AND TARGET Qt5::Svg
 * Plugin assetexporterplugin, with CONDITION TARGET QmlDesigner
 * Plugin componentsplugin, with CONDITION TARGET QmlDesigner
 * Plugin qmlpreviewplugin, with CONDITION TARGET QmlDesigner
 * Plugin qtquickplugin, with CONDITION TARGET QmlDesigner
 * Plugin StudioPlugin, with CONDITION TARGET QmlDesigner
 * Plugin StudioWelcome, with CONDITION TARGET Qt5::QuickWidgets AND TARGET QmlDesigner
 * Qt Quick 3D particles, with CONDITION TARGET Qt5::Quick3DParticles
 * Qt Quick 3D asset utils, with CONDITION TARGET Qt5::Quick3DAssetUtils
 * multilanguage-support in qml2puppet, with CONDITION TARGET QtCreator::multilanguage-support
 * Include developer documentation

-- Configuring incomplete, errors occurred!
See also "/usr/ports/devel/qtcreator/work/.build/CMakeFiles/CMakeOutput.log".
*** Error code 1
Comment 1 alt2600 2022-09-13 00:42:54 UTC
Created attachment 236524 [details]
CMakeOutput.log
Comment 2 alt2600 2022-09-13 01:24:40 UTC
btw amd64 13.1p1 is my system

I can make a patch once I can get configure working again, but the easiest method to stop googletest from tainting the build if its installed is by adding this to the Makefile for the port. not sure if this could/should be done with googlebenchmark, not sure if we have that in ports, I don't have it installed to know how it behaves in the build. I think this is cleaner then patching the cmake files directory, as it is self-contained in the Makefile and easy to undo if for some reason googletest is added as an option at some point in the future.


post-patch:
# upstream has no option, so wipe finding googletest the second easiest way
	${ECHO_CMD} ' ' > ${WRKSRC}/cmake/FindGoogletest.cmake
Comment 3 alt2600 2022-09-15 00:23:40 UTC
Created attachment 236558 [details]
git-patch_fix_if_yaml-cpp_googletest_installed.diff

tooled around a bit more, and noticed configure fails if yaml-cpp is installed on system and build fails if googletest is installed.

this patch forces uses of bundled yaml-cpp, and eliminates the cmake find routines for the optional googletest dependency to allow port to build on systems that have googletest and yaml-cpp installed on them. googletest can be eliminated by wiping the cmake find routine file, but yaml-cpp requires eliminating the conditional if it is found on the system and instead forces the routines to use the bundled version.

port now configures, installs, and runs fine when built on a live system from ports.
Comment 4 Florian Walpen 2022-09-18 10:45:09 UTC
(In reply to alt2600 from comment #2)

Did you try to actually use the system yaml-cpp?
There was a version mismatch when I first created the CMake version of the devel/qtcreator Makefile, but there's been updates to both ports since then.

I don't remember running into issues with devel/googletest but I'm using clean poudriere builds. Maybe there's a chance we can fix the tests? I will look into that later today. Otherwise, disabling them should be fine. Google benchmark is just devel/benchmark BTW.
Comment 5 alt2600 2022-09-18 19:49:10 UTC
(In reply to Florian Walpen from comment #4)

I did not look into allowing an undocumented dependency to be added to my system by making it work here. I only sought to make the port respond in a live system the way it would if built in poudriere by getting rid of the autoadd the kitchen sink garbage that Cmake provides with no cleaner options available to enable/disable those finding "features" of Cmake.

I don't have any logs, but I can say it used to configure, presumably with yaml-cpp installed, and only broke due to googletest when qtcreator first updated to 8, and off an on I would check if I could build it, but it had been a while since I gave it another go and found the problems. I didn't look to hard previously to see why it was broken, I didn't think it was due to installed ports. Although it appears the only port I have using yaml-cpp is audio/supercollider which I installed in late August around the time I started maybe noticing this issue with qtcreator. I can't say for certain that is when it was first installed, but the dates line up as I dig a little more.

googletest shows mangled namespaces to its C++ classes when used, oddly double prefixed library calls that result in symbols not being found, or missing custom data types.
Comment 6 Florian Walpen 2022-09-19 00:57:26 UTC
(In reply to alt2600 from comment #5)

Could you try the following Makefile lines instead of your patch:

CMAKE_ON+=	CMAKE_DISABLE_FIND_PACKAGE_Googletest
CMAKE_OFF+=	yaml-cpp_FOUND

This worked for me when building with devel/yaml-cpp and devel/googletest installed. The first line disables Googletest completely, but doesn't seem to change what is installed and packaged. Probably disables unit tests, but we don't use them at the moment.
The second line lets CMake skip the part you patched out. An internal yaml-cpp is built and the plugin depending on it too.

None of that is CMake's fault though - it's QtCreator which fails to import / bundle things in a reasonable way, thereby replacing the system CMake scripts  that would work correctly.
They even misused their own qmake build scripts, long time ago when I did a pkgsrc port. Maybe a tradition or something...
Comment 7 alt2600 2022-09-19 22:21:44 UTC
(In reply to Florian Walpen from comment #6)

indeed it isn't cmake, its just sometimes the options are so buried, and it seems I only ever see folks patch them out. But you obviously have more experience as your tweaks seemed to configure fine, build/stage, and do so without orphans. Also they are considerable more clean then my hacks.

So I learned something today, that hopefully will work when things like this come up for cmake builds in the future for me. I didn't think these variables were even exposed if they were not in the main cmake build file as defined options there.
Comment 8 alt2600 2022-09-23 23:37:22 UTC
Created attachment 236780 [details]
git-patch_fix_if_yaml-cpp_googletest_installed-Rev1.diff

it dawned on me way to late that perhaps I should update my patch, so this is the much simpler for using the CMAKE options to turn off yaml-cpp and googletest discovery
Comment 9 Florian Walpen 2022-09-24 19:05:19 UTC
Did some brief tests, patch looks good to me.

Some info for the maintainers: QtCreator wants the complete Googletest sources, not just headers and library as provided by devel/googletest. If present, the QtCreator build compiles its own copy of the source files, but finds the headers in the system include path first - obviously they are incompatible.
Removing the system include path is not an option, and I couldn't find a quick way to reverse the order of the include paths. Thus disable Googletest altogether, QtCreator application works fine without it.

Regarding yaml-cpp, setting this flag probably only works because of the way QtCreator reimplements cmake/Findyaml-cpp.cmake. But that part of the build has been pretty stable for some years.
Comment 10 commit-hook freebsd_committer freebsd_triage 2022-11-14 12:20:59 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=aa140d115fa8a524e9c0fcd4bae2bddaa24b8687

commit aa140d115fa8a524e9c0fcd4bae2bddaa24b8687
Author:     Florian Walpen <dev@submerge.ch>
AuthorDate: 2022-11-14 07:38:23 +0000
Commit:     Adriaan de Groot <adridg@FreeBSD.org>
CommitDate: 2022-11-14 12:18:56 +0000

    devel/qtcreator: update to 8.0.2 and improve robustness

    PR:             267256
    PR:             266389
    Reported by:    alt2600@icould.com, Florian Walpen

 devel/qtcreator/Makefile  | 14 +++++++++-----
 devel/qtcreator/distinfo  |  6 +++---
 devel/qtcreator/pkg-plist |  2 ++
 3 files changed, 14 insertions(+), 8 deletions(-)