]> git.lyx.org Git - lyx.git/blob - INSTALL
Prepare for 2.3.4-3
[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 qt4/5 and qt4/5-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/qt4/") if the
19            environment variable QTDIR is not set and pkg-config is not
20            available.
21            You will need --enable-qt5 switch for choosing qt5 over qt4.
22
23            See Note below if ./configure script is not present.
24
25         2) make
26            compiles the program.
27
28         3) src/lyx
29            runs the program so you can check it out.
30
31         4) make install
32            will install it. You can use "make install-strip" instead
33            if you want a smaller binary.
34
35
36 Note for Git checkouts
37 -----------------------------
38
39 If you have checked this out from Git, you need to have:
40 * automake (supported versions are 1.14--1.16)
41 * autoconf (supported versions are 2.65--2.69)
42 Then type "./autogen.sh" to build the needed configuration
43 files and proceed as stated above/below.
44
45 You will also probably need GNU m4 (perhaps installed as gm4).
46
47
48 Requirements
49 ------------
50
51 First of all, you will need a recent C++ compiler, where recent means
52 that the compilers are close to C++11 standard conforming like gcc (at
53 least 4.6) or clang.
54
55 LyX makes great use of the C++ Standard Template Library (STL).
56 This means that gcc users will have to install the relevant libstdc++
57 library to be able to compile this version of LyX.
58
59 For full LyX usability we suggest to use Qt 5.6 and higher, or at the
60 very least Qt 5.4. For compilation you need to compile against at least
61 Qt 4.8 which has been widely tested, and for Windows we advise at least
62 Qt 4.8.4. The only special point to make is that you must ensure that
63 both LyX and the Qt libraries are compiled with the same C++ compiler.
64
65 To build LyX with spell checking capabilities included you have to
66 install at least one of the development packages of the spell checker
67 libraries. See the RELEASE-NOTES for details.
68
69
70 * Other things to note
71
72 If you make modifications to the source that affect any of the
73 translations or you change the translation files themselves (po/*.po)
74 files, you will need to have the GNU gettext package installed to
75 compile LyX with up-to-date translations (at least gettext version
76 0.16.1 is needed). You can get the latest version from:
77         ftp://ftp.gnu.org/gnu/gettext/
78
79 The two following programs should be available at configuration time:
80
81   o Python 2.7 must be installed. Python is used for many simple tasks
82     that are executed by external scripts, such as the automatic
83     configuration step and the import of older LyX documents with the
84     lyx2lyx script (this script is called automatically when opening a
85     file). Python 3 (3.3 or later) support is work in progress.
86
87
88 Creating the Makefile
89 ---------------------
90
91 LyX can be configured using GNU autoconf utility which attempts to guess
92 the configuration needed to suit your system.  The standard way to use it
93 is described in the file INSTALL.autoconf.  In most cases you will be able
94 to create the Makefile by typing
95
96   ./configure
97
98 For more complicated cases, LyX configure honors the following specific
99 flags:
100
101   o --enable-build-type=[rel(ease), pre(release), dev(elopment), prof(iling), gprof]
102     allows to tweak the compiled code. The following table describes
103     the settings in terms of various options that are described later
104
105                       release   prerelease  development profiling gprof
106     optimization        -O2         -O2         -O         -O2     -O2
107     assertions                       X           X
108     stdlib-debug                                 X
109     warnings                         X           X
110     debug                            X           X           X       X
111
112     The defaults are as follows in terms of version number
113     release: stable release (2.x.y)
114     prerelease: version number contains alpha, beta, rc or pre.
115     development: version number contains dev.
116
117     The `profiling' build type uses the -fno-omit-frame-pointer option with gcc
118
119     The `gprof' build type compiles and links with -pg option with gcc.
120
121   o --with-extra-lib=DIRECTORY that specifies the path where LyX will
122     find extra libraries (qt4) it needs. Defaults to NONE
123     (i.e. search in standard places). You can specify several
124     directories, separated by colons.
125
126   o --with-extra-inc=DIRECTORY that gives the place where LyX will find
127     extra headers.  Defaults to NONE (i.e.  search in standard places).
128     You can specify several directories, separated by colons.
129
130   o --with-extra-prefix[=DIRECTORY] that is equivalent to
131        --with-extra-lib=DIRECTORY/lib --with-extra-inc=DIRECTORY/include
132     If DIRECTORY is not specified, the current prefix is used.
133
134   o --with-version-suffix[=SUFFIX] will install LyX as lyxSUFFIX. The
135     LyX data directory will be something like <whatever>/lyxSUFFIX/.
136     Additionally your user configuration files will be found in e.g.
137     $HOME/.lyxSUFFIX. The default for SUFFIX is "-<currentversion>",
138     e.g. lyx-1.6.1.
139
140     You can use this feature to install more than one version of LyX
141     on the same system. You can optionally specify a "version" of your
142     own, by doing something like :
143        ./configure --with-version-suffix=-latestdev
144
145     Note that the standard configure options --program-prefix,
146     --program-suffix and the others will not affect the shared LyX
147     directory etc. so it is recommended that you use --with-version-suffix
148     (or --prefix) instead.
149
150 There are also flags to control the internationalization support in
151 LyX:
152
153   o --disable-nls suppresses all internationalization support,
154     yielding somewhat smaller code.
155
156   o You can also set the environment variable LINGUAS to a list of
157     languages in case you do not want to install all the translation
158     files. For example, if you are only interested in German and
159     Finnish, you can type (with sh or bash)
160         export LINGUAS='de fi'
161     before running configure.
162
163 Moreover, the following generic configure flags may be useful:
164
165   o --prefix=DIRECTORY specifies the root directory to use for
166     installation. [defaults to /usr/local]
167
168   o --datadir=DIRECTORY gives the directory where all extra LyX
169     files (documentation, templates and layout definitions)
170     will be installed.
171     [defaults to ${prefix}/share/lyx${program_suffix}]
172
173   o --bindir=DIRECTORY gives the directory where the lyx binary
174     will be installed. [defaults to ${prefix}/bin]
175
176   o --mandir=DIRECTORY gives the directory where the man pages will go.
177     [defaults to ${prefix}/man]
178
179   o --enable-maintainer-mode enables some code that automatically
180     rebuilds the configure script, makefiles templates and other useful
181     files when needed. This is off by default on releases, to avoid
182     surprises.
183
184 Note that the --with-extra-* commands are not really robust when it
185 comes to using relative paths.  If you really want to use a relative path
186 here, you can prepend it with "`pwd`/".
187
188 If you do not like the default compile flags used (-g -O2 on gcc), you can
189 set CXXFLAGS variable to other values as follows:
190
191   o CXXFLAGS='-O2' (sh, bash)
192   o setenv CXXFLAGS '-O2' (csh, tcsh)
193
194 Similarly, if you want to force the use of a specific compiler, you can
195 give a value to the CXX variable.
196
197 If you encounter problems, please read the section 'Problems' at the end of
198 this file.
199
200 The following options allow you to tweak the generated code more precisely (see the description of --enable-build-type for the default 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 default is
210     to use std::regex for known good C++ libraries, but the test is not robust for clang.
211     --enable-std-regex will force the use of std::regex.
212
213   o --enable-debug will add debug information to your binary. This
214     requires a lot more disk space, but is a must if you want to try
215     to debug problems in LyX. There is no run-time penalty.
216
217   o --enable-warnings that make the compiler output more warnings during
218     the compilation of LyX.  Opposite is --disable-warnings.
219
220   o --enable-assertions that make the compiler generate run-time
221     code which checks that some variables have sane values. Opposite
222     is --disable-assertions.
223
224   o --enable-stdlib-debug adds some debug code in the standard
225     library; this slows down the code, but has been helpful in the
226     past to find bugs. Note that this is in general incompatible with
227     the system boost library (which is used when
228     --without-included-boost is specified). You may have to use
229     --disable-stdlib-debug when linking development versions against
230     your system's boost library.
231     The same problem applies to hunspell (as of hunspell 1.5). So either
232     compile --with-included-hunspell or --disable-stdlib-debug when
233     linking development versions against your system's hunspell library.
234
235   o --enable-monolithic-build[=boost,client,insets,mathed,core,tex2lyx,frontend-qt4]
236     that enables monolithic build of the given parts of the source
237     code. This should reduce the compilation time provided you have
238     enough memory (>500MB).
239
240
241 Compiling and installing LyX
242 ----------------------------
243
244 Once you've got the Makefile created, you just have to type:
245
246   make all
247   make install
248
249 All should be OK ;)
250
251 Since the binaries with debug information tend to be huge (although
252 this does not affect the run-time memory footprint), you might want
253 to strip the lyx binary. In this case replace "make install" with
254
255   make install-strip
256
257 BTW: in the lib/images subdirectory there is also small icons
258 `lyx.png' and `lyx.svg', that can be used to display LyX documents in
259 filemanagers.
260
261 If configure fails for some strange reason
262 ------------------------------------------
263
264 Even when configure fails, it creates a Makefile.  You can always check
265 the contents of this file, modify it and run 'make'.
266
267 Compiling For Multiple Architectures
268 ------------------------------------
269
270 You can compile LyX for more than one kind of computer at the same
271 time, by placing the object files for each architecture in their own
272 directory.  To do this, you must use a version of `make' that supports
273 the `VPATH' variable, such as GNU `make'.  `cd' to the directory where
274 you want the object files and executables to go and run the
275 `configure' script.  `configure' automatically checks for the source
276 code in the directory that `configure' is in and in `..'.
277
278 If you have to use a `make' that does not support the `VPATH'
279 variable, you have to compile LyX for one architecture at a time in
280 the source code directory.  After you have installed LyX for one
281 architecture, use `make distclean' before reconfiguring for another
282 architecture.
283
284 Problems
285 --------
286
287 This section provides several hints that have been submitted by LyX
288 team members or users to help compiling on some particular
289 architectures. If you find that some of these hints are wrong, please
290 notify us.
291
292   o On SUN Sparc Solaris, you need gnumake. The LyX makefiles do not
293     work with Solaris make.
294
295     The Solaris 8 ar seg-faults trying to build the insets library. You
296     will need to use the ar from the GNU binutils for this subdirectory.
297     There is no problem with the Solaris 9 and 10 ar.
298
299     Qt4 uses the Xrender X11 extension for antialiased fonts. This
300     extension was added to Xsun starting from the Solaris 10 8/07
301     release, but it is not activated by default. To activate it, you
302     must issue (as root) the following command:
303     svccfg -s svc:/application/x11/x11-server setprop options/server_args=+xrender
304     and then restart the X server.
305
306     There is a problem with the fontconfig library shipped with
307     Solaris 10 8/07 causing a seg-fault when it is used by Qt4.
308     Until this is fixed, a workaround is replacing the shared library
309     /usr/lib/libfontconfig.so.1 with a copy from a previous release or
310     installing a new version of fontconfig from http://www.sunfreeware.com/
311
312     On Solaris, the default fontconfig configuration gives preference
313     to bitmap fonts at (not so small) sizes. As bitmapped fonts are not
314     antialiased, you may prefer changing this configuration. This may be
315     done by adding the following stanza
316
317           <match target="pattern">
318               <edit name="prefer_bitmap">
319                   <bool>false</bool>
320               </edit>
321           </match>
322
323     to either ~/.fonts.conf (for a per-user change) or /etc/fonts/local.conf
324     (for a global system change). The stanza should be added between the
325     <fontconfig> and </fontconfig> tags. If neither ~/.fonts.conf nor
326     /etc/fonts/local.conf exists, you can create them with the following
327     content:
328
329       <?xml version="1.0"?>
330       <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
331       <fontconfig>
332           <match target="pattern">
333               <edit name="prefer_bitmap">
334                   <bool>false</bool>
335               </edit>
336           </match>
337       </fontconfig>