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