This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Building Krita3.0 on Windows without emerge

Tags: None
(comma "," separated)
User avatar
guruguru
Registered Member
Posts
37
Karma
1
OS
I took some time to try compiling Krita3.0 on Windows this week. Here is the record my experience so that others would have smoother experiences.
I did it without emerge. (for reference, there is an existing topic on compiling Krita on Windows with Emerge viewtopic.php?f=281&t=125861)

Anyway, tl,dr version first:
- See https://github.com/KDE/krita/tree/master/3rdparty - this guide is basically working fine, follow it to compile Krita on Windows.
- Patch error -> Convert .diff, .patch files' line breaks from LF to CRLF
- ext_boost seems to be a bit tricky
- International users(like me, my windows is Japanese locale) beware: Windows VC++ does not interpret a UTF-8 file as UTF-8 unless there is BOM - this can cause compile error(encoding error can corrupt double quotes at times). Resave the offending files with BOM to avoid this issue. (Or use English locale all the time? Or should I batch add BOM to all files?)

0. Get tools
Got git, cmake 3.3.2, MSVC 2015 Community Edition, Python 2.7 as in the guide.
Made sure PATH to include git, cmake, Python2.7

1. Make directories
I created c:\dev and c:\dev\b, c:\dev\d, c:\dev\d
I defined a new env var BUILDROOT as c:\dev

2. Qt
I already had a Qt5.5.1 on my PC. I called its installer to install Qt source code and compiled Qt from command line. (I ran "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat" first in command line)

The configure command - I think I had to remove one of the module argument(which is not found on my PC somehow. I think it was webkit related)
Code: Select all
configure -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdoc -skip qtenginio -skip qtgraphicaleffects -skip qtlocation -skip qtmultimedia -skip qtsensors -skip qtserialport -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtxmlpatterns -no-sql-sqlite -nomake examples -nomake tools -no-compile-examples -no-dbus -no-iconv -no-angle -no-ssl -no-openssl -no-wmf-backend -no-qml-debug -no-libproxy -no-system-proxies -no-nis -no-icu -no-mtdev -opensource -confirm-license -release -opengl desktop -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -prefix %BUILDROOT%\i

After configure ran successfully, I think I did make and make install.

3. Externals build setup
I moved to c:\dev\b, then set PATH as:
Code: Select all
set PATH=%BUILDROOT%\i\bin\;%BUILDROOT%\i\lib;%PATH%


Then I ran
Code: Select all
cmake ..\krita\3rdparty -DEXTERNALS_DOWNLOAD_DIR=/dev/d -DINSTALL_ROOT=/dev/i   -G "Visual Studio 14 Win64"


4. Building external packages
It was basically doing this line for each packages. Complete list is in the guide.(https://github.com/KDE/krita/tree/master/3rdparty)
Code: Select all
cmake --build . --config RelWithDebInfo --target <package name>


The first issue I hit was, patch error. patch does not seem to like LF linebreaks in .diff .patch files. I had to convert linebreaks for these files to CRLF in text editor(I use Notepad++) manually. I believe there are probably more automated way to doing so...

The next issue was, ext_boost. It did not seem to compile well unless I emptied C:\dev\krita\3rdparty\ext_boost\CMakeLists.txt update command(UPDATE_COMMAND "") that copies the compiled libraries. Still not sure if that was a right thing to do. ext_ocio repeated ext_boost compile error as well.

The thied issue was, I believe it's specific to non-English locale users. I use Japanese locale, and there, VC interprets files without BOM as ShiftJIS(a Japanese encoding), not UTF-8. This can cause loss of UTF-8 characters, and in worse, it can corrupt double quotes & cause compile errors. ext_framework especially caused this issue. I tried overwriting the offending file as UTF-8 BOM can fix it, but in ext_framework cmake overwrite the fixed file with original file, unpacking the package file. I workarounded this by temporally changing to locale to English when I cmake ext_framework. (Then I went back to original Japanese locale)

5. Build Krita
With all ext libraries were ready, I created c:\dev\build, moved to the folder, and tried to build Krita.
The command was the same as in the guide:
Code: Select all
cmake ..\krita -G "Visual Studio 14 Win64" -DBoost_DEBUG=OFF -DBOOST_INCLUDEDIR=c:\dev\i\include -DBOOST_DEBUG=ON -DBOOST_ROOT=c:\dev\i -DBOOST_LIBRARYDIR=c:\dev\i\lib -DCMAKE_INSTALL_PREFIX=c:\dev\i -DCMAKE_PREFIX_PATH=c:\dev\i -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=OFF -DKDE4_BUILD_TESTS=OFF -DHAVE_MEMORY_LEAK_TRACKER=OFF -DPACKAGERS_BUILD=ON -Wno-dev -DDEFINE_NO_DEPRECATED=1


First, I had an error that I was missing boost. This was caused by not naming the boost .dll and .lib in C:\dev\i\lib correctly.(Probably caused by CMakeList.txt modification earlier) I think the expected names are: boost_system-vc140-mt-1_55.dll and boost_system-vc140-mt-1_55.lib

With this, configuration worked fine. Then I did:
Code: Select all
cmake --build . --config RelWithDebInfo --target INSTALL

I hit several compile issues by BOM, each time I resaved the offending files with BOM. I had to repeat the above command several times to get Krita fully compiled. First time, it took about an hour to see the error result. In second and third times, the time got much faster.
(I had the BOM issue with ListItemsHelper.cpp, kiswdgindexcolors.cpp, ListLevelChooser.cpp)

6. Run Krita
From command line I moved to c:\dev\i\bin\ and run krita.exe from there. Krita ran. yay.

I think English locale people would not hit BOM issues - so I assume the journey would be simpler in that case. Anyway I hope this log would be helpful.
User avatar
guruguru
Registered Member
Posts
37
Karma
1
OS
Some extra notes.
- Qt...probably it's better to have Qt5.6
- Patch error workaround: use "git config --global core.autocrlf true" to have git autoconvert the linebreaks
- ext_boost makefile issue should be fixed by now

And I repeat it's always good to check README.md:
https://github.com/KDE/krita/tree/master/3rdparty
iwubdrawing
Registered Member
Posts
19
Karma
0
OS
So, I have no idea if I'll ever get to tinkering around with the code but I wanted to say thanks for this! Just curious - why is Python needed?

Also I haven't seen the --config before, is that another way to specify the build type? Does Krita not use CMAKE_BUILD_TYPE?
User avatar
Mike A.
KDE Developer
Posts
41
Karma
0
OS
Thanks for this log. One thing that might help speed up the last step is to compile Krita with parallel make. Instead of -G"Visual Studio" you can use -G"Ninja" to use ninja or -G"NMake Makefiles JOM" to use jom.


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], lockheed, Sogou [Bot], Yahoo [Bot]