Go to page:

Search:   Help

Navigation

Groups

LyX documentation

Edit

Shared groups

Links

How to compile LyX for Windows

Categories: Windows, Compilation, MSVC
<< | Page list | >>

This pages describes at the moment only the compilation using the compiler Microsoft Visual C++ (called in the following "MSVC"). It is also possible to compile LyX using the compiler MinGW. Note also that currently LyX supports only the compilation of a 32bit version. Compiling a 64bit version is already technically possible but LyX's source code needs to be adapted first.

Compilation of a 32 bit version with MSVC

Prerequisites

At first one needs to install the following programs. To assure that everything is properly in shape after the installation it is recommended to log in to Windows with Admin privileges.

  • Install the 32 bit version of Python 2.x (not Python 3.x !): https://www.python.org/downloads/
  • Install the community version of MSVC 2015: https://www.visualstudio.com/
    (Note: Older versions of the compiler than version 2015 update 2 cannot be used to compile LyX!)
    Make sure that the feature Visual C++ from the section Programming languages is selected for installation.
    MSVC is trialware, meaning you can use it for free for 30 days. To be able to use it as long as you want for free, you need to register it by just creating a Microsoft account. MSVC will tell you the details. Having such an account is harmless.
  • Install the program Git: https://git-scm.com/download/win (You can install the 64bit version if you are on a 64bit Windows.)
    The installer might ask you about line endings - choose the settings proposed for Windows!
  • Install the program TortoiseGit: https://tortoisegit.org/download/ (You can install the 64bit version if you are on a 64 bit Windows.)
    • Install TortoiseGit using all default settings; this is very important! The installer might ask you about line endings - choose the settings proposed for Windows!
  • Install the 32 bit version for VS 2015 of Qt 5.6.x: https://www.qt.io/download-open-source/#section-8
    It is recommended to us the default settings proposed by the installer.
  • Install CMake https://cmake.org/download/#latest (You can install the 64bit version if you are on a 64 bit Windows.)

Retrieving the LyX source code and setup of the Git version control system

To compile LyX you need its source code. This is available via the version control system Git. To pull the sources to a file folder do this:

1. Right-click in the Windows file explorer in a folder of your choice (we assume int he following that you folder is D:/LyXGit/2.2.x) and choose "Git create repository here" from the context menu.

1.1 Use the default settings and thus just click on OK

2. Inside the new folder right-click and choose TortoiseGit→Settings

2.1 There add your name and a valid email address and use these settings:
2.2 There add git@git.lyx.org:lyx into the field URL in the section GIT→Remote and click on APPLY.
2.3 TortoiseGit will now ask something, click YES and then OK. Now the source code is downloaded. This will take some time, just be patient.
2.4 After you get the success message, close this window and also close the TortoiseGit settings window with OK.

3. Inside the new folder right-click and choose TortoiseGit→Pull

3.1 In the field Remote branch click on the button "..." and select a branch of your choice. Since 2.2.x is LyX's current stable version, we will start with this. Thus select there the 2.2.x branch

and click OK twice.
Now the source code of LyX's 2.2.x branch is downloaded.
3.2 After you get the success message, close this window.

Congratulations, the first big hurdle is handled!

Configuring the compilation build system

To tell the compiler what needs to be compiled in what order and with which dependencies, the automated build system CMake needs to be run.

and extract it to a subfolder of your Git folder (e.g. to D:/LyXGit/2.2.x/lyx-windows-deps-msvc2015). This subfolder will later be your so-called GNUWIN path.

Now CMake can be run:

  1. run CMake via Windows Start menu
  2. In the field Where is the source code input youy Git folder that you just created (D:/LyXGit/2.2.x)
  3. In the filed Where to build the binaries insert D:/LyXGit/2.2.x/compile-2015
  4. Click on Configure. CMake will ask you to create a folder, reply with YES.
  5. CMake will ask you for a compiler. Choose Visual studio 14 2015 and press Finish.
  6. CMake will now configure MSVC and output an error because of missing paths. To set the paths, go to the section with red entries.
6.1 In the first entry Ungrouped entries specify the path D:/LyXGit/2.2.x/lyx-windows-deps-msvc2015 as GNUWIN32_DIR.
6.2 In the entry LYX under LyX_USE_QT choose QT5.

7. Click again on Configure. CMake will again output an error because of a missing path.

7.1 In the entry CMAKE specify the path where you installed Qt as CMAKE_PREFIX_PATH. In case of Qt 5.6.1 the path is C:/Qt/Qt5.6.1/5.6/msvc2015

8. Now all paths are specified. Click again on Configure.
9. Click on Generate. Afterwards you can close CMake.

Congratulations, only one hurdle is left!

Compilation

Now you can compile:

  1. Go to the folder D:\LyXGit\2.2.x\development\cmake and change in the file build5-2015.bat these 4 paths:
    set PATH=C:\Qt\Qt5.6.1\5.6\msvc2015\bin;
    set GNUWIN32_DIR=D:\LyXGit\Master\lyx-windows-deps-msvc2015
    set LYX_SOURCE=D:\LyXGit\2.2.x\
    set LYX_BUILD=D:\LyXGit\2.2.x\compile-2015
    to the one of your system.
  2. Save this batch file: http://ftp.lyx.de/Images/MSVC2015-LyX22.bat to your computer where you like it.
    1. Open the file with a text editor and check that the paths in it are the ones of your system.
  3. Execute the batch script by double-clicking on it
  4. In the appearing console window type in build5-2015 install and press return. This will compile LyX in a normal way. This takes several minutes, just be patient.
  5. (If you want to compile LyX so that it can be debugged, type in build5-2015 devel in the console window instead.)

Congratulations, you eventually made it!

Starting LyX

1. Go to the folder D:\LyXGit\2.2.x\compile-2015\bin\Release. There you find the compiled lyx.exe. To be able to start it, you need to copy some DLL files from Qt into this folder. So
2. Copy the files

  • Qt5Core.dll
  • Qt5Gui.dll
  • Qt5Svg.dll
  • Qt5Widgets.dll
  • Qt5WinExtras.dll
  • Qt5Xml.dll

from C:\Qt\Qt5.6.1\5.6\msvc2015\bin to D:\LyXGit\2.2.x\compile-2015\bin\Release.
3. Copy the folders

  • C:\Qt\Qt5.6.1\5.6\msvc2015\plugins\iconengines
  • C:\Qt\Qt5.6.1\5.6\msvc2015\plugins\imageformats
  • C:\Qt\Qt5.6.1\5.6\msvc2015\plugins\platforms

to D:\LyXGit\2.2.x\compile-2015\bin\Release.
4. Start LyX by double-clicking on the lyx.exe.

Windows Compilation MSVC

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2016-07-20 10:21 CEST