kritaをソースコードからビルドする



今回はkritaをビルドしてみます。

ビルドの手順はkritaのContributors Manualを参考に進めます。


ビルドするには、今の自分の環境で直にするか、Dockerというものを使って仮想環境を作ってそこでやるか選べます。

Dockerを実際に使ったことはありませんが、設定ファイルを見た感じだと「Ubuntu+kritaのソースコード+依存ライブラリ」を提供してくれるようなので、さくっとビルドできる環境を用意できるみたいです。

私は自分の環境で直にビルドします。


私の作業環境について

OSFedora29
ソース master commit27678b4

依存関係を解決する

マニュアルに沿ってディレクトリを作成し、ソースコードを落としてきたら、とりあえずcmakeをします。

足りないライブラリのパッケージ名がエラーメッセージとして出てくるので、こつこつインストールします。

実際に配布されているパッケージ名は、エラーメッセージのものとだいたい微妙に違うので、下のようにワイルドカードを使って名前の近いものを調べました。

[root@localhost ~]#dnf search kf5*itemviews*

このとき、パッケージ名にdevelやdevなどが付いているものをインストールします。
コードをコンパイルするために必要なファイルが含まれているためです。

以降は自分の環境で必要になったパッケージです。

[root@localhost ~]# dnf install python3-devel
[root@localhost ~]# dnf install kf5-kwidgetsaddons-devel
[root@localhost ~]# dnf install kf5-kcompletion-devel
[root@localhost ~]# dnf install kf5-kcoreaddons-devel
[root@localhost ~]# dnf install kf5-kguiaddons-devel
[root@localhost ~]# dnf install kf5-ki18n-devel
[root@localhost ~]# dnf install kf5-kitemmodels-devel
[root@localhost ~]# dnf install kf5-kitemviews-devel
[root@localhost ~]# dnf install kf5-kwindowsystem-devel
[root@localhost ~]# dnf install qt5-qtmultimedia-devel
[root@localhost ~]# dnf install qt5-qtx11extras-devel
[root@localhost ~]# dnf install kf5-kcrash-devel
[root@localhost ~]# dnf install libpng-devel
[root@localhost ~]# dnf install libtiff-devel
[root@localhost ~]# dnf install giflib-devel
[root@localhost ~]# dnf install OpenColorIO-devel
[root@localhost ~]# dnf install LibRaw-devel
[root@localhost ~]# dnf install python3-qt5-devel
[root@localhost ~]# dnf install eigen3-devel
[root@localhost ~]# dnf install exiv2-devel

エラーメッセージとそれに対応するパッケージ

上記の要領ではうまく見つけられなかったパッケージをエラーメッセージと一緒に載せました。
-- Krita version: 4.2.0-pre-alpha
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.7.2", minimum required is "3.0")
-- Python system site-packages directory: /usr/lib64/python3.7/site-packages
-- Could NOT find PythonLibrary (missing: PYTHON_LIBRARY) (Required is at least version "3.0")
CMake Error at CMakeLists.txt:254 (find_package):
By not providing "FindECM.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "ECM", but
CMake did not find one.

Could not find a package configuration file provided by "ECM" (requested
version 5.22) with any of the following names:

ECMConfig.cmake
ecm-config.cmake

Add the installation prefix of "ECM" to CMAKE_PREFIX_PATH or set "ECM_DIR"
to a directory containing one of the above files. If "ECM" provides a
separate development package or SDK, be sure it has been installed.


-- Configuring incomplete, errors occurred!
See also "/home/fukari/krita/src/CMakeFiles/CMakeOutput.log".

インストールする
[root@localhost ~]# dnf install extra-cmake-modules


-- Krita version: 4.2.0-pre-alpha
-- Python system site-packages directory: /usr/lib64/python3.7/site-packages
-- Found PythonLibrary: /usr/lib64/libpython3.7m.so (Required is at least version "3.0")
-- Could NOT find KF5Config (missing: KF5Config_DIR)
-- Could NOT find KF5Config: found neither KF5ConfigConfig.cmake nor kf5config-config.cmake
-- Could NOT find KF5WidgetsAddons (missing: KF5WidgetsAddons_DIR)
-- Could NOT find KF5WidgetsAddons: found neither KF5WidgetsAddonsConfig.cmake nor kf5widgetsaddons-config.cmake
-- Could NOT find KF5Completion (missing: KF5Completion_DIR)
-- Could NOT find KF5Completion: found neither KF5CompletionConfig.cmake nor kf5completion-config.cmake
-- Could NOT find KF5CoreAddons (missing: KF5CoreAddons_DIR)
-- Could NOT find KF5CoreAddons: found neither KF5CoreAddonsConfig.cmake nor kf5coreaddons-config.cmake
-- Could NOT find KF5GuiAddons (missing: KF5GuiAddons_DIR)
-- Could NOT find KF5GuiAddons: found neither KF5GuiAddonsConfig.cmake nor kf5guiaddons-config.cmake
-- Could NOT find KF5I18n (missing: KF5I18n_DIR)
-- Could NOT find KF5I18n: found neither KF5I18nConfig.cmake nor kf5i18n-config.cmake
-- Could NOT find KF5ItemModels (missing: KF5ItemModels_DIR)
-- Could NOT find KF5ItemModels: found neither KF5ItemModelsConfig.cmake nor kf5itemmodels-config.cmake
-- Could NOT find KF5ItemViews (missing: KF5ItemViews_DIR)
-- Could NOT find KF5ItemViews: found neither KF5ItemViewsConfig.cmake nor kf5itemviews-config.cmake
-- Could NOT find KF5WindowSystem (missing: KF5WindowSystem_DIR)
-- Could NOT find KF5WindowSystem: found neither KF5WindowSystemConfig.cmake nor kf5windowsystem-config.cmake
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find KF5 (missing: Config WidgetsAddons Completion CoreAddons
GuiAddons I18n ItemModels ItemViews WindowSystem) (Required is at least
version "5.18.0")
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/share/ECM/find-modules/FindKF5.cmake:110 (find_package_handle_standard_args)
CMakeLists.txt:275 (find_package)

インストールする
[root@localhost ~]# dnf install kf5-kconfig-devel


-- Krita version: 4.2.0-pre-alpha
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.7.2", minimum required is "3.0")
-- Python system site-packages directory: /usr/lib64/python3.7/site-packages
-- Found PythonLibrary: /usr/lib64/libpython3.7m.so (Required is at least version "3.0")
-- Looking for __GLIBC__
-- Looking for __GLIBC__ - found
-- Performing Test _OFFT_IS_64BIT
-- Performing Test _OFFT_IS_64BIT - Success
-- Performing Test HAVE_DATE_TIME
-- Performing Test HAVE_DATE_TIME - Success
-- Found KF5Config: /usr/lib64/cmake/KF5Config/KF5ConfigConfig.cmake (found version "5.55.0")
-- Found KF5WidgetsAddons: /usr/lib64/cmake/KF5WidgetsAddons/KF5WidgetsAddonsConfig.cmake (found version "5.55.0")
-- Found KF5Completion: /usr/lib64/cmake/KF5Completion/KF5CompletionConfig.cmake (found version "5.55.0")
-- Found KF5CoreAddons: /usr/lib64/cmake/KF5CoreAddons/KF5CoreAddonsConfig.cmake (found version "5.55.0")
-- Found KF5GuiAddons: /usr/lib64/cmake/KF5GuiAddons/KF5GuiAddonsConfig.cmake (found version "5.55.0")
-- Found Gettext: /usr/bin/msgmerge (found version "0.19.8.1")
-- Found KF5I18n: /usr/lib64/cmake/KF5I18n/KF5I18nConfig.cmake (found version "5.55.0")
-- Found KF5ItemModels: /usr/lib64/cmake/KF5ItemModels/KF5ItemModelsConfig.cmake (found version "5.55.0")
-- Found KF5ItemViews: /usr/lib64/cmake/KF5ItemViews/KF5ItemViewsConfig.cmake (found version "5.55.0")
-- Found KF5WindowSystem: /usr/lib64/cmake/KF5WindowSystem/KF5WindowSystemConfig.cmake (found version "5.55.0")
-- Found KF5: success (found suitable version "5.55.0", minimum required is "5.18.0") found components: Config WidgetsAddons Completion CoreAddons GuiAddons I18n ItemModels ItemViews WindowSystem
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find X11 (missing: Xinput)
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake/Modules/FindX11.cmake:366 (find_package_handle_standard_args)
CMakeLists.txt:372 (find_package)

X11のライブラリはわかりづらかった…
[root@localhost ~]# dnf install libXi-devel


-- Krita version: 4.2.0-pre-alpha
-- Python system site-packages directory: /usr/lib64/python3.7/site-packages
-- Could NOT find XCB_ATOM (missing: XCB_ATOM_LIBRARY XCB_ATOM_INCLUDE_DIR) (found version "")
-- Could NOT find XCB (missing: ATOM) (found version "1.13.1")

[root@localhost ~]# dnf install xcb-util-devel


-- Krita version: 4.2.0-pre-alpha
-- Python system site-packages directory: /usr/lib64/python3.7/site-packages
-- Boost version: 1.66.0
-- Found the following Boost libraries:
-- system
-- WARNING: you are using the obsolete 'PKGCONFIG' macro, use FindPkgConfig
-- PKGCONFIG() indicates that gsl is not installed (install the package which contains gsl.pc if you want to support this feature)
-- Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR)

jpegのライブラリもわかりづらかった…
[root@localhost ~]# dnf install libjpeg-turbo-devel


Traceback (most recent call last):

File "/home/fukari/kritadev/krita/cmake/modules/FindSIP.py", line 8, in
import sipconfig
ModuleNotFoundError: No module named 'sipconfig'
[root@localhost ~]# dnf install python3-sip-devel


CMake Error: The following variables are used in this project, but they are set to NOTFOUND.

Please set them or make sure they are set and tested correctly in the CMake files:
QUAZIP_INCLUDE_DIR
used as include directory in directory /home/fukari/kritadev/krita/libs/store
used as include directory in directory /home/fukari/kritadev/krita/libs/store
used as include directory in directory /home/fukari/kritadev/krita/libs/store
used as include directory in directory /home/fukari/kritadev/krita/libs/store
used as include directory in directory /home/fukari/kritadev/krita/libs/store
used as include directory in directory /home/fukari/kritadev/krita/libs/store
used as include directory in directory /home/fukari/kritadev/krita/libs/store
used as include directory in directory /home/fukari/kritadev/krita/libs/store
used as include directory in directory /home/fukari/kritadev/krita/libs/store/tests
used as include directory in directory /home/fukari/kritadev/krita/libs/store/tests
used as include directory in directory /home/fukari/kritadev/krita/libs/store/tests
used as include directory in directory /home/fukari/kritadev/krita/libs/store/tests
used as include directory in directory /home/fukari/kritadev/krita/libs/store/tests
used as include directory in directory /home/fukari/kritadev/krita/libs/store/tests
used as include directory in directory /home/fukari/kritadev/krita/libs/store/tests
used as include directory in directory /home/fukari/kritadev/krita/libs/store/tests
used as include directory in directory /home/fukari/kritadev/krita/libs/store/tests
used as include directory in directory /home/fukari/kritadev/krita/libs/store/tests
QUAZIP_LIBRARIES

これもわけわからなかったけれど、パスが通ってなくてそもそもライブラリすらインストールされていなかった。
[root@localhost ~]# dnf install quazip-qt5-devel


ここまできたらcmakeをパスできました。



makeすることができました。


あとは make install でインストールを行い、完了です。