Skip to content

Compiling

sunderme edited this page Dec 12, 2022 · 32 revisions

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

General dependencies

You need the following libraries to compile TeXstudio:

  • Qt (Qt 6.2.x version is recommended). However it should work with Qt >= 5.9.
  • 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

There two ways of compiling txs on windows which are simple. The easier method is using Qt SDK but it does not contain poppler, so no pdf-previewer is available. The second method uses MSYS2 which allows a complete build but using qtcreator for debugging seems to be difficult.

Method 1: Qt SDK

Prerequisites

  • Recent Qt SDK available from qt.io (Qt 6.2.x). Install "Desktop MinW32" and "Qt5 Compatibility Module".
  • If you want to compile the most recent code, you need to clone from the github repository. For this you need a git client, e.g. TortoiseGit or official client git-win. Then create an empty directory and clone https://github.com/texstudio-org/texstudio.git into this directory. In command line it would be git clone https://github.com/texstudio-org/texstudio.git.

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.

In qmake setting, the additional argument needs to be set to "NO_POPPLER_PREVIEW=1".

Compile

  • Start QtCreator.
  • Open texstudio.pro
  • Optionally change the target (debug/release).
  • Build texstudio. (Strg+B in Qt Creator)

Start

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

Method 2: MSYS2

Prerequisites

  • Install MSYS2
  • start msys2 commandline and install necessary packages: pacman -Syu git make mingw-w64-x86_64-toolchain mingw-w64-x86_64-qt6-base mingw-w64-x86_64-poppler mingw-w64-x86_64-poppler-qt6 mingw-w64-x86_64-qt6-declarative mingw-w64-x86_64-qt6-svg mingw-w64-x86_64-qt6-5compat mingw-w64-x86_64-qt6-tools mingw-w64-x86_64-nsis zip unzip

Setting-up

  • Clone texstudio: git clone https://github.com/texstudio-org/texstudio.git
  • run qmake: cd texstudio;qmake6 texstudio.pro

Compile

  • in texstudio: make -j 8

Start

  • in texstudio: ./texstudio
  • you can run gdb to get better backtraces but the crash handler should also be capable of delivering better backtraces. It is probably possible to use qtcreator with this set-up, but that has not been tried.

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 4.4.1 Version under Ubuntu 18.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 qtbase5-dev qt5-default qt5-qmake libqt5svg5-dev qtdeclarative5-dev qttools5-dev libqt5svg5-dev libpoppler-qt5-dev libpoppler-cpp-dev pkg-config zlib1g-dev libquazip5-dev git cmake
git clone https://github.com/texstudio-org/texstudio.git
cd texstudio
mkdir build
cd build
cmake ..
cmake --build . 
cmake --build . -t install (optional)

Mac

Overview

Compilation on OSX is basically broken as brew deliberately broke the poppler package.

On Mac you need to install homebrew.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Then install some essential packages in the terminal:

brew install qt brew install poppler brew install pkg-config

Next go to the TeXstudio source folder in the terminal:

/usr/local/opt/qt6/bin/qmake texstudio.pro make -j 4

Alternatively you can use the ./BUILD.sh script (if the $PATH is set correctly, not by default). Now the texstudio.app should be in your source folder.

Optional (if you want a DMG file to use on other computers running the same OSX version)

/usr/local/opt/qt6/bin/macdeployqt texstudio.app -dmg

Clone this wiki locally