Building LibreOffice on macOS

From The Document Foundation Wiki
Jump to: navigation, search

This page describes how to set up a build environment for LibreOffice on macOS 10.9, 10.10, 10.11, 10.12 and 10.13.

Prerequisites

  1. Install Xcode. The latest version of Xcode is available as a free purchase in the Mac App Store. Previous and development versions of Xcode can be downloaded from developer.apple.com.
  2. Select the Xcode's active developer directory:
    sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
    
  3. You need to first accept the Xcode EULA by either launching Xcode or running the following command:
    sudo xcodebuild -license
    
  4. Install Apple's Command Line Developer Tools by running the following command:
    sudo xcode-select --install
    
  5. Download and install a JDK (Java SE Development Kit):

Quick Setup

see Development/lode

If you don't want to install Java JDK, add --without-java to ./autogen.sh

From your home directory (or anywhere else you want really) as a regular user:

$ git clone git://gerrit.libreoffice.org/lode
$ cd lode
$ ./setup --dev

Follow the messages at the end of the last command: you need to add

$ export LODE_HOME=<path to the cloned lode repo> 

and add export PATH=$LODE_HOME/opt/bin:$PATH to ~/.bash_login

Exit you session, start a shell again to pick up the changes in .profile. Check this is working using echo $PATH. then

$ cd lode/dev/core
$ ./autogen.sh --disable-cve-tests
$ make 2>&1 | tee build.log

To run LibreOffice run command:

$ open instdir/LibreOfficeDev.app

lode is developed by Infra to manage the deployment of CI slaves bots, it is used and maintained regularly.

Building Tips

See platform-independent tips at Development/GenericBuildingHints

Building in a ssh session

In some cases it seems that if you are building in a ssh session, some unit tests fail unless you also have a windowing session open to the machine, either on the physical console or through Screen Sharing.

Performance

Building LibreOffice takes time, a lot of time. Exactly how much depends on how powerful your machine is. But there are tools you can use to speed-up things.

ccache

ccache is short for compiler cache - and it is exactly that. It saves tons of time by not running the actual compiler when little has changed in the source codebetween two builds. But note that unless you explicitly do "make clean" often, that is not typically the case, and using ccache just because you think it maybe helps is not a good idea.

Get it here: [1]

Build it like this:

./configure
make
make install

You will also need to ensure the following is defined, e.g. in .bashrc, if using ccache (see Development/Building LibreOffice with Clang for full details), otherwise clang will report errors and show unnecessary warnings:

export CCACHE_CPP2=YES

The default cache limit (5 GB) is not large enough to be useful for a LibreOffice build, but you can increase it:

ccache --max-size 16 G && ccache -s

Build the UNO SDK

As of the master, to build the UNO SDK (i.e., drop the --disable-odk configure switch), you need to have Doxygen installed so that HTML documentation for the C++ UNO interface can be generated.

One option is to install Doxygen from its website and make sure the doxygen executable is found on the PATH, or specify its exact location via --with-doxygen=pathname configure switch.

Another option is to configure --without-doxygen, in which case the HTML documentation for the C++ UNO interface will be missing from the UNO SDK being built.

See also