]> git.lyx.org Git - lyx.git/blob - INSTALL
typo
[lyx.git] / INSTALL
1 Compiling and installing LyX with autotools
2 ===========================================
3
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.
7
8
9 Quick compilation guide
10 -----------------------
11
12 These four steps will compile, test and install LyX:
13
14         0) Linux users beware: You need qt5 and qt5-devel packages
15            of the same version to compile LyX.
16
17            In general, it is also recommended to have pkg-config
18            installed (the name might vary depending on your
19            distribution).
20
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
25            available.
26
27            See Note below if ./configure script is not present.
28
29         2) make
30            compiles the program.
31
32         3) src/lyx
33            runs the program so you can check it out.
34
35         4) make install
36            will install it. You can use "make install-strip" instead
37            if you want a smaller binary.
38
39
40 Note for Git checkouts
41 -----------------------------
42
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.
48
49 You will also probably need GNU m4 (perhaps installed as gm4).
50
51
52 Requirements
53 ------------
54
55 First of all, you will need a C++11 standard conforming compiler, like g++ (at
56 least 4.9, to have proper srd::regex) or clang++.
57
58 LyX makes great use of the C++ Standard Library. This means that gcc
59 users will have to install the relevant libstdc++ library to be able
60 to compile this version of LyX.
61
62 For full LyX usability we suggest to use Qt 5.6 and higher, or at the
63 very least Qt 5.4. It is also possible to compile against Qt 6. The
64 only special point to make is that you must ensure that both LyX and
65 the Qt libraries are compiled with the same C++ compiler.
66
67 To build LyX with spell checking capabilities included you have to
68 install at least one of the development packages of the spell checker
69 libraries. See the RELEASE-NOTES for details.
70
71 Users of debian-based distributions are well advised to run
72 'apt-get build-dep lyx' before compiling to install proper dependencies.
73
74
75 * Other things to note
76
77 If you make modifications to the source that affect any of the
78 translations or you change the translation files themselves (po/*.po)
79 files, you will need to have the GNU gettext package installed to
80 compile LyX with up-to-date translations (at least gettext version
81 0.16.1 is needed). You can get the latest version from:
82         ftp://ftp.gnu.org/gnu/gettext/
83
84 The two following programs should be available at configuration time:
85
86   o Python (2.7 or 3.5 and newer) must be installed. Python is used for many
87     simple tasks that are executed by external scripts, such as the automatic
88     configuration step and the import of older LyX documents with the lyx2lyx
89     script (this script is called automatically when opening a file).
90
91
92 Creating the Makefile
93 ---------------------
94
95 LyX can be configured using GNU autoconf utility which attempts to guess
96 the configuration needed to suit your system.  The standard way to use it
97 is described in the file INSTALL.autoconf.  In most cases you will be able
98 to create the Makefile by typing
99
100   ./configure
101
102 For more complicated cases, LyX configure honors the following specific
103 flags:
104
105   o --enable-build-type=[rel(ease), pre(release), dev(elopment), prof(iling), gprof]
106     allows to tweak the compiled code. The following table describes
107     the settings in terms of various options that are described later
108
109                       release   prerelease  development profiling gprof
110     optimization        -O2         -O2         -Og        -O2     -O2
111     assertions                       X           X
112     stdlib-assertions                            X
113     stdlib-debug
114     warnings                         X           X
115     debug                            X           X           X       X
116     maintainer-mode                              X
117
118     The defaults are as follows in terms of version number:
119     release: stable release (2.x.y)
120     prerelease: version number contains `alpha', `beta', `rc' or `pre'.
121     development: version number contains `dev'.
122
123     The `profiling' build type uses the -fno-omit-frame-pointer option with gcc
124
125     The `gprof' build type compiles and links with -pg option with gcc.
126
127   o --enable-qt6 that checks configuration with Qt 6.x, and then Qt
128     5.x. By default, only Qt5 is tried.
129
130   o --with-extra-lib=DIRECTORY that specifies the path where LyX will
131     find extra libraries (like Qt) it needs. Defaults to NONE
132     (i.e. search in standard places). You can specify several
133     directories, separated by colons.
134
135   o --with-extra-inc=DIRECTORY that gives the place where LyX will find
136     extra headers.  Defaults to NONE (i.e.  search in standard places).
137     You can specify several directories, separated by colons.
138
139   o --with-extra-prefix[=DIRECTORY] that is equivalent to
140        --with-extra-lib=DIRECTORY/lib --with-extra-inc=DIRECTORY/include
141     If DIRECTORY is not specified, the current prefix is used.
142
143   o --with-version-suffix[=SUFFIX] will install LyX as lyxSUFFIX. The
144     LyX data directory will be something like <whatever>/lyxSUFFIX/.
145     Additionally your user configuration files will be found in e.g.
146     $HOME/.lyxSUFFIX. The default for SUFFIX is "-<currentversion>",
147     e.g. lyx-1.6.1.
148
149     You can use this feature to install more than one version of LyX
150     on the same system. You can optionally specify a "version" of your
151     own, by doing something like :
152        ./configure --with-version-suffix=-latestdev
153
154     Note that the standard configure options --program-prefix,
155     --program-suffix and the others will not affect the shared LyX
156     directory etc. so it is recommended that you use --with-version-suffix
157     (or --prefix) instead.
158
159 There are also flags to control the internationalization support in
160 LyX:
161
162   o --disable-nls suppresses all internationalization support,
163     yielding somewhat smaller code.
164
165   o You can also set the environment variable LINGUAS to a list of
166     languages in case you do not want to install all the translation
167     files. For example, if you are only interested in German and
168     Finnish, you can type (with sh or bash)
169         export LINGUAS='de fi'
170     before running configure.
171
172 Moreover, the following generic configure flags may be useful:
173
174   o --prefix=DIRECTORY specifies the root directory to use for
175     installation. [defaults to /usr/local]
176
177   o --datadir=DIRECTORY gives the directory where all extra LyX
178     files (documentation, templates and layout definitions)
179     will be installed.
180     [defaults to ${prefix}/share/lyx${program_suffix}]
181
182   o --bindir=DIRECTORY gives the directory where the lyx binary
183     will be installed. [defaults to ${prefix}/bin]
184
185   o --mandir=DIRECTORY gives the directory where the man pages will go.
186     [defaults to ${prefix}/man]
187
188   o --enable-maintainer-mode enables some code that automatically
189     rebuilds the configure script, makefiles templates and other useful
190     files when needed. This is off by default on releases, to avoid
191     surprises.
192
193 Note that the --with-extra-* commands are not really robust when it
194 comes to using relative paths.  If you really want to use a relative path
195 here, you can prepend it with "`pwd`/".
196
197 If you do not like the default compile flags used (-g -O2 on gcc), you can
198 set CXXFLAGS variable to other values as follows:
199
200   o CXXFLAGS='-O2' (sh, bash)
201   o setenv CXXFLAGS '-O2' (csh, tcsh)
202
203 Similarly, if you want to force the use of a specific compiler, you can
204 give a value to the CXX variable.
205
206 The following options allow you to tweak the generated code more
207 precisely (see the description of --enable-build-type for the default
208 values):
209
210   o --enable-cxx-mode=VALUE can be used to select a C++ standard, for
211     example --enable-cxx-mode=11. The default is to try C++17, C++14, and
212     C++11, in this order.
213
214   o --enable-optimization=VALUE enables you to set optimization to a
215     higher level than the default, for example --enable-optimization=-O3.
216     Default is -Og when debugging is enabled, -O2 otherwise.
217
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 be slower.
221
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.
225
226   o --enable-warnings that make the compiler output more warnings during
227     the compilation of LyX.  Opposite is --disable-warnings.
228
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.
232
233   o --enable-stdlib-assertions adds some bound checking code in the
234     libstdc++ standard library; this slows down the code, but has been
235     helpful in the past to find bugs. This has no effect when using
236     llvm's libc++ library.
237
238   o --enable-stdlib-debug encompasses stdlib-assertions and adds
239     additional checks in libstdc++. Note that this changes the ABI and
240     is in general incompatible with the system hunspell library (as of
241     version 1.5). You may have to use --disable-stdlib-debug when
242     linking development versions against your system's hunspell
243     library. This has no effect when using llvm's libc++ library.
244
245
246
247 Compiling and installing LyX
248 ----------------------------
249
250 Once you've got the Makefile created, you just have to type:
251
252   make all
253   make install
254
255 All should be OK ;)
256
257 Since the binaries with debug information tend to be huge (although
258 this does not affect the run-time memory footprint), you might want
259 to strip the lyx binary. In this case replace "make install" with
260
261   make install-strip
262
263 BTW: in the lib/images subdirectory there is also small icons
264 `lyx.png' and `lyx.svg', that can be used to display LyX documents in
265 filemanagers.
266
267 If configure fails for some strange reason
268 ------------------------------------------
269
270 Even when configure fails, it creates a Makefile.  You can always check
271 the contents of this file, modify it and run 'make'.
272
273 Compiling For Multiple Architectures
274 ------------------------------------
275
276 You can compile LyX for more than one kind of computer at the same
277 time, by placing the object files for each architecture in their own
278 directory.  To do this, you must use a version of `make' that supports
279 the `VPATH' variable, such as GNU `make'.  `cd' to the directory where
280 you want the object files and executables to go and run the
281 `configure' script.  `configure' automatically checks for the source
282 code in the directory that `configure' is in and in `..'.
283
284 If you have to use a `make' that does not support the `VPATH'
285 variable, you have to compile LyX for one architecture at a time in
286 the source code directory.  After you have installed LyX for one
287 architecture, use `make distclean' before reconfiguring for another
288 architecture.
289