]> git.lyx.org Git - lyx.git/blob - INSTALL
The Gtk removal from trunk.
[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: if compiling the Qt frontend, you need
10            qt and qt-devel packages of the same version to compile LyX.
11
12         1) ./configure --with-frontend=qt4
13            configures LyX according to your system. 
14            When compiling for Qt, you may have to set
15              --with-qt-dir=<path-to-your-qt-installation>
16            if the environment variable QTDIR is not set. 
17
18         2) make
19            compiles the program.
20
21         3) src/lyx
22            runs the program so you can check it out.
23
24         4) make install
25            will install it. You can use "make install-strip" instead
26            if you want a smaller binary.
27
28
29 Note for Subversion checkouts
30 -----------------------------
31
32 If you have checked this out from Subversion, you need to have:
33 * automake >= 1.9
34 * autoconf >= 2.52
35 * gettext >= 0.12
36 Then type "./autogen.sh" to build the needed configuration
37 files and proceed as stated below.
38
39 You will also probably need GNU m4 (perhaps installed as gm4).
40
41 Requirements
42 ------------
43
44 First of all, you will also need a recent C++ compiler, where recent
45 means that the compilers are close to C++ standard conforming.
46 Compilers that are known to compile LyX are gcc 2.95.x and later
47 and Digital C++ version 6.1 and later. Please tell us your experience
48 with other compilers.
49
50 It is _not_ possible to compile LyX with gcc 2.7.x and 2.8.x.
51
52 LyX 1.4.x makes great use of C++ Standard Template Library (STL).
53 This means that gcc users will have to install the relevant libstdc++
54 library to be able to compile this version of LyX. Users of gcc 2.95.x
55 will have to install the STLPort version of these libraries as the
56 ones that come with gcc 2.95.x are too broken for us to use.
57
58 * Qt frontend
59
60 LyX has been tested with Qt 3.x and 4.x. The only special point to 
61 make is that you must ensure that both LyX and the Qt libraries are 
62 compiled with the same C++ compiler.
63
64 Note that if Qt is using Xft2/fontconfig, you may need to install the
65 latex-xft-fonts package (at ftp://ftp.lyx.org/pub/lyx/contrib/) to get
66 maths symbols displayed properly. To find out, type:
67
68         ldd `which lyx` | grep fontconfig
69
70 at the console. Both RH8 and Debian unstable distributions are known
71 to use fontconfig.
72
73 If, however, your version of Qt does not use fontconfig, then TeX
74 fonts should be added to the font path. 'man xset' is your friend.
75
76 * Other things to note
77
78 If you make modifications to files in src/ (for example by applying a
79 patch), you will need to have the GNU gettext package installed, due
80 to some dependencies in the makefiles. You can get the latest version
81 from:
82         ftp://ftp.gnu.org/gnu/gettext/
83
84 To use the thesaurus, you will need to install libAikSaurus, available
85 from:
86         http://aiksaurus.sourceforge.net/
87
88 The two following programs should be available at configuration time:
89
90   o LaTeX2e should be correctly setup for the user you are logged in
91     as. Otherwise, LyX will not be able to run a number of tests. Note
92     that users can run these tests manually with Edit>Reconfigure.
93
94   o Python 2.3 or newer installed to be able to import older LyX files
95     with the lyx2lyx script (this script is called automatically when
96     opening a file).
97
98
99 Creating the Makefile
100 ---------------------
101
102 LyX can be configured using GNU autoconf utility which attempts to guess
103 the configuration needed to suit your system.  The standard way to use it
104 is described in the file INSTALL.autoconf.  In most cases you will be able
105 to create the Makefile by typing
106
107   ./configure
108
109 For more complicated cases, LyX configure takes the following specific
110 flags:
111
112   o --with-frontend=FRONTEND that allows to specify which frontend you
113     want to use. There is no default value: this switch is required.
114
115   o --with-extra-lib=DIRECTORY that specifies the path where LyX will
116     find extra libraries (qt4) it needs. Defaults to NONE
117     (i.e. search in standard places). You can specify several
118     directories, separated by colons.
119
120   o --with-extra-inc=DIRECTORY that gives the place where LyX will find
121     extra headers.  Defaults to NONE (i.e.  search in standard places).
122     You can specify several directories, separated by colons.
123
124   o --with-extra-prefix[=DIRECTORY] that is equivalent to
125        --with-extra-lib=DIRECTORY/lib --with-extra-inc=DIRECTORY/include
126     If DIRECTORY is not specified, the current prefix is used.
127
128   o --with-version-suffix will install LyX as lyx-<version>, e.g. lyx-1.4.1
129     The LyX data directory will be something like <whatever>/lyx-1.4.1/.
130     Additionally your user configuration files will be found in e.g.
131     $HOME/.lyx-1.4.1
132
133     You can use this feature to install more than one version of LyX
134     on the same system. You can optionally specify a "version" of your
135     own, by doing something like :
136        ./configure --with-version-suffix=-latestsvn
137
138     Note that the standard configure options --program-prefix,
139     --program-suffix and the others will not affect the shared LyX
140     directory etc. so it is recommended that you use --with-version-suffix
141     (or --prefix) instead.
142
143   o --enable-optimization=VALUE enables you to set optimization to a
144     higher level as the default (-O), for example --enable-optimization=-O3.
145
146   o --disable-optimization - you can use this to disable compiler
147     optimization of LyX. The compile may be much quicker with some
148     compilers, but LyX will run more slowly.
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 a somewhat smaller code.
155
156   o --with-included-gettext forces the use of the included GNU gettext
157     library, although you might have another one installed.
158
159   o --with-catgets allows to use the catget() functions which can
160     exist on your system.  This can cause problems, though. Use with
161     care.
162
163   o You can also set the environment variable LINGUAS to a list of
164     language in case you do not want to install all the translation
165     files. For example, if you are only interested in German and
166     Finnish, you can type (with sh or bash)
167         export LINGUAS='de fi'
168     before running configure.
169
170 Moreover, the following generic configure flags may be useful:
171
172   o --prefix=DIRECTORY specifies the root directory to use for
173     installation. [defaults to /usr/local]
174
175   o --datadir=DIRECTORY gives the directory where all extra LyX
176     files (lyxrc example, documentation, templates and layouts
177     definitions) will be installed.
178     [defaults to ${prefix}/share/lyx${program_suffix}]
179
180   o --bindir=DIRECTORY gives the directory where the lyx binary
181     will be installed. [defaults to ${prefix}/bin]
182
183   o --mandir=DIRECTORY gives the directory where the man pages will go.
184     [defaults to ${prefix}/man]
185
186   o --enable-maintainer-mode enables some code that automatically
187     rebuilds the configure script, makefiles templates and other useful
188     files when needed. This is off by default on releases, to avoid
189     surprises.
190
191 Note that the --with-extra-* commands are not really robust when it
192 comes to use of relative paths.  If you really want to use a relative path
193 here, you can prepend it with "`pwd`/".
194
195 If you do not like the default compile flags used (-g -O2 on gcc), you can
196 set CXXFLAGS variable to other values as follows:
197
198   o CXXFLAGS='-O2' (sh, bash)
199   o setenv CXXFLAGS '-O2' (csh, tcsh)
200
201 Similarly, if you want to force the use of some specific compiler, you can
202 give a value to the CXX variable.
203
204 If you encounter problems, please read the section 'Problems' at the end of
205 this file.
206
207 In particular, the following options could be useful in some desperate
208 cases:
209
210   o --enable-debug will add debug information to your binary. This
211     requires a lot more disk space, but is a must if you want to try to
212     debug problems in LyX. The default is to have debug information
213     for development versions and prereleases only.
214
215   o --enable-warnings that make the compiler output more warnings during
216     the compilation of LyX.  Opposite is --disable-warnings.  By default,
217     this flag is on for development versions only.
218
219   o --enable-assertions that make the compiler generate run-time
220     code which checks that some variables have sane values. Opposite
221     is --disable-assertions.  By default, this flag is on for
222     development versions only.
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. By default, this flag is on for development
227     versions only.
228
229   o --enable-concept-checks adds some compile-time checks. There is no
230     run-time penalty. By default, this flag is on for development
231     versions only.
232
233   o --without-latex-config that disables the automatic detection of your
234     latex configuration.  This detection is automatically disabled if
235     latex cannot be found.  If you find that you have to use this
236     flag, please report it as a bug.
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 images subdirectory there is also a small icon "lyx.xpm",
256 that can be used to display lyx-documents in filemanagers.
257
258 If configure fails for some strange reason
259 ------------------------------------------
260
261 Even when configure fails, it creates a Makefile.  You always can 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 supports 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
281 Preparing a binary distribution for the use of others
282 ------------------------------------------------------
283
284   o Compile LyX with the right compiler switches for your
285     architecture. Make sure you use the --without-latex-config switch
286     of configure, since others might not be interested by your
287     configuration :-)
288
289   o Create a file README.bin describing your distribution and
290     referring to *you* if problems arise. As a model, you can use the
291     file development/tools/README.bin.example, which can be a good
292     starting point.
293
294   o Type `make bindist'. This will create a file
295     lyx-1.xx.yy-bin.tar.gz. Rename it to reflect you architecture
296     and the peculiarities of your build (e.g. static vs. dynamic).
297
298   o Check that everything is correct by unpacking the distribution
299     in some private place and running it. In particular, check the
300     output of `ldd lyx' to know which libraries are really needed.
301
302   o Upload your binary file to ftp.devel.lyx.org:/pub/incoming, and
303     notify larsbj@lyx.org.
304
305
306 Problems
307 --------
308
309 This section provides several hints that have been submitted by LyX
310 team member or users to help compiling on some particular
311 architectures. If you find that some of this hints are wrong, please
312 notify us.
313
314   o On SUN Sparc Solaris 8, you need gnumake. The LyX makefiles do not
315     work with Solaris make.
316
317     The Solaris ar seg-faults trying to build the insets library. You
318     will need to use the ar from the GNU binutils for this subdirectory.
319
320   o LyX can be compiled on Tru64 Unix with either GNU's gcc or the default
321     Compaq cxx compiler.
322
323     There are no Alpha-specific problems with gcc.
324
325     The following notes all refer to compilation with the Compaq cxx compiler.
326
327     LyX cannot be compiled on Tru64 Unix 4.0d or 4.0e with the default cxx
328     compiler. You should upgrade to at least cxx V6.2, to be found at
329     ftp::/ftp.compaq.com/pub/products/C-CXX/tru64/cxx/CXX622V40.tar. Users
330     running Tru64 Unix 4.0f and greater should have no real problems compiling
331     LyX.
332
333     cxx V6.2 will compile LyX out of the box.
334     cxx V6.3-020 is also known to work, although there is a bug in
335     /usr/include/cxx/deque that will break compilation in FormPreferences.C.
336     Compaq are investigating, but a patch that works /now/ is:
337
338 --- /usr/include/cxx/deque_safe Mon Mar  4 21:09:50 2002
339 +++ /usr/include/cxx/deque      Mon Mar  4 21:09:00 2002
340 @@ -570,9 +570,11 @@
341        {
342          if (size() >= x.size())
343            erase(copy(x.begin(), x.end(), begin()), end());
344 -        else
345 -          copy(x.begin() + size(), x.end(),
346 -               inserter(*this,copy(x.begin(),x.begin()+size(),begin())));
347 +        else {
348 +         const_iterator mid = x.begin() + difference_type(size());
349 +         copy(x.begin(), mid, begin());
350 +         insert(end(), mid, x.end());
351 +       }
352        }
353        return *this;
354      }
355
356     At the time of writing, cxx V6.5-026 is the latest cxx compiler. It is
357     /not/ recommended. The compiler itself appears to be both buggy and
358     extremely bloated (trebling the size of the stripped LyX binary).
359
360     In order to compile LyX with the cxx compiler, you should run configure
361     with the following flags:
362         CXX='cxx -std strict_ansi'
363         CXXFLAGS='-nopure_cname -nocleanup -ptr /tmp/lyx_cxx_repository -O2'
364         CC='cc -std1'
365     The -nopure_cname flag is needed for compilers V6.3 and above because
366     LyX makes use of functions like popen, pclose that are defined in the
367     c version of <stdio.h> but are not formally part of any c/c++ standard.
368     They are not, therefore, included in the <cstdio> header file.