Bug 403156 - Cmake fails on Fedora 28 looking for LibAlkimia and Qt4 Core and DBus
Summary: Cmake fails on Fedora 28 looking for LibAlkimia and Qt4 Core and DBus
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: buildsystem (show other bugs)
Version: git (master)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-12 20:51 UTC by Ian Neal
Modified: 2019-01-14 14:57 UTC (History)
2 users (show)

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


Attachments
attachment-14052-0.html (3.36 KB, text/html)
2019-01-13 01:54 UTC, Brendan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Neal 2019-01-12 20:51:53 UTC
SUMMARY
When trying to build kmymoney (from git master) on Fedora 28, you get an error trying to find LibAlkimia and Qt4 Core / DBus

STEPS TO REPRODUCE
1. Have Fedora 28 system
2. Make sure LibAlkimia and Qt4 libraries are installed on Fedora 28
3. Run cmake against latest kmymoney git master 

OBSERVED RESULT
Error finding LibAlkimia5 cmake file
Errors reported finding target for Qt4::Core and Qt4::DBus

EXPECTED RESULT
LibAlkimia is found
Qt4 targets found

ADDITIONAL INFORMATION
If you update the CMakeLists.txt to look for LibAlkimia instead of LibAlkimia5 cmake file, then it finds the version 7 library
If you update the CMakeLists.txt to look for Qt package as well as Qt5 then it complains about "CMake Error: The INTERFACE_QT_MAJOR_VERSION property of "Qt4::QtCore" does not agree with the value of QT_MAJOR_VERSION already determined"
Comment 1 Thomas Baumgart 2019-01-12 22:02:03 UTC
git master is Qt5/KF5 only. You won't be able to build it with Qt4. If Fedora 28 does not provide Qt5 then use the KMyMoney 4.8 branch to build. Or am I missing something here?
Comment 2 Ian Neal 2019-01-13 00:16:10 UTC
(In reply to Thomas Baumgart from comment #1)
> git master is Qt5/KF5 only. You won't be able to build it with Qt4. If
> Fedora 28 does not provide Qt5 then use the KMyMoney 4.8 branch to build. Or
> am I missing something here?

Fedora 28 does have Qt5/KF5 and ships KMyMoney5. Qt5 is installed (5.11), but when you run cmake it complains that it needs Qt4::Core and Qt4::DBus
Some example errors when running cmake are:
CMake Error at tools/CMakeLists.txt:1 (add_executable):
  Target "xea2kmt" links to target "Qt4::QtCore" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
CMake Error at tools/CMakeLists.txt:1 (add_executable):
  Target "xea2kmt" links to target "Qt4::QtDBus" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
CMake Error at kmymoney/CMakeLists.txt:114 (add_executable):
  Target "kmymoney" links to target "Qt4::QtCore" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
CMake Error at kmymoney/CMakeLists.txt:114 (add_executable):
  Target "kmymoney" links to target "Qt4::QtDBus" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Comment 3 Jack 2019-01-13 00:34:47 UTC
I vaguely recall having the same or similar problem during the switch from qt4 to qt5.  My not so accurate memory tells me there is some "generic" command being used which uses either config files or environment variables to choose whether to use the actual qt4 or qt5 version of the tool.    It's not "cmake" itself, but something it calls - or maybe just which version of some .cmake file it uses.  I remember it being an unavoidable problem when having both qt4 and qt5 installed.  

Try setting "QT_SELECT=qt5 cmake ...." and see if that forces the right versions.  Check the docs for qtchooser to see if it gives any useful hints.
Comment 4 Ian Neal 2019-01-13 01:07:44 UTC
I've made sure that qtchooser-default is pointing to qt5 and tried running cmake with QT_SELECT=qt5 but still get the same errors.
Going through the outputs in the build directory, the only reference is to qt5 not qt4
I've just removed qt3, so I'll see if that makes any difference.
Comment 5 Ian Neal 2019-01-13 01:28:22 UTC
Unfortunately that didn't make any difference, still get the same errors. Is there any extra diagnostics I can enable to see what is causing the issue?
Comment 6 Brendan 2019-01-13 01:54:14 UTC
Created attachment 117431 [details]
attachment-14052-0.html

I was able to compile KMM5 on Fedora 28 before upgrading to F29. As I
recall I had to setup a repository with one or more packages that were
required to make it work. I will look to see if I can find the details but
if you search for messages to and from me on the developer list you may
find what you are looking for.

Look for a thread with the subject "Problems Compiling KMM KF5". There may
be others that are related in that time frame.

If you have any OFX accounts mapped in KMM the mappings will be broken. You
have to unmap and remap them. I have notes that suggest changing:

provider="KMyMoney OFX"
to
provider="ofximporter"

for every bank that is mapped may fix this problem. I know I tried it, i
just don't remember if it worked or if I had to remap all of the accounts.

----
Brendan Coupe


On Sat, Jan 12, 2019 at 6:28 PM Ian Neal <bugzilla_noreply@kde.org> wrote:

> https://bugs.kde.org/show_bug.cgi?id=403156
>
> --- Comment #5 from Ian Neal <iann_bugzilla@blueyonder.co.uk> ---
> Unfortunately that didn't make any difference, still get the same errors.
> Is
> there any extra diagnostics I can enable to see what is causing the issue?
>
> --
> You are receiving this mail because:
> You are the assignee for the bug.
Comment 7 Rex Dieter 2019-01-13 05:24:45 UTC
For what it's worth, both kmymoney-5.0 and kmymoney master builds fine on f28 for me (master required building libalkimia master from source as it's not released or packaged yet).

I do not use qtchooser, so it's possible that may be to blame here somehow.
Comment 8 Thomas Baumgart 2019-01-13 07:37:12 UTC
@Rex: KMyMoney commit 15bfa066212958a258 in master should allow to build with both versions of libalkimia (released and master).
Comment 9 Rex Dieter 2019-01-13 15:24:40 UTC
Thanks for the clarification.

I'd jumped to that conclusion seeing the output:

"  The following configuration files were considered but not accepted:
    /usr/lib64/cmake/LibAlkimia5-7.0/LibAlkimia5Config.cmake, version: 7.0.1
"
Comment 10 Ralf Habacker 2019-01-14 07:49:44 UTC
(In reply to Rex Dieter from comment #9)
> Thanks for the clarification.
> 
> I'd jumped to that conclusion seeing the output:
> 
> "  The following configuration files were considered but not accepted:
>     /usr/lib64/cmake/LibAlkimia5-7.0/LibAlkimia5Config.cmake, version: 7.0.1
The alkimia check in https://cgit.kde.org/kmymoney.git/tree/CMakeLists.txt?h=5.0#n73 is hardcoded to a single alkimia version and need to be fixed. As workaround in top level CMakeLists.txt chane from 
  find_package(LibAlkimia5 7.0.0 REQUIRED)
to 
  find_package(LibAlkimia5 7.0 REQUIRED)
Comment 11 Ian Neal 2019-01-14 08:27:29 UTC
(In reply to Ralf Habacker from comment #10)
> (In reply to Rex Dieter from comment #9)
> > Thanks for the clarification.
> > 
> > I'd jumped to that conclusion seeing the output:
> > 
> > "  The following configuration files were considered but not accepted:
> >     /usr/lib64/cmake/LibAlkimia5-7.0/LibAlkimia5Config.cmake, version: 7.0.1
> The alkimia check in
> https://cgit.kde.org/kmymoney.git/tree/CMakeLists.txt?h=5.0#n73 is hardcoded
> to a single alkimia version and need to be fixed. As workaround in top level
> CMakeLists.txt chane from 
>   find_package(LibAlkimia5 7.0.0 REQUIRED)
> to 
>   find_package(LibAlkimia5 7.0 REQUIRED)

Under my Fedora 28, the location is:
/usr/lib64/cmake/LibAlkimia-7.0/LibAlkimiaConfig.cmake
Note LibAlkimia instead of LibAlkimia5 in both cases
Comment 12 Ian Neal 2019-01-14 08:56:43 UTC
(In reply to Ian Neal from comment #11)
> (In reply to Ralf Habacker from comment #10)
> > (In reply to Rex Dieter from comment #9)
> > > Thanks for the clarification.
> > > 
> > > I'd jumped to that conclusion seeing the output:
> > > 
> > > "  The following configuration files were considered but not accepted:
> > >     /usr/lib64/cmake/LibAlkimia5-7.0/LibAlkimia5Config.cmake, version: 7.0.1
> > The alkimia check in
> > https://cgit.kde.org/kmymoney.git/tree/CMakeLists.txt?h=5.0#n73 is hardcoded
> > to a single alkimia version and need to be fixed. As workaround in top level
> > CMakeLists.txt chane from 
> >   find_package(LibAlkimia5 7.0.0 REQUIRED)
> > to 
> >   find_package(LibAlkimia5 7.0 REQUIRED)
> 
> Under my Fedora 28, the location is:
> /usr/lib64/cmake/LibAlkimia-7.0/LibAlkimiaConfig.cmake
> Note LibAlkimia instead of LibAlkimia5 in both cases

Okay found my problem. I had install the RPM:
libalkimia-devel-7.0.1-2.fc28.x86_64
Hence the location of the cmake file, once I installed
libalkimia-qt5-devel-7.0.1-2.fc28.x86_64
cmake found the correct LibAlkimia5Config.cmake and stopped complaining about Qt4::Core and Qt4::DBus

Still needed Ralf's suggested change though to CMakeLists.txt for it to not complain about libalkimia version 7.0.1
Comment 13 Ralf Habacker 2019-01-14 13:04:39 UTC
Git commit 82af18232bb780e5117318a4dc487c3638085a9e by Ralf Habacker.
Committed on 14/01/2019 at 13:03.
Pushed by habacker into branch '5.0'.

Fix cmake warning on finding alkimia package with different minor version

FIXED-IN:5.0.3
Reviewed By: tbaumgart
Differential Revision: https://phabricator.kde.org/D18241

M  +2    -2    CMakeLists.txt

https://commits.kde.org/kmymoney/82af18232bb780e5117318a4dc487c3638085a9e
Comment 14 Ralf Habacker 2019-01-14 13:04:39 UTC
Git commit 5cf4c62fd0109b6ab8b42d3429e96b361a2e5ee0 by Ralf Habacker.
Committed on 14/01/2019 at 13:04.
Pushed by habacker into branch '5.0'.

Fix finding of alkimia version 7 with custom install path
Reviewed By: tbaumgart
Differential Revision: https://phabricator.kde.org/D18242

M  +8    -0    CMakeLists.txt

https://commits.kde.org/kmymoney/5cf4c62fd0109b6ab8b42d3429e96b361a2e5ee0
Comment 15 Ralf Habacker 2019-01-14 13:42:12 UTC
(In reply to Ralf Habacker from comment #14)
> Git commit 5cf4c62fd0109b6ab8b42d3429e96b361a2e5ee0 by Ralf Habacker.
> Committed on 14/01/2019 at 13:04.
> Pushed by habacker into branch '5.0'.
> 
> Fix finding of alkimia version 7 with custom install path
> Reviewed By: tbaumgart
> Differential Revision: https://phabricator.kde.org/D18242
> 
> M  +8    -0    CMakeLists.txt
> 
> https://commits.kde.org/kmymoney/5cf4c62fd0109b6ab8b42d3429e96b361a2e5ee0

Issue has been reported to cmake at https://gitlab.kitware.com/cmake/cmake/issues/18797
Comment 16 Ralf Habacker 2019-01-14 14:57:39 UTC
(In reply to Ralf Habacker from comment #15)
> > Fix finding of alkimia version 7 with custom install path
> Issue has been reported to cmake at
> https://gitlab.kitware.com/cmake/cmake/issues/18797
With cmake >= 3.12 there is a new cmake variable named <PACKAGENAME>_ROOT, which solves this issue (see https://cmake.org/cmake/help/v3.13/policy/CMP0074.html). The question is if would be possible to set cmake minimum version to 3.12 for kmymoney.