Go to page:

Search:   Help

Navigation

Groups

LyX documentation

Edit

Shared groups

Links

LyX /

LyX on Cygwin

Categories: Cygwin
<< Mac-X11 | Page list | Group map >>

This page describes how to use LyX under Cygwin on Windows by building Qt/Win and LyX from source using cygwin tools. (If you don't want or need to compile LyX yourself, you can download lyx-1.5.X-cygwin.tar.gz from the binary distribution site, un-tar it, and follow the instructions.)

Building Qt and LyX

Note that the procedure outlined here applies to Qt 4.3.3 only. It cannot be used with a different version, unless you adapt the provided patches. Also note that this Qt port has only been tested with LyX and further patches may be needed when using configuration switches different from the ones reported here.

Cygwin packages

We need quite a slew of tools to build Qt and LyX. Be sure to install at least the cygwin packages listed below. Due to a dependency mechanism, all other tools not listed here should also be marked for installation (I hope I forgot nothing).

  • aspell
  • aspell-dev
  • bison
  • bzip2
  • gcc
  • gettext-devel
  • gzip
  • jpeg
  • libpng2
  • libtool1.5
  • m4
  • make
  • minires-devel
  • patch
  • python
  • sed
  • tar

Qt4 Open Source Edition

Grab the Qt sources from Trolltech: ftp://ftp.trolltech.com/qt/source/qt-x11-opensource-src-4.3.3.tar.gz
and unpack the archive somewhere, eg. in /usr/local/src

cd /usr/local/src
tar zxvf /path/to/qt-x11-opensource-src-4.3.3.tar.gz

Now rename the newly created directory

mv qt-x11-opensource-src-4.3.3 qtwin-4.3.3

This step is not strictly necessary, but we will not be building for X11 and in the following instructions it is assumed that the Qt sources are in located in a directory called qtwin-4.3.3 in /usr/local/src. If you unpacked the sources somewhere else, simply replace /usr/local/src in the following directions with whatever is appropriate, but you should anyway perform the renaming as above.

In order to build Qt for cygwin without X11, part of the sources of the native Windows version are necessary. Trolltech distributes them in a separate archive and you should also grab that archive and move the missing files to the above directory. However, for your convenience, I have collected the missing files in a tar archive, so simply follow the next procedure.

  1. Download the qtwin-src-4.3.3.tar.gz archive containing the missing files and unpack it in the same directory where you unpacked qt-x11-opensource-src-4.3.3.tar.gz (you did rename qt-x11-opensource-src-4.3.3 as qtwin-4.3.3, didn't you?)
    cd /usr/local/src
    tar zxvf /path/to/qtwin-src-4.3.3.tar.gz
    
  2. Apply the qt433-cygwin.patch. This patch allows building Qt using native Windows graphics (no X11).
    cd /usr/local/src/qtwin-4.3.3
    patch -p1 < /path/to/qt433-cygwin.patch
    
  3. Configure Qt
    cd /usr/local/src/qtwin-4.3.3
    mkdir build-cygwin
    cd build-cygwin
    
    ../configure -prefix /usr/local/qt/4.3.3 -platform cygwin-g++-win32
        -v -release -static -fast -no-qt3support -no-3dnow -no-sse2 -no-exceptions
        -no-largefile -no-rpath -no-sql-ibase -no-sql-mysql -no-sql-odbc
        -no-sql-psql -no-sql-sqlite -no-nis -no-cups -no-pch -no-opengl -no-glib
    
Note: using the above command line, Qt will be installed in /usr/local/qt/4.3.3. Change this path if you want to install it somewhere else.
  1. Compile only the Qt tools and libraries needed for building LyX
       make sub-moc sub-rcc sub-uic sub-corelib sub-gui
    
  2. Install tools, libraries, and include files in /usr/local/qt/4.3.3
    make sub-moc-install_subtargets sub-rcc-install_subtargets
         sub-uic-install_subtargets sub-corelib-install_subtargets
         sub-gui-install_subtargets
    

You can now move to building LyX.

LyX

  1. Unpack lyx-1.5.X.tar.bz2 in /usr/local/src (replace X to match your archive name)
  2. Configure LyX using the script lyxconfig-cygwin.
    cd /usr/local/src
    /path/to/lyxconfig-cygwin lyx-1.5.X
    
If you installed Qt4 somewhere else than /usr/local/qt/4.3.3, then give the directory where you actually installed it as second parameter
/path/to/lyxconfig-cygwin lyx-1.5.X <qt4dir>
  1. Compile and install LyX
    cd lyx-1.5.X/build-cygwin
    make
    make install
    
  2. Run the packaging script package-lyxcygwin (make sure you are in the top source dir and specify the LyX system directory)
    cd ..
    /path/to/package-lyxcygwin /usr/local/share/lyx
    

MikTeX, ImageMagick, and native converters

When compiled as outlined here, LyX is a cygwin application. This means that it understands both posix and windows paths, but it always generates posix paths. So, if you use the native MikTeX and/or ImageMagick packages, as they are unaware of posix paths, these must be translated to native form.

The only two programs that need this translation are epstopdf (from MikTeX) and convert (from ImageMagick). Here you can download two scripts which take care of the translation: epstopdf, convert. Place them ahead in your PATH (/usr/local/bin is a good choice) such that LyX finds them before the MikTeX and ImageMagick programs. If you use the tetex and imagemagick cygwin packages, you don't need them.

In case you use other native converters, you may call them through the following wrapper script: wrapper.sh. Simply give it the same name as the native application (without any extension) and place it in /usr/local/bin. Now, using a text editor that produces Unix line endings (notepad is not good), go to the last line and change the string command_name to the name of the native application. If such application is not already in the system PATH, use an absolute path, instead (or simply add the path to the application to the "PATH prefix:" entry in Tools->Preferences). The wrapper should be able to deal with the vast majority of native applications and can be easily adapted if it does not exactly fit your needs.

Contributors

  • Enrico Forestieri

History

  • 13 Feb 2006 - Created.
  • 22 Feb 2006 - Updated lyxconfig-cygwin and qt3-cygwin.patch. Added a new patch for path_prefix handling.
  • 23 Feb 2006 - Updated list of required cygwin packages.
  • 24 Feb 2006 - Added a warning about the qt3-devel cygwin package and corrected a typo.
  • 26 Feb 2006 - Added a fix for empty "TeX Information" dialog when using the tetex cygwin package.
  • 12 Apr 2006 - Updated patches and build procedure.
  • 13 Jan 2007 - Updated to cover changes in LyX 1.4.3 and added the winpaths patch.
  • 14 Aug 2007 - Updated for LyX 1.5 and Qt4.
  • 11 Jan 2008 - Updated to Qt 4.3.3.

Cygwin

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2008-04-07 18:05 CEST