Fix bug 4158.
[lyx.git] / INSTALL
blob0014c4ecae3c48b73e9111878427b2e8072f2b5b
1 Compiling and installing LyX
2 ============================
4 Quick compilation guide
5 -----------------------
7 These four steps will compile, test and install LyX:
9         0) Linux users beware: if compiling the Qt frontend, you need
10            qt4 and qt4-devel packages of the same version to compile LyX.
12         1) ./configure
13            configures LyX according to your system. 
14            When compiling for Qt, you may have to set
15              --with-qt4-dir=<path-to-your-qt4-installation>
16            if the environment variable QTDIR is not set. 
18         2) make
19            compiles the program.
21         3) src/lyx
22            runs the program so you can check it out.
24         4) make install
25            will install it. You can use "make install-strip" instead
26            if you want a smaller binary.
29 Note for Subversion checkouts
30 -----------------------------
32 If you have checked this out from Subversion, you need to have:
33 * automake >= 1.5
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.
39 You will also probably need GNU m4 (perhaps installed as gm4).
41 Requirements
42 ------------
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.
50 It is _not_ possible to compile LyX with gcc 2.7.x and 2.8.x.
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.
58 LyX has been tested with Qt 4.1.5. The only special point to 
59 make is that you must ensure that both LyX and the Qt libraries are 
60 compiled with the same C++ compiler.
62 Note that if Qt is using Xft2/fontconfig, you may need to install the
63 latex-xft-fonts package (at ftp://ftp.lyx.org/pub/lyx/contrib/) to get
64 maths symbols displayed properly. To find out, type:
66         ldd `which lyx` | grep fontconfig
68 at the console. Both RH8 and Debian unstable distributions are known
69 to use fontconfig.
71 If, however, your version of Qt does not use fontconfig, then TeX
72 fonts should be added to the font path. 'man xset' is your friend.
74 * Other things to note
76 If you make modifications to files in src/ (for example by applying a
77 patch), you will need to have the GNU gettext package installed, due
78 to some dependencies in the makefiles. You can get the latest version
79 from:
80         ftp://ftp.gnu.org/gnu/gettext/
82 To use the thesaurus, you will need to install libAikSaurus, available
83 from:
84         http://aiksaurus.sourceforge.net/
86 The two following programs should be available at configuration time:
88   o LaTeX2e should be correctly setup for the user you are logged in
89     as. Otherwise, LyX will not be able to run a number of tests. Note
90     that users can run these tests manually with Edit>Reconfigure.
92   o Python 2.3 or newer installed to be able to import older LyX files
93     with the lyx2lyx script (this script is called automatically when
94     opening a file).
97 Creating the Makefile
98 ---------------------
100 LyX can be configured using GNU autoconf utility which attempts to guess
101 the configuration needed to suit your system.  The standard way to use it
102 is described in the file INSTALL.autoconf.  In most cases you will be able
103 to create the Makefile by typing
105   ./configure
107 For more complicated cases, LyX configure takes the following specific
108 flags:
110   o --with-extra-lib=DIRECTORY that specifies the path where LyX will
111     find extra libraries (qt4) it needs. Defaults to NONE
112     (i.e. search in standard places). You can specify several
113     directories, separated by colons.
115   o --with-extra-inc=DIRECTORY that gives the place where LyX will find
116     extra headers.  Defaults to NONE (i.e.  search in standard places).
117     You can specify several directories, separated by colons.
119   o --with-extra-prefix[=DIRECTORY] that is equivalent to
120        --with-extra-lib=DIRECTORY/lib --with-extra-inc=DIRECTORY/include
121     If DIRECTORY is not specified, the current prefix is used.
123   o --with-version-suffix will install LyX as lyx-<version>, e.g. lyx-1.4.1
124     The LyX data directory will be something like <whatever>/lyx-1.4.1/.
125     Additionally your user configuration files will be found in e.g.
126     $HOME/.lyx-1.4.1
128     You can use this feature to install more than one version of LyX
129     on the same system. You can optionally specify a "version" of your
130     own, by doing something like :
131        ./configure --with-version-suffix=-latestsvn
133     Note that the standard configure options --program-prefix,
134     --program-suffix and the others will not affect the shared LyX
135     directory etc. so it is recommended that you use --with-version-suffix
136     (or --prefix) instead.
138   o --enable-optimization=VALUE enables you to set optimization to a
139     higher level as the default (-O), for example --enable-optimization=-O3.
141   o --disable-optimization - you can use this to disable compiler
142     optimization of LyX. The compile may be much quicker with some
143     compilers, but LyX will run more slowly.
145 There are also flags to control the internationalization support in
146 LyX:
148   o --disable-nls suppresses all internationalization support,
149     yielding a somewhat smaller code.
151   o --with-included-gettext forces the use of the included GNU gettext
152     library, although you might have another one installed.
154   o --with-catgets allows to use the catget() functions which can
155     exist on your system.  This can cause problems, though. Use with
156     care.
158   o You can also set the environment variable LINGUAS to a list of
159     language 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.
165 Moreover, the following generic configure flags may be useful:
167   o --prefix=DIRECTORY specifies the root directory to use for
168     installation. [defaults to /usr/local]
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}]
175   o --bindir=DIRECTORY gives the directory where the lyx binary
176     will be installed. [defaults to ${prefix}/bin]
178   o --mandir=DIRECTORY gives the directory where the man pages will go.
179     [defaults to ${prefix}/man]
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.
186 Note that the --with-extra-* commands are not really robust when it
187 comes to use of relative paths.  If you really want to use a relative path
188 here, you can prepend it with "`pwd`/".
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:
193   o CXXFLAGS='-O2' (sh, bash)
194   o setenv CXXFLAGS '-O2' (csh, tcsh)
196 Similarly, if you want to force the use of some specific compiler, you can
197 give a value to the CXX variable.
199 If you encounter problems, please read the section 'Problems' at the end of
200 this file.
202 In particular, the following options could be useful in some desperate
203 cases:
205   o --enable-debug will add debug information to your binary. This
206     requires a lot more disk space, but is a must if you want to try to
207     debug problems in LyX. The default is to have debug information
208     for development versions and prereleases only.
210   o --enable-warnings that make the compiler output more warnings during
211     the compilation of LyX.  Opposite is --disable-warnings.  By default,
212     this flag is on for development versions only.
214   o --enable-assertions that make the compiler generate run-time
215     code which checks that some variables have sane values. Opposite
216     is --disable-assertions.  By default, this flag is on for
217     development versions only.
219   o --enable-stdlib-debug adds some debug code in the standard
220     library; this slows down the code, but has been helpful in the
221     past to find bugs. By default, this flag is on for development
222     versions only.
224   o --enable-concept-checks adds some compile-time checks. There is no
225     run-time penalty. By default, this flag is on for development
226     versions only.
228   o --without-latex-config that disables the automatic detection of your
229     latex configuration.  This detection is automatically disabled if
230     latex cannot be found.  If you find that you have to use this
231     flag, please report it as a bug.
233   o --with-frontend=FRONTEND that allows to specify which frontend you
234     want to use. The default value is qt4, which is the only available
235     frontend for now.
238 Compiling and installing LyX
239 ----------------------------
241 Once you've got the Makefile created, you just have to type:
243   make all
244   make install
246 All should be OK ;)
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
252   make install-strip
254 BTW: in the images subdirectory there is also a small icon "lyx.xpm",
255 that can be used to display lyx-documents in filemanagers.
257 If configure fails for some strange reason
258 ------------------------------------------
260 Even when configure fails, it creates a Makefile.  You always can check
261 the contents of this file, modify it and run 'make'.
263 Compiling For Multiple Architectures
264 ------------------------------------
266 You can compile LyX for more than one kind of computer at the same
267 time, by placing the object files for each architecture in their own
268 directory.  To do this, you must use a version of `make' that supports
269 the `VPATH' variable, such as GNU `make'.  `cd' to the directory where
270 you want the object files and executables to go and run the
271 `configure' script.  `configure' automatically checks for the source
272 code in the directory that `configure' is in and in `..'.
274 If you have to use a `make' that does not supports the `VPATH'
275 variable, you have to compile LyX for one architecture at a time in
276 the source code directory.  After you have installed LyX for one
277 architecture, use `make distclean' before reconfiguring for another
278 architecture.
280 Preparing a binary distribution for the use of others
281 ------------------------------------------------------
283   o Compile LyX with the right compiler switches for your
284     architecture. Make sure you use the --without-latex-config switch
285     of configure, since others might not be interested by your
286     configuration :-)
288   o Create a file README.bin describing your distribution and
289     referring to *you* if problems arise. As a model, you can use the
290     file development/tools/README.bin.example, which can be a good
291     starting point.
293   o Type `make bindist'. This will create a file
294     lyx-1.xx.yy-bin.tar.gz. Rename it to reflect you architecture
295     and the peculiarities of your build (e.g. static vs. dynamic).
297   o Check that everything is correct by unpacking the distribution
298     in some private place and running it. In particular, check the
299     output of `ldd lyx' to know which libraries are really needed.
301   o Upload your binary file to ftp.devel.lyx.org:/pub/incoming, and
302     notify larsbj@lyx.org.
305 Problems
306 --------
308 This section provides several hints that have been submitted by LyX
309 team member or users to help compiling on some particular
310 architectures. If you find that some of this hints are wrong, please
311 notify us.
313   o On SUN Sparc Solaris 8, you need gnumake. The LyX makefiles do not
314     work with Solaris make.
316     The Solaris ar seg-faults trying to build the insets library. You
317     will need to use the ar from the GNU binutils for this subdirectory.
319   o LyX can be compiled on Tru64 Unix with either GNU's gcc or the default
320     Compaq cxx compiler.
322     There are no Alpha-specific problems with gcc.
324     The following notes all refer to compilation with the Compaq cxx compiler.
326     LyX cannot be compiled on Tru64 Unix 4.0d or 4.0e with the default cxx
327     compiler. You should upgrade to at least cxx V6.2, to be found at
328     ftp::/ftp.compaq.com/pub/products/C-CXX/tru64/cxx/CXX622V40.tar. Users
329     running Tru64 Unix 4.0f and greater should have no real problems compiling
330     LyX.
332     cxx V6.2 will compile LyX out of the box.
333     cxx V6.3-020 is also known to work, although there is a bug in
334     /usr/include/cxx/deque that will break compilation in FormPreferences.C.
335     Compaq are investigating, but a patch that works /now/ is:
337 --- /usr/include/cxx/deque_safe Mon Mar  4 21:09:50 2002
338 +++ /usr/include/cxx/deque      Mon Mar  4 21:09:00 2002
339 @@ -570,9 +570,11 @@
340        {
341          if (size() >= x.size())
342            erase(copy(x.begin(), x.end(), begin()), end());
343 -        else
344 -          copy(x.begin() + size(), x.end(),
345 -               inserter(*this,copy(x.begin(),x.begin()+size(),begin())));
346 +        else {
347 +         const_iterator mid = x.begin() + difference_type(size());
348 +         copy(x.begin(), mid, begin());
349 +         insert(end(), mid, x.end());
350 +       }
351        }
352        return *this;
353      }
355     At the time of writing, cxx V6.5-026 is the latest cxx compiler. It is
356     /not/ recommended. The compiler itself appears to be both buggy and
357     extremely bloated (trebling the size of the stripped LyX binary).
359     In order to compile LyX with the cxx compiler, you should run configure
360     with the following flags:
361         CXX='cxx -std strict_ansi'
362         CXXFLAGS='-nopure_cname -nocleanup -ptr /tmp/lyx_cxx_repository -O2'
363         CC='cc -std1'
364     The -nopure_cname flag is needed for compilers V6.3 and above because
365     LyX makes use of functions like popen, pclose that are defined in the
366     c version of <stdio.h> but are not formally part of any c/c++ standard.
367     They are not, therefore, included in the <cstdio> header file.