From The Document Foundation Wiki

    The commands below should prepare a regular system into one able to build LibreOffice, it is by far the easiest way to use the existing package to bootstrap your build dependencies.

    Note pin.svg

    It is usually the case that branches that are newer than what your distro has packaged (especially master) have additional requirements, which the step will helpfully point out to you; usually these requirements are either optional and have a corresponding --disable-foo or --without-foo argument, or the requirement can be satisfied with an option to use a bundled copy via --without-system-foo argument (which should be the default already). If neither is the case then you need to install some development package on your system: look at what configure is complaining about specifically and use apt-cache search or yum search to find relevant packages, usually with -dev or -devel in the name.

    Note pin.svg

    Since Nov 28 2018, for LibreOffice 6.3 master, gperf 3.1 and flex 2.6.0, and gcc 7.x are required. Instructions updated for: Ubuntu.

    Debian / Ubuntu

    1. Install some prerequisites that get missed:

    sudo apt-get install git ccache junit4 gstreamer1.0-libav libkrb5-dev nasm graphviz libpython3-dev

    2. To run build-dep, your repository list should include the source-code repository. Make sure you have a deb-src line in /etc/apt/sources.list for the main repository.

    You can add the software sources by uncommenting the line (removing the starting #) under the deb line, or just copy the equivalent deb line and add -src to it. Or simply add source code repository in software source manager (in Ubuntu: Software Updater).

    The lines for source repositories should look something like these (replace <distroname> with the code name of your Debian/Ubuntu version, like "bionic" for Ubuntu 18.04):

    deb-src <distroname> main (do not copy and paste this line!)
    deb-src <distroname> main (do not copy and paste this line!)

    3. Next make sure the repositories are working properly (no errors)

    sudo apt-get update

    Some mirrors do not copy the sources. In that case you will need to switch to a mirror that does. This would cause the "Unable to find the source package for libreoffice" error in the next step.

    4. Then install all the build dependencies according to apt with:

    sudo apt-get build-dep libreoffice

    5. For 16.04, gperf 3.1 can be downloaded from (compiled for artful, but works on xenial) and then run the .deb to install it.

    6. For 16.04, an updated gcc / g++ is required.

     sudo add-apt-repository ppa:ubuntu-toolchain-r/test
     sudo apt update
     sudo apt install gcc-7 g++-7  #(or perhaps you want to jump to gcc 8 immediately - but I conservatively chose 7)
     sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 100 --slave /usr/bin/g++ g++ /usr/bin/g++-5
     sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 50 --slave /usr/bin/g++ g++ /usr/bin/g++-7
     sudo update-alternatives --config gcc
     gcc --version  #should produce version 7.4 or higher


    Start off by installing your build tools and git:

    sudo zypper install -t pattern devel_basis
    sudo zypper in libavahi-devel
    sudo zypper in fakeroot
    sudo zypper in ccache

    Now install all build dependencies:

    sudo zypper si -d libreoffice              # for openSUSE >= 12.1

    If you are building recent versions of LibreOffice on older OpenSUSE systems, you can use the LibreOffice factory repository, for reasonably up-to-date dependencies:

    sudo zypper ar

    For openSUSE 13.2 for example:

    sudo zypper ar

    IMPORTANT: Please, make sure that you have a reasonable Java SDK. Unfortunately, gcj is installed by default but it does not work reasonably. Please, do:

    sudo zypper in java-1_8_0-openjdk-devel


    sudo dnf builddep libreoffice

    Arch Linux

    Setup the basic build system:

    sudo pacman -S base-devel

    Make sure that you have installed at least the fonts that are required for the user interface:

    sudo pacman -S ttf-dejavu

    If 'gcc-libs-multilib' is installed, you will have to remove the 'gcc-libs' dependency.


    These make dependencies are copied from the official PKGBUILD of Arch Build System (with some modifications as it includes stuff that is not needed).

    sudo pacman -S --needed 'ant' 'apr' 'beanshell' 'bluez-libs' 'clucene' \
                            'coin-or-mp' 'cppunit' 'curl' 'dbus-glib' \
                            'desktop-file-utils' 'doxygen' 'flex' 'gcc-libs' \
                            'gdb' 'glm' 'gobject-introspection' 'gperf' 'gpgme' \
                            'graphite' 'gst-plugins-base-libs' 'gtk3' \
                            'harfbuzz-icu' 'hicolor-icon-theme' 'hunspell' \
                            'hyphen' 'icu' 'java-environment' 'junit' \
                            'lcms2' 'libabw' 'libatomic_ops' 'libcdr' 'libcmis' \
                            'libe-book' 'libepoxy' 'libepubgen' 'libetonyek' \
                            'libexttextcat' 'libfreehand' 'libgl' 'libjpeg' \
                            'liblangtag' 'libmspub' 'libmwaw' 'libmythes' \
                            'libnumbertext' 'libodfgen' 'liborcus' 'libpagemaker' \
                            'libqxp' 'libstaroffice' 'libtommath' 'libvisio' \
                            'libwpd' 'libwpg' 'libwps' 'libxinerama' 'libxrandr' \
                            'libxslt' 'libzmf' 'lpsolve' 'mariadb-libs' \
                            'mdds' 'nasm' 'neon' 'nspr' 'nss' 'pango' \
                            'plasma-framework' 'poppler' 'postgresql-libs' \
                            'python' 'qt5-base' 'redland' 'sane' 'serf' 'sh' \
                            'shared-mime-info' 'ttf-liberation' 'unixodbc' \
                            'unzip' 'xmlsec' 'zip'

    If you don't plan to be working on Java, you can remove ant, beanshell, java-environment and junit from this list as LibreOffice mostly runs without it.


    ./ --without-java --disable-postgresql-sdbc --disable-gstreamer