KDE Frameworks 6 Pre-installation Configuration

KF6 can be installed in /usr or /opt/kf6. The BLFS editors recommend the latter in the BLFS environment.

Installing in /usr

One option is to install KDE Frameworks into the /usr hierarchy. This creates a simpler setup but makes it more difficult to try multiple versions of KDE Frameworks.

export KF6_PREFIX=/usr

It is a good idea to add the following variables to your system or personal profiles:

cat >> /etc/profile.d/qt6.sh << "EOF"
# Begin kf6 extension for /etc/profile.d/qt6.sh

pathappend /usr/lib/plugins        QT_PLUGIN_PATH
pathappend $QT6DIR/lib/plugins     QT_PLUGIN_PATH

pathappend /usr/lib/qt6/qml        QML2_IMPORT_PATH
pathappend $QT6DIR/lib/qml         QML2_IMPORT_PATH

# End extension for /etc/profile.d/qt6.sh
EOF

cat > /etc/profile.d/kf6.sh << "EOF"
# Begin /etc/profile.d/kf6.sh

export KF6_PREFIX=/usr

# End /etc/profile.d/kf6.sh
EOF
[Note]

Note

If qt6 was installed in /usr, the $QT6DIR/lib/ portions of the above paths may need to be changed to $QT6DIR/lib/qt6/.

Additionally, if Sudo-1.9.16p1 is installed, these variables should be available to the super user. Execute the following commands as the root user:

cat >> /etc/sudoers.d/qt << "EOF"
Defaults env_keep += QT_PLUGIN_PATH
Defaults env_keep += QML2_IMPORT_PATH
EOF

cat >> /etc/sudoers.d/kde << "EOF"
Defaults env_keep += KF6_PREFIX
EOF

Installing in /opt

A method of building multiple versions installs KDE Frameworks in the /opt hierarchy:

export KF6_PREFIX=/opt/kf6

If you are not installing KDE Frameworks in /usr, you will need to make some additional configuration changes. Best practice is to add those to your system or personal profile:

cat > /etc/profile.d/kf6.sh << "EOF"
# Begin /etc/profile.d/kf6.sh

export KF6_PREFIX=/opt/kf6

pathappend $KF6_PREFIX/bin              PATH
pathappend $KF6_PREFIX/lib/pkgconfig    PKG_CONFIG_PATH

pathappend $KF6_PREFIX/etc/xdg          XDG_CONFIG_DIRS
pathappend $KF6_PREFIX/share            XDG_DATA_DIRS

pathappend $KF6_PREFIX/lib/plugins      QT_PLUGIN_PATH
pathappend $KF6_PREFIX/lib/plugins/kcms QT_PLUGIN_PATH

pathappend $KF6_PREFIX/lib/qml          QML2_IMPORT_PATH

pathappend $KF6_PREFIX/lib/python3.13/site-packages PYTHONPATH

pathappend $KF6_PREFIX/share/man        MANPATH

pathappend $KF6_PREFIX/include          CPLUS_INCLUDE_PATH
# End /etc/profile.d/kf6.sh
EOF

cat >> /etc/profile.d/qt6.sh << "EOF"
# Begin Qt6 changes for KF6

pathappend /usr/lib/plugins            QT_PLUGIN_PATH
pathappend $QT6DIR/plugins             QT_PLUGIN_PATH
pathappend $QT6DIR/qml                 QML2_IMPORT_PATH

# End Qt6 changes for KF6
EOF

Expand your /etc/ld.so.conf file:

cat >> /etc/ld.so.conf << "EOF"
# Begin KF6 addition

/opt/kf6/lib

# End KF6 addition
EOF

Several KDE Frameworks and KDE Plasma packages install files into D-Bus, Polkit, and systemd directories. When installing KDE 6 in a location other than /usr, D-Bus, Polkit, and systemd need to be able to find these files. The easiest way to achieve this is to create the following symlinks (as the root user):

install -v -dm755           $KF6_PREFIX/{etc,share} &&
ln -sfv /etc/dbus-1         $KF6_PREFIX/etc         &&
ln -sfv /usr/share/dbus-1   $KF6_PREFIX/share       &&
ln -sfv /usr/share/polkit-1 $KF6_PREFIX/share       &&
install -v -dm755           $KF6_PREFIX/lib         &&
ln -sfv /usr/lib/systemd    $KF6_PREFIX/lib

Some packages may also install icons from the "hicolor" icon set. Since that icon set is used by many packages, it is a good idea to create a symlink to the one in /usr/share to avoid having multiple installations of hicolor-icon-theme-0.18. Run the following commands as the root user:

install -v -dm755                $KF6_PREFIX/share/icons &&
ln -sfv /usr/share/icons/hicolor $KF6_PREFIX/share/icons
[Tip]

Tip

Sometimes, the installation paths are hardcoded into installed files. This is the reason why /opt/kf6 is used as installation prefix instead of /opt/kf6-6.8.0. After installing KDE Frameworks, you may rename the directory and create a symlink:

mv /opt/kf6{,-6.8.0}
ln -sfv kf6-6.8.0 /opt/kf6

Later on, you may want to install other versions of KDE Frameworks. To do that, just remove the symlink and use /opt/kf6 as the prefix again. Which version of KDE Frameworks you use depends only on where the symlink points. No other reconfiguration will be needed.