1 Compiling and installing LyX with autotools
2 ===========================================
4 This document is about compiling LyX with the autotools suite. If you
5 want to compile using using CMake (in particular on windows), please
6 refer to the INSTALL.cmake file.
9 Quick compilation guide
10 -----------------------
12 These four steps will compile, test and install LyX:
14 0) Linux users beware: You need qt5 and qt5-devel packages
15 of the same version to compile LyX.
17 In general, it is also recommended to have pkg-config
18 installed (the name might vary depending on your
21 1) ./configure configures LyX according to your system. You
22 may have to set --with-qt-dir=<path-to-your-qt-installation>
23 (for example, "--with-qt-dir=/usr/share/qt5/") if the
24 environment variable QTDIR is not set and pkg-config is not
27 See Note below if ./configure script is not present.
33 runs the program so you can check it out.
36 will install it. You can use "make install-strip" instead
37 if you want a smaller binary.
40 Note for Git checkouts
41 -----------------------------
43 If you have checked this out from Git, you need to have:
44 * automake (supported versions are 1.14--1.16)
45 * autoconf (supported versions are 2.65--2.69)
46 Then type "./autogen.sh" to build the needed configuration
47 files and proceed as stated above/below.
49 You will also probably need GNU m4 (perhaps installed as gm4).
55 First of all, you will need a C++11 standard conforming compiler, like gcc (at
58 LyX makes great use of the C++ Standard Template Library (STL).
59 This means that gcc users will have to install the relevant libstdc++
60 library to be able to compile this version of LyX.
62 For full LyX usability we suggest to use Qt 5.6 and higher, or at the
63 very least Qt 5.4. For compilation you need to compile against at least
64 Qt 4.8 which has been widely tested, and for Windows we advise at least
65 Qt 4.8.4. The only special point to make is that you must ensure that
66 both LyX and the Qt libraries are compiled with the same C++ compiler.
68 To build LyX with spell checking capabilities included you have to
69 install at least one of the development packages of the spell checker
70 libraries. See the RELEASE-NOTES for details.
72 Users of debian-based distributions are well advised to run
73 'apt-get build-dep lyx' before compiling to install proper dependencies.
76 * Other things to note
78 If you make modifications to the source that affect any of the
79 translations or you change the translation files themselves (po/*.po)
80 files, you will need to have the GNU gettext package installed to
81 compile LyX with up-to-date translations (at least gettext version
82 0.16.1 is needed). You can get the latest version from:
83 ftp://ftp.gnu.org/gnu/gettext/
85 The two following programs should be available at configuration time:
87 o Python 2.7 must be installed. Python is used for many simple tasks
88 that are executed by external scripts, such as the automatic
89 configuration step and the import of older LyX documents with the
90 lyx2lyx script (this script is called automatically when opening a
91 file). Python 3 (3.3 or later) support is work in progress.
97 LyX can be configured using GNU autoconf utility which attempts to guess
98 the configuration needed to suit your system. The standard way to use it
99 is described in the file INSTALL.autoconf. In most cases you will be able
100 to create the Makefile by typing
104 For more complicated cases, LyX configure honors the following specific
107 o --enable-build-type=[rel(ease), pre(release), dev(elopment), prof(iling), gprof]
108 allows to tweak the compiled code. The following table describes
109 the settings in terms of various options that are described later
111 release prerelease development profiling gprof
112 optimization -O2 -O2 -O -O2 -O2
119 The defaults are as follows in terms of version number
120 release: stable release (2.x.y)
121 prerelease: version number contains `alpha', `beta', `rc' or `pre'.
122 development: version number contains `dev'.
124 The `profiling' build type uses the -fno-omit-frame-pointer option with gcc
126 The `gprof' build type compiles and links with -pg option with gcc.
128 o --disable-qt5 that forces configuration with Qt 4.x when Qt 5.x is
129 also available. By default Qt5 is tried first, and then Qt4.
131 o --with-extra-lib=DIRECTORY that specifies the path where LyX will
132 find extra libraries (like Qt) it needs. Defaults to NONE
133 (i.e. search in standard places). You can specify several
134 directories, separated by colons.
136 o --with-extra-inc=DIRECTORY that gives the place where LyX will find
137 extra headers. Defaults to NONE (i.e. search in standard places).
138 You can specify several directories, separated by colons.
140 o --with-extra-prefix[=DIRECTORY] that is equivalent to
141 --with-extra-lib=DIRECTORY/lib --with-extra-inc=DIRECTORY/include
142 If DIRECTORY is not specified, the current prefix is used.
144 o --with-version-suffix[=SUFFIX] will install LyX as lyxSUFFIX. The
145 LyX data directory will be something like <whatever>/lyxSUFFIX/.
146 Additionally your user configuration files will be found in e.g.
147 $HOME/.lyxSUFFIX. The default for SUFFIX is "-<currentversion>",
150 You can use this feature to install more than one version of LyX
151 on the same system. You can optionally specify a "version" of your
152 own, by doing something like :
153 ./configure --with-version-suffix=-latestdev
155 Note that the standard configure options --program-prefix,
156 --program-suffix and the others will not affect the shared LyX
157 directory etc. so it is recommended that you use --with-version-suffix
158 (or --prefix) instead.
160 There are also flags to control the internationalization support in
163 o --disable-nls suppresses all internationalization support,
164 yielding somewhat smaller code.
166 o You can also set the environment variable LINGUAS to a list of
167 languages in case you do not want to install all the translation
168 files. For example, if you are only interested in German and
169 Finnish, you can type (with sh or bash)
170 export LINGUAS='de fi'
171 before running configure.
173 Moreover, the following generic configure flags may be useful:
175 o --prefix=DIRECTORY specifies the root directory to use for
176 installation. [defaults to /usr/local]
178 o --datadir=DIRECTORY gives the directory where all extra LyX
179 files (documentation, templates and layout definitions)
181 [defaults to ${prefix}/share/lyx${program_suffix}]
183 o --bindir=DIRECTORY gives the directory where the lyx binary
184 will be installed. [defaults to ${prefix}/bin]
186 o --mandir=DIRECTORY gives the directory where the man pages will go.
187 [defaults to ${prefix}/man]
189 o --enable-maintainer-mode enables some code that automatically
190 rebuilds the configure script, makefiles templates and other useful
191 files when needed. This is off by default on releases, to avoid
194 Note that the --with-extra-* commands are not really robust when it
195 comes to using relative paths. If you really want to use a relative path
196 here, you can prepend it with "`pwd`/".
198 If you do not like the default compile flags used (-g -O2 on gcc), you can
199 set CXXFLAGS variable to other values as follows:
201 o CXXFLAGS='-O2' (sh, bash)
202 o setenv CXXFLAGS '-O2' (csh, tcsh)
204 Similarly, if you want to force the use of a specific compiler, you can
205 give a value to the CXX variable.
207 The following options allow you to tweak the generated code more
208 precisely (see the description of --enable-build-type for the default
211 o --enable-cxx-mode=VALUE can be used to select a C++ standard, for
212 example --enable-cxx-mode=11. The default is to try C++14, and then
215 o --enable-optimization=VALUE enables you to set optimization to a
216 higher level than the default, for example --enable-optimization=-O3.
218 o --disable-optimization - you can use this to disable compiler
219 optimization of LyX. The compile may be much quicker with some
220 compilers, but LyX will run more slowly.
222 o --enable-debug will add debug information to your binary. This
223 requires a lot more disk space, but is a must if you want to try
224 to debug problems in LyX. There is no run-time penalty.
226 o --enable-warnings that make the compiler output more warnings during
227 the compilation of LyX. Opposite is --disable-warnings.
229 o --enable-assertions that make the compiler generate run-time
230 code which checks that some variables have sane values. Opposite
231 is --disable-assertions.
233 o --enable-stdlib-debug adds some debug code in the standard
234 library; this slows down the code, but has been helpful in the
235 past to find bugs. Note that this is in general incompatible with
236 the system hunspell library (as of version 1.5). You may have to use
237 --disable-stdlib-debug when linking development versions against
238 your system's hunspell library.
242 Compiling and installing LyX
243 ----------------------------
245 Once you've got the Makefile created, you just have to type:
252 Since the binaries with debug information tend to be huge (although
253 this does not affect the run-time memory footprint), you might want
254 to strip the lyx binary. In this case replace "make install" with
258 BTW: in the lib/images subdirectory there is also small icons
259 `lyx.png' and `lyx.svg', that can be used to display LyX documents in
262 If configure fails for some strange reason
263 ------------------------------------------
265 Even when configure fails, it creates a Makefile. You can always check
266 the contents of this file, modify it and run 'make'.
268 Compiling For Multiple Architectures
269 ------------------------------------
271 You can compile LyX for more than one kind of computer at the same
272 time, by placing the object files for each architecture in their own
273 directory. To do this, you must use a version of `make' that supports
274 the `VPATH' variable, such as GNU `make'. `cd' to the directory where
275 you want the object files and executables to go and run the
276 `configure' script. `configure' automatically checks for the source
277 code in the directory that `configure' is in and in `..'.
279 If you have to use a `make' that does not support the `VPATH'
280 variable, you have to compile LyX for one architecture at a time in
281 the source code directory. After you have installed LyX for one
282 architecture, use `make distclean' before reconfiguring for another