-
Notifications
You must be signed in to change notification settings - Fork 351
Compiling
This page contains some information on how to compile TeXstudio on different platforms.
You need the following libraries to compile TeXstudio:
- Qt (Qt 5.9.x version is recommended,latest is 5.10.x, but it contains bugs in the structure view). However it should work with Qt >= 4.4.
- 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
- Recent Qt SDK available from qt.io (Qt 5.9.x recommended, working on Qt 5.12. However older versions should work, too.). Install QtScript and MinGW 32-bit components from the desired Qt version.
- 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
.
- You need to copy all dll files from a 2.12.6 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.
- Altenative steps:
- Build the project copying into the build folder zlib1.dll, libpoppler-qt5.dll and libpoppler.dll from a working TeXstudio installation. That build may not run correctly but will generate a .exe file.
- From the build folder, execute
C:\Qt\5.X.X\mingwXX_32\bin\windeployqt.exe
. from a PowerShell or cmd prompt (replace path with your own installation). You may need to add to PATH windows environmental variable the MinGW and compilers bin paths (C:\Qt\5.X.X\mingwXX_32\bin
andC:\Qt\Tools\mingwXXX_32\bin
). This will resolve the Qt dll dependencies. - Now build again or run from QtCreator
Newer builds by us are generated via mxe.cc on linux. poppler is statically linked into the binary thus no newer dll is available.
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 target may not compile in Windows because of undefined reference to txs_assert. In this case, you need to pass qmake the command line argument NO_CRASH_HANDLER=1
(see image below). Note that if your build fails because of this error, you need to clean before building again with the argument.
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 release 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).
To build a release version, make needs a release command line argument. This is done in Build Settings -> Make -> Make arguments (see image below).
- 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 texstudio.exe (Strg+R in Qt Creator)
To speed up the compilation process by running it on multiple cores, you may optionally use jom instead of mingw-make. See 1.
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
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 qtbase5-dev qt5-default qt5-qmake libqt5svg5-dev qtscript5-dev qttools5-dev libpoppler-qt5-dev zlib1g-dev pkg-config
wget 'https://github.com/texstudio-org/texstudio/archive/2.12.8.tar.gz' --output-document=texstudio-2.12.8.tar.gz
cp texstudio-2.12.8.tar.gz texstudio_2.12.8.orig.tar.gz
tar -xf texstudio-2.12.8.tar.gz
cd texstudio*
debuild
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.
For building the debug version, there seems to be an issue with Qt5UiTools. libQt5Uitools_debug.a
is missing. A easy work-around is to copy libQt5Uitools.a
to libQt5Uitools_debug.a
. (Probably not true for Qt6)
Optional (if you want a DMG file to use on other computers running OSX 10.8)
/usr/local/opt/qt6/bin/macdeployqt texstudio.app -dmg