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