Guides/Compiling Jqt/Linux

From J Wiki
Jump to: navigation, search
Windows | Linux

Compiling Jqt on Linux

You can compile your own version of Jqt on Linux, for example to:

  • use a later version of Qt than the distribution.
  • add new functions to Jqt
  • restrict the set of Qt libraries required

For example, the distributed Jqt uses Qt 5.5.1, while the webengine support requires Qt 5.6 and later.

Slim versions of Jqt are available from . These binaries remove the functionality for websockets, webengine, qml, multimedia, and opengl, and eliminate the need for the corresponding Qt libraries. By compiling your own Jqt, you can selectively remove one or more of the above functions by editing in the Jqt source.

You will need the usual Linux compiler, e.g. in Debian/Ubuntu install package build-essential.

Install the Qt SDK

Get Qt using the Qt Online Installer for Linux. This requires a (free) Qt Account, and allows you to choose the Qt versions to be installed, as well as to update the installation later on.

Browse to Get Qt, select and download the the Open Source installer (or Commercial installer if necessary for your application). Run the Qt Online Installer, which presents a list of Qt versions. You can install anywhere on the machine, for example in /opt/qt.

The official J distribution is based on Qt 5.5.1. In theory you can use any version, but note that some Qt versions may require later versions of other non-Qt files than are available in your distribution, and the compilation will fail. If so, then try using an earlier version of Qt.

For example, on the author's machine running Linux Mint 18.3 (based on Ubuntu 16.04), the Qt version 5.9.4 worked properly.

The components below should be selected (if available), and any others as required:

Desktop gcc 64-bit
Qt Charts
Qt Data Visualization
Qt WebEngine

Download latest qtide source

Obtain the latest Jqt source from the Git repository, and install anywhere on your machine, e.g. $HOME/qtide. You can modify the contents of the file qtide/lib/ to selectively remove Jqt functions as needed (how to do so will become obvious from reading the file).

In the qtide source directory create and run a script with contents like:

# run in qtide directory

# set the correct Qt SDK directory:
export QTDIR=/opt/qt/5.9.4/gcc_64

# uncomment this for a slim build:
# export JQTSLIM=1

# other exports defined from QTDIR:
export PATH=$QTDIR/bin:$PATH

S=$(dirname "$0")

cd $S/lib
qmake && make
cd $S/main
qmake && make

The binaries will be in the folder qtide/bin/linux-x86_64\release, and should be copied to your ~bin directory.

After you make changes

If you change the source code, you need to re-make the binaries with your changes. You don't need to rerun qmake; just run make in each directory. You do need to ensure the environment variables shown above are defined correctly.