Krita/Emergebuild: Difference between revisions
Miabrahams (talk | contribs) m (→Build Krita) |
|||
(30 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
== What is | == What is Craft? == | ||
* There are no binary releases of KDE Frameworks libraries for Windows. KDE Frameworks is required for Krita. Therefore the only option is to build these libraries from source. | |||
* KDE Frameworks depend on Qt and the Linux Standard Base, and Krita has other dependencies as well. Like KDE Frameworks, many of these dependencies have to be compiled too, so might as well do the entire set of libraries from source. That is what Craft does. | |||
* To be flexible enough for this massive build task, Craft is written in Python. Python is very easy to pick up. | |||
* You will need approximately 20GB of free space for the whole thing. Doing a separate debug/release build will require another 15GB, and the entire process must be repeated. Fortunately, hard drives are cheap these days. | |||
* If you do not have qualms with Windows Powershell, I recommend it over cmd.exe, since it has saner interactive features. If you wish, you can get pretty good Bash-like keyboard shortcuts using [https://github.com/lzybkr/PSReadLine PSReadline]. | |||
== Preparing Craft == | |||
* See here. https://community.kde.org/Craft | |||
* | * Install Python 3.6 | ||
* Set up your .gitconfig so you can use <tt>kde:</tt> paths. | |||
* | * Install Microsoft Visual C++ 2015. You can save some space by [http://blogs.msdn.com/b/vcblog/archive/2015/11/02/announcing-visual-c-build-tools-2015-standalone-c-tools-for-build-environments.aspx installing only the compiler without the IDE]. However, it is also possible to use the Visual Studio IDE to work with Krita's source if you wish. You will need to restart your computer after installing MSVC. | ||
* | * Download Craft by running the script. | ||
* Choose compiler = msvc2015 and architecture = x64. | |||
* The instructions for each particular package are contained in the .\craft\portage subfolder. You may expect to spend time fiddling with things here. | |||
* Use craft -v to give verbose output. This can be helpful for diagnosing problems. | |||
* The instructions for each particular package are contained in the .\ | |||
* Use | |||
* Choose carefully whether you want to do a debug build or release build. You have to do the whole thing from scratch if you want to have both. Windows does not allow linking debug and release libraries together. | * Choose carefully whether you want to do a debug build or release build. You have to do the whole thing from scratch if you want to have both. Windows does not allow linking debug and release libraries together. | ||
* If you do want to do both a debug and release build, e.g. C:\kde_debug\ and C:\kde_release\, you can use symlinks for the C:\kde_XXX\ | * If you do want to do both a debug and release build, e.g. C:\kde_debug\ and C:\kde_release\, you can use symlinks for the C:\kde_XXX\craft and C:\kde_XXX\download\ folders. That way, your build tweaks in the craft folder, and the massive amount of downloaded files and cloned git repositories, can be shared between the debug and release paths. | ||
* A few other settings in kdesettings.ini are not necessary but will make the process nicer. This will build with 12 jobs (you can adjust that number to whatever is appropriate for your system), pop up a notification whenever a build process completes, | * A few other settings in kdesettings.ini are not necessary but will make the process nicer. This will build with 12 jobs (you can adjust that number to whatever is appropriate for your system), pop up a notification whenever a build process completes, alias the base directory to r:\, and skip building tests. (You can turn on testing for Krita itself later, but there is no need for you to build e.g. libjpeg tests.) | ||
CRAFT_OPTIONS = make.makeOptions=-j12 | |||
CRAFT_USE_NOTIFY = Toaster | |||
CRAFT_USE_SHORT_PATH = True | |||
CRAFT_BUILDTESTS=False | |||
== Building Krita's Dependencies == | == Building Krita's Dependencies == | ||
=== Preparing for failure === | |||
Because we're building linux packages on MSVC and cloning from git master, we're begging for a list of build failures. What fails might change from day to day. Be prepared to make tweaks inside the source folders to get everything compiled. Feel free to stub things out if they seem pointless. Git repos are contained in Q:\, unzipped sources will be placed in r:\build\ working directories. Often, to fix an error, you will want to run | |||
craft --compile <target> | |||
to try the compile command again without re-extracting the source. After it completes succesfully, run <tt> | |||
craft --qmerge <target></tt> to install your patched version. See <tt>craft --help</tt> for more information. | |||
=== Qt === | === Qt === | ||
* Step 1: <tt> | * Step 1: <tt>craft qt</tt> | ||
* Step 2: go get a cup of a coffee. | * Step 2: go get a cup of a coffee. | ||
=== Krita dependencies === | === Krita dependencies === | ||
Many dependencies will be straightforward and unproblematic: | Many dependencies will be straightforward and unproblematic: | ||
craft pkg-config | |||
craft coreutils | |||
craft eigen3 | |||
craft lcms2 | |||
craft exiv2 | |||
craft tiff | |||
craft libpng | |||
craft lcms2 | |||
craft libcurl | |||
craft libwpd | |||
A few were can be difficult, although Craft contains patches for most of them. You may need to manually disable tests for some libraries. | |||
craft vc | |||
craft ocio | |||
craft breakpad | |||
craft gsl | |||
Boost worked | |||
craft --fetch boost-headers | |||
craft --unpack boost-headers | |||
craft --install boost-headers | |||
craft --qmerge boost-headers | |||
craft boost | |||
Finally there were some dependencies that | Finally there were some optional dependencies that can be put aside for the time being if they are not cooperating. FFTW is straightforward to install by following the instructions from their website instead of using Craft. | ||
craft FFTW | |||
craft openexr | |||
craft png2ico | |||
craft librdf-src | |||
craft shared-mime-info | |||
=== Frameworks === | === Frameworks === | ||
The goal here is to build as few as possible, because they can be rickety. The necessary frameworks are listed | The goal here is to build as few as possible, because they can be rickety. The situation seems pretty good as of KDE Frameworks 15.16, I encountered no build failures the last time I tried. The necessary frameworks are listed [[Krita | on this wiki]]. | ||
craft kdewin-lib | |||
craft karchive | |||
craft kconfig | |||
craft kcoreaddons | |||
craft kguiaddons | |||
craft ki18n | |||
craft kitemmodels | |||
craft kitemviews | |||
craft kwidgetsaddons | |||
craft kcompletion | |||
craft oxygen | |||
craft breeze | |||
== Build Krita == | == Build Krita == | ||
To configure Git and clone, follow these instructions, replacing "calligra" with "krita" in the name of the repo. https://community.kde.org/Calligra/Building_Calligra_on_Windows#Getting_the_source_code | To configure Git and clone, follow these instructions, replacing "calligra" with "krita" in the name of the repo. https://community.kde.org/Calligra/Building_Calligra_on_Windows#Getting_the_source_code | ||
Here is a cmake configure command which worked for me. I was very | Here is a cmake configure command which worked for me. I was very finicky here and not all the flags may be necessary. If you can build without them, please note that here. Do not try to build the tests, such an endeavor would be dangerous for your mental health. | ||
mkdir r:\build\krita | |||
cd r:\build\krita | |||
cmake | cmake r:\src\krita\ -DBUILD_TESTING=OFF -G"Ninja" -DCMAKE_INSTALL_PREFIX=r:\ -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_FLAGS="/Gm /MD /Zi" -DCMAKE_EXE_LINKER_FLAGS="/machine:x64 /LTCG" -DCMAKE_SHARED_LINKER_FLAGS="/machine:x64" -DCMAKE_STATIC_LINKER_FLAGS="/machine:x64" -DCMAKE_RC_COMPILER="C:/Program Files (x86)/Windows Kits/8.1/bin/x64/rc.exe" | ||
The command <tt>-G"Ninja"</tt> specifies that you will be using the <tt>ninja</tt> command line build tool inside the build directory. Other options are <tt>"NMake Makefiles JOM"</tt>, to use the jom build tool, and <tt>-G"Visual Studio 14 2015"</tt> to generate .vcxproj project files, which can be opened in Visual Studio. You can make more than one build directory if you wish. | |||
=== Boost problems === | === Boost problems === | ||
The CMake find_library call in Krita was also unable to locate Boost automatically. I believe there is a way inside | The CMake find_library call in Krita was also unable to locate Boost automatically. I believe there is a way inside Craft to do this, but I have not pursued that. Instead the following hack in the base CMakeLists.txt fixed things. | ||
-add_definitions(-DBOOST_ALL_NO_LIB) | -add_definitions(-DBOOST_ALL_NO_LIB) | ||
Line 90: | Line 104: | ||
+set(BOOST_ROOT "r:") | +set(BOOST_ROOT "r:") | ||
+set(Boost_DEBUG "ON") | +set(Boost_DEBUG "ON") | ||
FindBoost.cmake will look for dlls called things like boost_system-vc140-mt-1_55.dll but the boost dll's that I built were called boost_system-vc-mt-1_55, and that makes FindBoost FAIL!!! If an error like that occurs, it can be fixed by renaming the dlls. | |||
== gokde.ps1 == | == gokde.ps1 == | ||
This was a little wrapper script I called <tt>gokde.ps1</tt> | This was a little wrapper script I called <tt>gokde.ps1</tt> to set up a few aliases for a Krita build environment. Feel free to use it as a guide with appropriate configurations. In particular, some of the environment variables may not be necessary on Windows. The cmdlet <tt>add-pathvariable</tt> is from the [https://pscx.codeplex.com/ PowerShell Community Extensions]. | ||
C:\kde\craft\kdeenv.ps1 | |||
cd r: | cd r: | ||
Set-Alias krita r:\bin\krita.exe | Set-Alias krita r:\bin\krita.exe |
Latest revision as of 05:31, 8 July 2017
What is Craft?
- There are no binary releases of KDE Frameworks libraries for Windows. KDE Frameworks is required for Krita. Therefore the only option is to build these libraries from source.
- KDE Frameworks depend on Qt and the Linux Standard Base, and Krita has other dependencies as well. Like KDE Frameworks, many of these dependencies have to be compiled too, so might as well do the entire set of libraries from source. That is what Craft does.
- To be flexible enough for this massive build task, Craft is written in Python. Python is very easy to pick up.
- You will need approximately 20GB of free space for the whole thing. Doing a separate debug/release build will require another 15GB, and the entire process must be repeated. Fortunately, hard drives are cheap these days.
- If you do not have qualms with Windows Powershell, I recommend it over cmd.exe, since it has saner interactive features. If you wish, you can get pretty good Bash-like keyboard shortcuts using PSReadline.
Preparing Craft
- See here. https://community.kde.org/Craft
- Install Python 3.6
- Set up your .gitconfig so you can use kde: paths.
- Install Microsoft Visual C++ 2015. You can save some space by installing only the compiler without the IDE. However, it is also possible to use the Visual Studio IDE to work with Krita's source if you wish. You will need to restart your computer after installing MSVC.
- Download Craft by running the script.
- Choose compiler = msvc2015 and architecture = x64.
- The instructions for each particular package are contained in the .\craft\portage subfolder. You may expect to spend time fiddling with things here.
- Use craft -v to give verbose output. This can be helpful for diagnosing problems.
- Choose carefully whether you want to do a debug build or release build. You have to do the whole thing from scratch if you want to have both. Windows does not allow linking debug and release libraries together.
- If you do want to do both a debug and release build, e.g. C:\kde_debug\ and C:\kde_release\, you can use symlinks for the C:\kde_XXX\craft and C:\kde_XXX\download\ folders. That way, your build tweaks in the craft folder, and the massive amount of downloaded files and cloned git repositories, can be shared between the debug and release paths.
- A few other settings in kdesettings.ini are not necessary but will make the process nicer. This will build with 12 jobs (you can adjust that number to whatever is appropriate for your system), pop up a notification whenever a build process completes, alias the base directory to r:\, and skip building tests. (You can turn on testing for Krita itself later, but there is no need for you to build e.g. libjpeg tests.)
CRAFT_OPTIONS = make.makeOptions=-j12 CRAFT_USE_NOTIFY = Toaster CRAFT_USE_SHORT_PATH = True CRAFT_BUILDTESTS=False
Building Krita's Dependencies
Preparing for failure
Because we're building linux packages on MSVC and cloning from git master, we're begging for a list of build failures. What fails might change from day to day. Be prepared to make tweaks inside the source folders to get everything compiled. Feel free to stub things out if they seem pointless. Git repos are contained in Q:\, unzipped sources will be placed in r:\build\ working directories. Often, to fix an error, you will want to run
craft --compile <target>
to try the compile command again without re-extracting the source. After it completes succesfully, run
craft --qmerge <target> to install your patched version. See craft --help for more information.
Qt
- Step 1: craft qt
- Step 2: go get a cup of a coffee.
Krita dependencies
Many dependencies will be straightforward and unproblematic:
craft pkg-config craft coreutils craft eigen3 craft lcms2 craft exiv2 craft tiff craft libpng craft lcms2 craft libcurl craft libwpd
A few were can be difficult, although Craft contains patches for most of them. You may need to manually disable tests for some libraries.
craft vc craft ocio craft breakpad craft gsl
Boost worked
craft --fetch boost-headers craft --unpack boost-headers craft --install boost-headers craft --qmerge boost-headers craft boost
Finally there were some optional dependencies that can be put aside for the time being if they are not cooperating. FFTW is straightforward to install by following the instructions from their website instead of using Craft.
craft FFTW craft openexr craft png2ico craft librdf-src craft shared-mime-info
Frameworks
The goal here is to build as few as possible, because they can be rickety. The situation seems pretty good as of KDE Frameworks 15.16, I encountered no build failures the last time I tried. The necessary frameworks are listed on this wiki.
craft kdewin-lib craft karchive craft kconfig craft kcoreaddons craft kguiaddons craft ki18n craft kitemmodels craft kitemviews craft kwidgetsaddons craft kcompletion craft oxygen craft breeze
Build Krita
To configure Git and clone, follow these instructions, replacing "calligra" with "krita" in the name of the repo. https://community.kde.org/Calligra/Building_Calligra_on_Windows#Getting_the_source_code
Here is a cmake configure command which worked for me. I was very finicky here and not all the flags may be necessary. If you can build without them, please note that here. Do not try to build the tests, such an endeavor would be dangerous for your mental health.
mkdir r:\build\krita cd r:\build\krita
cmake r:\src\krita\ -DBUILD_TESTING=OFF -G"Ninja" -DCMAKE_INSTALL_PREFIX=r:\ -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_FLAGS="/Gm /MD /Zi" -DCMAKE_EXE_LINKER_FLAGS="/machine:x64 /LTCG" -DCMAKE_SHARED_LINKER_FLAGS="/machine:x64" -DCMAKE_STATIC_LINKER_FLAGS="/machine:x64" -DCMAKE_RC_COMPILER="C:/Program Files (x86)/Windows Kits/8.1/bin/x64/rc.exe"
The command -G"Ninja" specifies that you will be using the ninja command line build tool inside the build directory. Other options are "NMake Makefiles JOM", to use the jom build tool, and -G"Visual Studio 14 2015" to generate .vcxproj project files, which can be opened in Visual Studio. You can make more than one build directory if you wish.
Boost problems
The CMake find_library call in Krita was also unable to locate Boost automatically. I believe there is a way inside Craft to do this, but I have not pursued that. Instead the following hack in the base CMakeLists.txt fixed things.
-add_definitions(-DBOOST_ALL_NO_LIB) +set(BOOST_INCLUDEDIR "r:/include") +set(BOOST_LIBRARYDIR "r:/lib") +set(BOOST_ROOT "r:") +set(Boost_DEBUG "ON")
FindBoost.cmake will look for dlls called things like boost_system-vc140-mt-1_55.dll but the boost dll's that I built were called boost_system-vc-mt-1_55, and that makes FindBoost FAIL!!! If an error like that occurs, it can be fixed by renaming the dlls.
gokde.ps1
This was a little wrapper script I called gokde.ps1 to set up a few aliases for a Krita build environment. Feel free to use it as a guide with appropriate configurations. In particular, some of the environment variables may not be necessary on Windows. The cmdlet add-pathvariable is from the PowerShell Community Extensions.
C:\kde\craft\kdeenv.ps1 cd r: Set-Alias krita r:\bin\krita.exe function global:install-krita { Stop-Process -processname Krita -ErrorAction SilentlyContinue ninja -C r:\build\calligra install } function global:build-krita { Stop-Process -processname Krita -ErrorAction SilentlyContinue ninja -C r:\build\calligra } function global:run-krita { install-krita if ($LASTEXITCODE -eq 0) { krita } } Add-PathVariable r:\bin Add-PathVariable r:\lib\krita $env:XDG_DATA_HOME = "r:\share" $env:XDG_DATA_DIRS = $env:XDG_DATA_HOME $env:XDG_CONFIG_HOME = "r:\config" $env:XDG_CONFIG_DIRS = $env:XDG_CONFIG_HOME $env:KDE_DEBUG_NOAREANAME=1 $env:KDEDIRS = "r:" $env:KDEHOME = "r:\share\.kde" $env:OPENSSL_ROOT_DIR="r:" $env:EDITOR = "notepad"