[KDE/Mac] Getting applications to run

Marko Käning mk-lists at email.de
Thu Dec 18 08:48:20 UTC 2014

Hi Jeremy,

On 18 Dec 2014, at 05:11 , Jeremy Whiting <jpwhiting at kde.org> wrote:
> I appologize in advance for this rambling. tldr, I got kanagram to run with vanilla open source qt here,
> but had to tweak/move some things to do it.

hooohh… please, please, ramble on!!! You are very welcome! :-D

> Starting a new thread because I have some progress and I see the QSP issue as orthogonal to running
> applications in an osx way (a way that they could possibly some time get into the mac app store and/or
> an installer with "drag the application to your Applications folder" style with their needed libraries and
> files bundled).

Well, the QSP patch is there to run a KDE-Linux/CI-compatible OSX/CI system, for nothing else!!!

As Thiago wrote: if we want to introduce a new feature, like XDG paths on OSX, then it is another issue.
That could be accepted as new contribution for Qt5, but our KDE-internal OSX/CI-patch won’t get accepted
which is very understandable.

> In testing kf5 and qt5 on mac osx here I found a couple of ways to make things work with vanilla Qt
> open source version from qt-project.org itself. Since kanagram is something I know very well I started
> looking at it first.

That’s just great news!

> After getting all the frameworks to build with kdesrc-build on osx (by setting the right paths and compiler
> arguments)

Well, since you managed it so well, perhaps you can update the corresponding wiki page [1] which is quite
outdated (from 2012) and seems quite overloaded to me?! I think this might be very helpful for followers!
This page is shows on [2] in the section “Installing using MacPorts” and should surely mention that the 
"development environment" is “kdesrc-build development environment”, I believe.

> I built libkeduvocdocument, kdeedu-data and kanagram with kdesrc-build. It of course puts things in not
> the places that QSP looks for them, but a copy or two later and kanagram is running.

Well, I thought, it should be doing that! :-(

> First issue, kanagram looks for it's qml files in QStandardPaths::locate(QStandardPaths::DataLocation, "ui/main.qml”);
> now according to Qt Assistant, DataLocation should include
> ~/Libraries/Application Support/<APPNAME> /Library/Application Support/<APPNAME>
> and
> <APPDIR>/../Resources yet for some reason QStandardPaths::standardLocations(QStandardPaths::DataLocation);
> is giving the first two and then /Applications/KDE/kanagram.app not the Resources subdir. At any rate I
> copied the ui folder which holds kanagram's qml files and images into /Applications/KDE/kanagram.app/
> and it runs.

The OSX/CI system doesn’t need these tweaks, but that’s due to the fact that all the installations are in their
own install roots and the XDG_*_DIRS point to it properly.

Good to know that you spotted this, as this requires an adaption of the CMake build system for OSX.

> Second issue, it runs but doesn't find the kvtml files it is trying to find with
> QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "apps/kvtml", QStandardPaths::LocateDirectory);
> which on linux are in /usr/share/apps/kvtml . If I move them from /usr/local/share/apps/kvtml to
> ~/Library/Application Support/apps/kvtml though kanagram starts and finds it's data files just fine.

Same thing as above.

> <-- This is a case for the QSP patch imo so we can put the data files into /opt/local/share/apps/kvtml or
> something for both kanagram and khangman to find and read them. They come from kdeedu-data.

kdeedu-data is a separate project, which these two apps should depend on, if they want to share data.
If that is the case and the dependency is properly defined in the kde-build-metadata repo then the
OSX/CI system will allow such sharing, just like on Linux.

Funny thing is, that here on the CI system I don’t see any dependency on it:
grep kdeedu-data dependency*
which is a bit weird.

Well, I just build it on my OSX/CI system:
$ ./install.sh kdeedu-data
Project  : kde/kdeedu/kdeedu-data
Branch   : master
Linux-CI : -
Creating still missing build directory...
Build... : SUCCESS

So, the next step would be to include this in 
$ git diff
diff --git a/dependency-data-kf5-qt5 b/dependency-data-kf5-qt5
index 9a5ecb0..19faeea 100644
--- a/dependency-data-kf5-qt5
+++ b/dependency-data-kf5-qt5
@@ -723,8 +723,10 @@ kde/kdegraphics/gwenview: frameworks/kdelibs4support
 # KDE Edu
 kde/kdeedu/kalgebra: kde/kdeedu/analitza
 kde/kdeedu/kanagram: kde/kdeedu/libkeduvocdocument
+kde/kdeedu/kanagram: kde/kdeedu/kdeedu-data
 kde/kdeedu/parley: kde/kdeedu/libkeduvocdocument
 kde/kdeedu/khangman: kde/kdeedu/libkeduvocdocument
+kde/kdeedu/khangman: kde/kdeedu/kdeedu-data
 kde/kdeedu/kwordquiz: kde/kdeedu/libkeduvocdocument

Shall I commit this change?

BTW, khangman showed its main window fine, let me guess the 1st word, drew happily the gallows and I
struggled to not get hanged which I failed because of “hedgehog”

This means: KHangman is the first word game that WORKS on OSX/CI somehow better then others,
although it still claims to not have found one file and the icon theme:
Menu "applications-kmenuedit.menu" not found.
Icon theme "hicolor" not found.
kf5.kiconthemes: "Theme tree: (Oxygen)"
I don’t know whether the last line means that it has successfully located the oxygen them or not.

I was able to switch the background themes, no problem.

But when I leave the app then it crashes with a segfault. (Let me know if you’re interested in the crash log.)

After restarting the app again I even see all menu items in the main menu instead of only “khangman”.
Downside is that the app consistently crashes at exit.

In the “Preferences” dialog I see that all the icons are indeed missing.

> I can’t think of how these data files could be shared between two different applications the "Mac” way
> either, are there other applications in OSX that put files into /Library/Application Support at all ? I mean
> real mac app store types of applications, I'll check tomorrow I guess. I can't picture how an installer for
> kanagram would work, it would have to let the user drag kanagram to Applications, but also drag data
> files to /Library/Application Support ? I've never seen anything like that in the few mac software installers
> I've used, though maybe it would work with Qt Installation Framework.

Well, yes, all this is a complicated matter, especially since you’d have to share a lot of files, not only those
kdeedu-related files, but ALL KDE libraries and stuff would have to be shipped as well, if you don’t use a
system like MacPorts, but want to go to the AppStore and intend to build self-standing application packages
which should be drag-droppable wherever the user wants them to put...

> After the above modifications/tweaks/workarounds, kanagram runs and is playable, though I have to
> disable sound effects since phononqt5 crashes for some reason.

Wow, yep, I don’t have sound here on OSX/CI either… :-(

> If I use QtMultimedia in qml to play the sounds instead of a phonon MediaObject in C++ they work ok
> though, and I was leaning towards doing that lately anyway. I did notice that the left and right arrow icons
> are just white squares,

White squares? Hmmm…

> and moving the mouse cursor gives it a white square background when I move it over kanagram's ui that
> I don't see when using other applications so it's not because of the VirtualBox I'm running it in.

… I don’t see this. As written in PM I have very bright buttons with a faint shadow of the arrows. If I click
the button the background becomes darker and I see the bright arrow better.

So, it could be that this is due to your VirtualBox rendering.

I could send you a screenshot of my OSX/CI’s kanagram, if you want.

> Also the window titlebar says only the category name, not Kanagram and the category name like it does
> on windows and linux, not sure why that is.

The window title bar is empty here, but probably because my kanagram can’t find its files anyway atm.

> Any thoughts or suggestions about anything I've spewed out here is welcome. I'm very open to ideas for
> how to make this work properly.

I hope this and my PM post help to let us get further with all this.

I think you made amazing progress and I am confident now that we’ll now be able to straighten out all the
CMake configuration options of many projects currently leading to trouble finding data and config files on
the OSX platform. :-)


[1] https://techbase.kde.org/Getting_Started/Build/Mac_OS_X/MacPorts
[2] https://community.kde.org/Mac

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-mac/attachments/20141218/97183a06/attachment-0001.html>

More information about the kde-mac mailing list