Jump to content

Get Involved/development/Install the dependencies: Difference between revisions

From KDE Community Wiki
Ngraham (talk | contribs)
Remove stuff that duplicates what kdesrc-build --initial-setup does
Nmariusp (talk | contribs)
See https://develop.kde.org/docs/getting-started/building/help-dependencies
Tag: Replaced
 
(19 intermediate revisions by 3 users not shown)
Line 1: Line 1:
In the following we give the dependencies to install. However it might change and this page might be quickly outdated.
See https://develop.kde.org/docs/getting-started/building/help-dependencies
 
{{Note|If some packages fail to install, you can try removing the ones that don't work from the list.}}
 
Reading the <code>CMakeLists.txt</code> of the packages you want to install should help you finding what you '''really''' need to install. Or read the error logs (see below).
 
If you need help, see https://community.kde.org/Get_Involved#Getting_in_Touch_and_Working_Together
 
=== Enable the source repositories ===
 
<pre class="ml-0 pre-input" style="display: inline;">Set up kdesrc-build - Step 4/6.</pre>
 
Some operating systems also require that you enable on the source repositories before you can install build dependencies. Do that now, if necessary:
* KDE neon/Debian/Ubuntu/Kubuntu: <code>sudo sed -i '/deb-src/s/^# //' /etc/apt/sources.list && sudo apt update</code> . Open the file <code>/etc/apt/sources.list</code> in a text editor and make sure that each line that starts with "deb " is followed by an identical line but which starts with "deb-src ". For more information, see https://askubuntu.com/questions/158871/how-do-i-enable-the-source-code-repositories. Note: if the file <code>/etc/apt/sources.list</code> does not contain commented out deb-src lines starting with "#deb-src " and <code>apt build-dep</code> returns errors (e.g. <code>E: You must put some 'deb-src' URIs in your sources.list</code>). Then you should duplicate the lines starting with "deb " and in the copied/duplicated lines, replace "deb " with "deb-src ".
* openSUSE Leap & Tumbleweed: <code>sudo zypper mr -e $(zypper repos | awk '/source/{print $5}')</code>
* Gentoo is all built from sources anyway, so in most cases all necessary build dependencies for installed packages will be available from the get-go, but for convenience this page will refer to sets available from [https://wiki.gentoo.org/wiki/KDE/Ebuild_repository KDE ebuild repository]:<br /><code>emerge&nbsp;eselect-repository && eselect&nbsp;repository&nbsp;enable&nbsp;kde</code>
<br />
If you don't see your distro in the above list, then there's nothing you need to do here and you can safely move on.
<br />
 
== How to install the dependencies of one package ==
=== KDE neon, Debian, Ubuntu, Kubuntu ===
All the build packages known by the package you want to build can be installed by running:
 
<code>sudo apt build-dep <package you want to build></code>
 
For example, to install the build dependencies for Dolphin, run:
 
<code>sudo apt build-dep dolphin</code>
 
=== Fedora===
If dependencies are missing for a specific RPM package, you can run:
 
<code>sudo dnf builddep <name_of_rpm_package></code>
 
For example, to install the build dependencies for Dolphin, run:
 
<code>sudo dnf builddep dolphin</code>
 
=== openSUSE ===
Generally you can install the required -devel packages that are needed to build some KDE software from source by using <code>zypper</code> (as root, or by using <code>sudo</code>), e.g. to install the -devel packages required to build dolphin from source:
{{Input|1=<nowiki>
# zypper --plus-content repo-source source-install --build-deps-only dolphin
</nowiki>}}
 
replace ''dolphin'' with some other package name, e.g. to build ''ktexteditor'' from source:
{{Input|1=<nowiki>
# zypper --plus-content repo-source source-install --build-deps-only ktexteditor
</nowiki>}}
 
Note that the <code>--plus-content</code> option in the above commands means you don't need to have the source repository enabled all the time, <code>--plus-content</code> will make zypper temporarily enable it to get the info it needs.
 
openSUSE (and most other RPM-based Linux distributions) support cmake() BuildRequires, which means you can install a development package like so:
{{Input|1=<nowiki>
# zypper install 'cmake(KF5KIO)'
</nowiki>}}
 
the part between the parenthesis ''KF5KIO'' is going to be in the error message that CMake will print in the terminal if you try to build something that requires e.g. KIO if KIO development headers aren't installed.
 
Any other dependencies can be figured out and installed as you continue building the modules one by one.
 
== Quick fixes for package manager errors ==
The above lists might not always be working out of the box on your specific distribution or might be out of date for individual packages. In many cases removing single packages from the lists above still allows you to build many KDE frameworks and applications.
 
In case it is a package added by a regex, you can exclude the specific package by a workaround using sed. Let us assume for an example that we want to install "libkf5.*-dev" on deb-based systems but have uninstallable packages libkf5example1-dev, libkf5example2-dev. Then we install all "libkf5.*-dev" packages excluding libkf5example1-dev and libkf5example2-dev through:
<pre  style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: normal;">$ sudo apt install $(apt-cache search -n "libkf5.*-dev" | sed 's/ - .*//' | sed '/libkf5example1-dev/d' | sed '/libkf5example2-dev/d')</pre>

Latest revision as of 22:44, 6 December 2024