Development/GenericBuildingHints
TDF LibreOffice Document Liberation Project Community Blogs Weblate Nextcloud Redmine Ask LibreOffice Donate
Partition limitations
It's known that building on FAT(32)-formatted partitions don't work (the error is "Permission denied").
First Build
The first time make is invoked, it will download the other git repositories needed (if any) and other external packages to be downloaded.
Building the application can take 8/number_cores
hours on a reasonably recent processor, and much more on Windows.
$ ./autogen.sh
$ make check
Although this will do, you might want to do a little more typing with
$ make check 2>&1 | tee build.log
This command is to save all the output of the make into a file (build.log), so that you can go back to it later to investigate if needed. Also with a fresh git clone, downloading and corresponding make might take some time. To avoid accidental killing of the process, one can use nohup
make as follows: nohup make &
which might nag nohup: ignoring input and appending output to `nohup.out
. Then you can check progress with tail -f nohup.out
.
If your build fails, check that you have satisfied the dependencies mentioned at the top of this page.
Rebuilds and partial builds
Re-build
If you modify the sources, or pulled your git repositories with the lastest update, you can rebuild by simply running :
$ make
Sometimes, often because some header file got removed or renamed, it is necessary to do a full-blown rebuild.
$ make clean && make
Note that during the build process, absolute softlinks (with resolved links in the cwd) are formed inside the build tree. So if you want to duplicate compiled code, choose to preserve links or you will triplicate it instead (breaking the stuff). This, however, makes the copy attack the source when the copy is used/cleaned, so use a script that bends the links after such a copy.
Also, if you add or remove the option --enable-dbgutil
, you should do make clean
and then make
for a full rebuild. The reason is that binaries are incompatible. The fetched tarballs are not affected. If you do not do the full rebuild, you face failures in the build.
Partial build
Of course, due to the time it takes, a full rebuild is not the first recourse. When something goes wrong in a specific module, you can also rebuild just that module.
$ make <module>.clean
$ make <module>
Modules are normally named after their directory. To get a list of all modules run:
$ make showmodules
Single unit test run
If you need to run only a single test from a unit test module (including multiple tests), use this syntax:
$ make <CppunitTest_module> CPPUNIT_TEST_NAME=testFDO76163
Faster single unit test module runs
Running a global make just to run a single unit test can take time. Normally a unit test name contains the module it belongs to. You can speed up the lookup by explicitly stating its directory:
$ make -C <directory> <CppunitTest_module>
This will produce a more verbose output, but the result is the same.
Building without tests
make
does not perform any tests by default. Plain make should definitely not be used when building for the first time, because otherwise you may miss a problem with your setup that will give you a build with strange behavior that nobody else sees.
In the case when OpenCL tests (CppunitTest_sc_opencl_test) fail (e.g., due to faulty drivers on the development box), they may be disabled by setting the environment variable SAL_DISABLE_OPENCL
.
Verbosity and debug builds
Verbose build
If you want to get verbose output during build:
$ make verbose=t
Getting debug output
If you want to get the output of OSL_TRACE() calls and other debug messages:
$ make -s dbglevel=2
Getting debug symbols
If you want to enable symbols for profiling, debugging with gdb etc, but don't want to turn on debug outputs or change compiler optimization settings, run:
$ make -s ENABLE_SYMBOLS=true
Partial debug build
Should you need to do a debug build of a module, to see more of the debugging messages during the LibreOffice run, you can add debug=true
as a build's parameter, like:
$ make -s clean
$ make -s debug=true
When you want to build the debug version for a fix set of modules you can use:
./autogen.sh --enable-debug --enable-symbols="<space separated list of modules terminated with '/' >"
For details see the description of --enable-symbols
in the output of ./autogen.sh --help
.
Improving subsequent build performance
For details on ccache
, see the OS-specific build instructions.
Fewer icon sets
Icon sets are recreated during each build (on Windows even before compiling the changed code(!)), thus disabling most of them saves time if there are only small code changes to compile otherwise.
Pick eg. the default theme on your system (like elementary
or colibre
), and add the following parameter to your autogen.input
, then re-run autogen.sh
:
--with-theme=<theme_name>
A partial build, eg. make sw
completely avoids rebuilding icon sets.
Other useful commands you can use in the build system
autogen help
To configure your build run:
$ ./autogen.sh
$ ./autogen.sh --help
There you can review a list of the build options. You can create a file called autogen.input
to store these options permanently.
In the autogen.input file, give one option per line. You can temporarily comment out lines by adding # characters in front of them.
While some options in the autogen help are shown as taking values in quotes, the quotes are not used in autogen.input. So to provide a list of UI languages to build with in autogen.input, use --with-lang=de ja ar
A typical autogen.input file intended for LibreOffice development work might look like this:
--enable-dbgutil
--with-jdk-home=/path/to/jdk
make help
To see other available options during partial module build, run:
$ make help
Note that this is different from running make -h, which lists commands for the GNU make itself.
make fetch
For your first build, a lot of external tarballs get downloaded before the real build starts. If you want to build offline, you can do:
$ make fetch
before doing the build itself. This will download the other git repos and needed tar.gz packages. Note that make will do this step anyways if you don't do it manually, but doing a make fetch the first time allow you to monitor the download activity.
make distclean
To remove the files that `configure' created (so you can compile the package for a different distro or computer), type
$ make distclean
This can also be helpful if build starts failing after a major system upgrade.