Menu

Compiling Log in to Edit

Benito van der Zander Tim Hoffmann Mancuso Raffaele Johannes Kalliauer
There is a newer version of this page. You can find it here.

This page contains some information on how to compile TeXstudio on different platforms.

General dependancies

You need the following libraries to compile TeXstudio:

  • Qt (The morst recent 4.x version is recommended (currently 4.8.x). However it should work with Qt >= 4.4. Please notify us if compilation against some Qt >= 4.4 fails because we don't regularly check on all platforms.)
  • Poppler, if you want to use the internal pdf viewer
  • Phonon, if you want to watch movies in the internal pdf viewer

You can set the path to the libraries by passing INCLUDEPATH=<your path> LIBS=<your path> to qmake

Windows

Prerequisites

  • Recent Qt SDK available from qt.nokia.com (Most recent (Qt 4.8.x) recommended. However older versions should work, too.)
  • If you want to compile the most recent code, you need to check out from the mercurial repository. For this you need a Mercurial client, e.g. TortoiseHG. Then create an empty directory and check hg.code.sf.net/p/texstudio/hg into this directory.
  • You need to copy all dll files from a recent texstudio installation into your build directory (This is the directory in which texstudio.exe will be created. It depends on your setting in QtCreator.) You may skip this step and perfrom it later after setting up the build in QtCreator. If the dlls are not in the correct directory, the build will fail with a message on missing dlls.

Setting up

When you open texstudio.pro for the first time in QtCreator, it will ask you for the targets. The default settings are fine. This creates a debug and a relase target.

Debug Version

No further settings are required to build and run the application. However this is not suited for distribution, because the application will depend on the debug versions of the Qt dlls. For a distributable version you should build a relase version.

Recent QtCreator documentation suggests that debugging now works out of the box (I have not tested this so far. Please confirm if you tried it).

Formerly one needed to setup the debugger manually. This is what I did: If you do not only run the application but run it through a debugger, you will need to additionally setup a debugger. For the mingw toolchain, this would be the gdb (python-based version supplied with Qt SDK. It may be that the automatic detection selects the native mingw gdb, which won't work with Qt Creator. In that case you would have to select the python-based version in the options yourself (in my case that was C:\QtSDK\pythongdb\python_2.7based\gdb-i686-pc-mingw32.exe).

Release Version

Release settings To build a release version, make needs a relase command line argument. This is done in Build Settings -> Make -> Make arguments (see image to the right).

Compile

  • Start QtCreator.
  • Open texstudio.pro
  • Optionally change the target (debug/release).
  • Build texstudio. (Strg+B in Qt Creator)
  • if "libzlib.dll" is not found by the linker (in the build step), try to set an aboslute reference. Change in texstudio.pro "LIBS += -lzlib \" to "LIBS += C:\yourPath\libzlib1.dll \"

Start

  • Start texstudio.exe (Strg+R in Qt Creator)

Building on multiple cores

To speed up the compilation process by running it on multiple cores, you may optionally use jom instead of mingw-make. See 1.

Linux

Compiling on Linux is very easy, because you can find all needed libraries in your package manager.

After installing the development versions of Qt, Poppler and Phonon (latter two optionally), there are various ways to compile it:

  • You can call "qmake; make" and "make install" to install it
  • Or you can call "./BUILD.sh"
  • Or you can open texstudio.pro in Qt Creator and build it there
  • Or you can use a compile tool of your distribution, if it provides one

Ubuntu

The following was reported to download and compile the TXS 2.6.6 Version under Ubuntu 12.04 (when newer versions of TXS are released this will probably also work when exchanging the version numbers below with the most recent ones):

apt-get install build-essential debhelper devscripts libpoppler-qt4-dev
wget 'http://sourceforge.net/projects/texstudio/files/texstudio/TeXstudio 2.6.6/texstudio-2.6.6.tar.gz/download' --output-document=texstudio-2.6.6.tar.gz
cp texstudio-2.6.6.tar.gz texstudio_2.6.6.orig.tar.gz
tar -xf texstudio-2.6.6.tar.gz
cd texstudio*
debuild

Mac

Overview

On Mac you need to install XCode with its command line tools first. Then install homebrew and run the following commands in the terminal:

brew install pkg-config
brew install cmake
brew install qt
brew install hunspell
brew install poppler --with-qt4 --enable-xpdf-headers

It is also a good idea to install svn command line tools.

Next go to the TeXstudio source folder in the terminal and call "qmake" and then "make". Alternatively you can use the ./BUILD.sh script. Now the texstudio.app should be in your source folder.

Step by Step

The following step-by-step instructions have been reported to work (thanks Robert Diaz):

  1. Obtain command_line_tools_for_xcode_os_x_mountain_lion_aug_2012.dmg
  2. Obtain XQuartz-2.7.2.dmg
  3. Obtain qt-creator-mac-opensource-2.5.2.dmg
  4. Obtain home-brew by:

    1. Open terminal located in /Applications/Utilities/ and
    2. Obtain homebrew by running in terminal (copied from http://mxcl.github.com/homebrew/):
      ruby <(curl -fsSk https://raw.github.com/mxcl/homebrew/go)

    3. configure homebrew by running in terminal:
      brew doctor

    4. correct anything recommended by brew doctor such as:
      sudo chown -R username

      (any directory needing this operation)

      (keep correcting until brew doctor gives you this message: Your system is raring to brew. )

    5. run in terminal:
      brew update

    6. and brew upgrade if need be.

  5. In terminal run (copied from http://mxcl.github.com/homebrew/):
    brew install wget
    cd /usr/local
    find Cellar
    ls -l bin

  6. This takes a while in terminal:
    brew install -v poppler --with-qt4 --enable-xpdf-headers

  7. Obtain SVN source code from http://texstudio.svn.sourceforge.net/viewvc/texstudio/trunk/
    click the "Download GNU tarball" on the bottom of the page

  8. As of this time SVN 3128 the following should be done in Qt Creator: (On OSX 10.8 starting Qt Creator requires going to system preferences, security and privacy, unlock (lover left hand corner): Allow applications downloaded from anywhere to open: Qt Creator)

  9. In texstudio.pro change the line 251 (after CONFIG += link_prl \ ) to:
    x86_64

  • In terminal set the directory to: cd (path to trunk, after being decompressed of course)
  • In terminal run: sudo sh build.sh hit return four times to answer questions to default.
  • Optional (if you want a DMG file to use on other computers running OSX 10.8) sudo macdeployqt texstudio.app -dmg