So, after several long weeks and talking to other devs, I finally managed to get a build of the new Krita 3.0 up and running on Mac OSX. Krita 3 is still in development though, so even if you ran it on Linux, there are still some features that aren't completed, and probably some bugs. On OSX, OpenGL doesn't exactly work quite right. If you change a few lines of code so that it doesn't crash on the shader check, you can probably use a tablet with it. For the benefit of other people attempting to build Krita on OSX, I've decided to document how I did it. Please note that I did this on OS 10.9, and have no idea how well it works on later versions of OSX. You are welcome to try building the new Krita 3 as well, but you will need a lot of disk space and at least not be afraid of the command line. Most of these instructions are geared towards people who have some understanding of software development though, so these notes might not be that detailed in some places.
TL;DR If you're not a developer, or don't want to try building, and you have Mac OS 10.9, you're welcome to try the bundle I made here: github.com/Algorithmus/Krita/r…
OpenGL is not enabled safely on that one though, so you'll have to fix the source code and build it if you want a version that at least sort of works with a tablet.Setup directories for building Krita.
In general, you can set up your build structure however you want, but it would be recommended to have something like this:
$HOME/kf5 - main directory where all your KF5 dependencies, qt5.6, etc. and krita builds go
$HOME/kf5/share - location where KF5 dependencies are built
$HOME/kf5/krita - source code for Krita
$HOME/kf5/inst - build location for Krita app
$HOME/kf5/qt5 - Qt5.6 source codeOSX dependenciesBuild Qt5.6
Go to the Qt website and get the Qt5.6 source code: wiki.qt.io/Building_Qt_5_from_…
Follow the instructions there, but git checkout 5.6
. Before you continue with the make
grab the deploy.diff file from the Qt bug tracker and apply it to qttools: bugreports.qt.io/browse/QTBUG-…
Put deploy.diff in the qttools folder in the qt5.6 source directory.
If you did not get qt5.6 from Git, use patch to apply the patch instead: patch -p1 < deploy.diff
Otherwise, use git apply deploy.diff
Continue building Qt5.6. This might take awhile though, so go and do something else in the meantime. Expect it to take 3 hours or more.Build KF5 Dependencies
For the KF5 dependencies, it might help if you have your runtime environment set up like this: community.kde.org/Frameworks/B…
If it works, try kdesrcbuild scripts on the wiki: community.kde.org/Frameworks/B…
If you do it this way, then you will have all the dependencies you need, and can get right to building Krita.
If not, you will have to install dependencies from scratch.
Do not use the Homebrew installation of KF5. They are built with a Homebrew version of qt5, and not Qt5.6, and will not work properly with the rest of the Krita libs.* Follow the instructions on the wiki to build the KF5 dependencies:community.kde.org/Frameworks/B…
Here's a list of the KF5 dependencies you will need: community.kde.org/krita#Depend…
(I ended up building more libraries than I needed to. Mostly because I had errors from cmake. Your mileage may vary.) You do not need strigi! Don't waste time building it. Try to follow the order in the building details link when building the dependencies.
*There's really nothing wrong with the Homebrew KF5 dependencies. I'm sure you can use them to build other KDE 5 apps, like Kate, but I've never really had much success with getting Krita to run properly on Qt5.5. But I'm sure they will eventually build with Qt5.6 when it's not so new. But at this point, you'll have to build them yourself.Other dependencies
You can, however, use Homebrew to install the other non Qt5 or KF5 related dependencies. See the KF5 Dependencies list linked above for all the other dependencies you need. I don't think it matters what method you use to obtain them, so long as they are on your system. You should not need most of the optional dependencies, but Vc is recommended. You can find Vc here: github.com/VcDevel/Vc
If you build Vc, please make sure in the CMakeCache.txt file that gets generated during cmake, change TARGET_ARCHITECTURE to "core" to ensure compatibility with other Macs with different CPUs. Run cmake and build and install again.
I've so far had no success with building Krita with Vc 1.0, so you may want to build on the 0.7 branch.Build Krita
Obtain the Krita source code from the repository. We are using the new repository for 3.0 code, and not calligra 2.9: git clone git://anongit.kde.org/krita
Run cmake in your specified build directory: cmake -DPRODUCTSET=CREATIVE -DWITH_ICONV=OFF -DKDE4_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=OFF -DHAVE_MEMORY_LEAK_TRACKER=ON ../krita
(or wherever your Krita source path is)
If you build with Vc, also add -DPACKAGERS_BUILD=ON
to your cmake command.
You can also do this with QtCreator if you want: www.qt.io/download-open-source…
Just go into the settings, manage kits and add your install of Qt5.6. (If Qt5.6 is in a hidden location, press command + shift + g in the open folder dialogue.) Open the CMakeLists.txt file in the root directory of the Krita source files, and you will be asked to provide some CMake flags, the build directory and then it will run cmake
If you get any errors about cmake not finding certain libraries, open the CMakeCache.txt file in the build directory and change the NOTFOUND paths. Only change them if the cmake output complains about it.
As with Vc, you also need to change TARGET_ARCHITECTURE to core.
After cmake finishes, run make install
In QtCreator, just click on the Projects tab and configure the build step to run make install
instead of make
. Then click the hammer icon to build Krita.
Again, this might take awhile, so go ahead and do something else while Krita builds.Run Krita
You should have a working version of Krita after make install
completes. There should be an install.manifest file if you missed the make install output at the end that tells you where the binary is. It's in the Krita build directory. This binary will only work on your system. If you try to copy it to another Mac without a similar development environment set up, it won't work.
You have to specify the plugin directory in your environment, or else this dev version of Krita won't run. Use export KRITA_PLUGIN_PATH=$PATH
. The path depends on where the generator installed your files. It will usually be something like /usr/local/lib/krita. You should see a lot of .so files in there.
You can either try running the Krita app itself by clicking it or running it through Terminal. Note that the executable is not actually the app itself. On Macs, the app is actually a bundle with a .app extension on the end. The executable is under krita.app/Contents/MacOS/krita
MacDependency is recommended: github.com/kwin/macdependency/…
If your dev version of Krita runs fine, then you can attempt the bundle step. Obtain the general deploy script from git:git://anongit.kde.org/scratch/rempt/kritadeposx.git
Then switch to the kf5 branch.
You should find a deploy.sh script in there. Change the paths to appropriate ones to match your system:
~/kf5/krita.app - the location of the final bundled app + name
~/kf5/krita.dmg - the location of the bundled app in a package (this is optional, and you won't really need it except distribution anyways)
~/kf5/i/bin/krita.app - the location of the dev version of the app
~/kf5/i/share - the location of your krita dependencies. They get built when you build Krita. Check your install.manifest file. It should be the same folder that contains the krita.rc file.
/Users/boudewijnrempt/kf5/i/lib - the location of the krita plugins. They get built when you build Krita. Check your install.manifest file. It should be the same path you supply KRITA_PLUGIN_PATH with when running the dev version of Krita.
/Users/boudewijnrempt/kf5/i/lib/plugins - location of more plugins. They're probably also built with Krita. I found them in /usr/local/lib/plugins. So probably a similar directory as the previous one.
/Users/boudewijnrempt/kf5/i/plugins - Still more plugins. These should be under (krita build directory)/plugins
If you run this script, you will end up with frameworks, plugins and libraries with dependencies linked to @ loader_path and @ rpath, which is not really ideal for distribution, since other systems will tend to look for these dependencies in places differently from your system. We will have to use otool
to fix these using @ executable_path, which targets the app executable instead. Unfortunately, it gets tedious trying to run these commands manually on every single dependency in every library in the bundle, so we will use this script instead:gist.github.com/Algorithmus/c0…
Just change the directory near the top to reflect the location of your final app bundle.
If the script executed correctly, you should see no errors or warnings when you view the bundled Krita app in MacDependency. You should now be able to run this bundled app on any other Mac with similar specs.Troubleshootingcmake can't complete because ECMConfig files are missing.
ECM config files are the extra cmake config files from the KF5 Extra CMake Modules dependency you should have built while building the other KF5 dependencies. You should be able to locate the necessary config file in (ECM install directory)/ECM/cmake.Krita crashes because it looks for Qt5 in different places.
You have too many KF5 components installed, or they're installed with older versions of Qt5 (eg, with Homebrew). If you still need your Homebrew installations of KF5 or Qt5 components, just unlink them if you are bundling. Macdeployqt tends to be very greedy and will take any and every KF5 component (and their Qt5 dependencies) it can get. If this happens with the dev build, clean out all the directories the compiler installed krita libraries and plugins to and run make install
again.macdeployqt doesn't recognize the extra-plugins option
You didn't apply the patch before building Qt5.6. If you forgot it, download it and apply it. Since you probably don't want to rebuild the entire Qt5.6 library just for a few tools, run make module-qttools
instead (and then run make install
afterwards). You shouldn't have to run configure again.
Undefined symbol errors while building
Check to make sure that only the libraries that are required are built. In CMakeCache.txt, you can switch on and off optional libraries. The only "optional" libraries you should need are eigen3, exiv2, OpenGL, and lcms. If there is a library that cmake can't find, and it's required to build Krita, check the output of cmake.u16String undefined errors in Qt
In CmakeLists.txt in the root directory of the Krita source, there is a line like this: if (APPLE)
SET(CMAKE_CXX_FLAGS "-stdlib=libstdc++ -std=c++11")
# find_package(Carbon REQUIRED)
.Krita crashes at runtime with some error like
Krita has encountered an internal error:
ASSERT(krita): "allFiles.size() > 0" in file /.../krita/krita/ui/KisMainWindow.cpp, line 417
Please report a bug to the developers!
You get this error because Krita cannot find a very specific file. Generally, if you are running the development version, this file should be in some place like /usr/local/share/krita. But sometimes, depending on your setup, it might look for that file elsewhere. Look for the folder that contains the krita.rc file. This is where you want your app to look for the file. If it doesn't find krita.rc in the share folder, you may try putting it in $HOME/Library/Application Support/. If you have no clue where Krita is looking for this directory, you might want to try running Krita with export QT_LOGGING_RULES="krita*=true"
and see what directory it outputs. If this happens in a bundle, it's probably because you're running a newer OSX than 10.9. Unfortunately, I've never tested Krita bundles on systems above 10.9, so you're on your own there. But feel free to try the debugging suggestions anyways.
Krita hangs or crashes on startup.
This could be from anything really. The best thing to do is run it from Terminal and see what sort of output it gives you. Sometimes, even just running it from Terminal fixes the problem. I find most of the errors tend to come from missing libraries or the app not being able to find certain libraries, or libraries even missing or not finding dependencies. Use MacDependency to check on these. Please note that if you use MacDependency to check on the dependencies of .so plugins, they will always appear red. However, it works better if these dependencies have Executable
_paths rather than Loader
_path. For example, you might also have tried to run the bundle without fixing the dependencies in Krita plugin .so files. Run the last deploy script to fix it. Also use export QT_DEBUG_PLUGINS=1
while running Krita.