Skip to content

Compiling

sunderme edited this page May 15, 2024 · 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
  • QtMultimedia, if you want to watch movies in the internal pdf viewer

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.4.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 CMakeLists.txt for the first time in QtCreator, it will ask you for the targets. The default settings are fine. This creates a debug and a release target.

Compile

  • Start QtCreator.
  • Open CMakeLists.txt
  • 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-ucrt-x86_64-toolchain mingw-w64-ucrt-x86_64-qt6-base mingw-w64-ucrt-x86_64-poppler mingw-w64-ucrt-x86_64-poppler-qt6 mingw-w64-ucrt-x86_64-qt6-declarative mingw-w64-ucrt-x86_64-qt6-svg mingw-w64-ucrt-x86_64-qt6-5compat mingw-w64-ucrt-x86_64-qt6-tools mingw-w64-ucrt-x86_64-quazip-qt6 mingw-w64-ucrt-x86_64-hunspell mingw-w64-ucrt-x86_64-cmake

Setting-up

  • Clone texstudio: git clone https://github.com/texstudio-org/texstudio.git

  • run cmake:

              cd texstudio
              mkdir build
              cd build
              cmake ..
    

Compile

  • in texstudio/build: cmake --build . --parallel

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.

Method 3: vcpkg

vcpkg allows debug builds with poppler which can be debugged in qtcreator.

Prerequisites

  • Install vcpkg
  • install necessary packages: vcpkg.exe install poppler[qt]:x64-windows qtbase:x64_windows qtdeclarative:x64-windows qtsvg:x64-windows qt5compat:x64-windows qttools:x64_windows hunspell:x64-windows

(quazip:x64-windows needs to be enhanced to use qt6 ... open )

Setting-up

  • Clone texstudio: git clone https://github.com/texstudio-org/texstudio.git

  • run cmake:

              cd texstudio
              mkdir build
              cd build
              cmake .. -DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake 
    

Compile

  • in texstudio/build: cmake --build .

Start

  • deploy dependencies with [path to vcpkg]/installed/x64-windows/tools/Qt6/bin/windeployqt or windeployqt.debug.batfor debug builds
  • in texstudio: ./texstudio
  • You can run and debug texstudio with qtcreator

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 "mkdir build;cd build;cmake ..;cmake --build ." and "cmake --build . -t install" to install it
  • Or you can call "./BUILD.sh"
  • Or you can open CMakeLists.txt in Qt Creator and build it there

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 more complicated than necessary as brew deliberately broke the poppler package.

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 cairo fontconfig freetype gettext jpeg libpng libtiff little-cms2 nspr nss openjpeg
brew install cmake pkg-config

Build poppler from source

Load source from https://poppler.freedesktop.org unpack source In poppler source folder

mkdir build
cd build
cmake .. -DENABLE_UNSTABLE_API_ABI_HEADERS=ON
cmake --build . --parallel
cmake --build . -t install

Build TeXstudio

Next go to the TeXstudio source folder in the terminal:

mkdir build
cmake ..
cmake --build . --parallel

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