Skip to content

Latest commit

 

History

History
179 lines (129 loc) · 7.68 KB

File metadata and controls

179 lines (129 loc) · 7.68 KB

Linux Build Guide

If you have not cloned the jasp-desktop repository, please head back to the build introduction, and after cloning the repo, and updating the submodules continue with the rest of this article.

Requirements

  • Libraries

    • autoconf^1
    • bison^1
    • boost (>=1.78)^1
    • cmake (>3.21)^1
    • gcc^1
    • gcc-fortran^1
    • git^1
    • glpk
    • flex^1
    • jags^1,2^
    • jsoncpp (>=1.9)^1
    • libarchive (>=3.5)
    • openssl (1.1.1m)^1
    • patchelf^1
    • readstat^2
    • sqlite^1
    • V8 (for jaspProcess)
    • zlib^1
    • freexl^1
  • Qt (>= 6.7)

    • Qt Creator 13

1: make dependencies (i.e., required for building but not for running JASP)

2: On Linux JASP's CMake script will download and install ReadStat and JAGS for you when necessary.

Installing Dependencies

Based on your system, you can install the mentioned libraries using your package manager.

On Ubuntu, you can use apt.

sudo apt install libboost-dev libjsoncpp25 libjsoncpp-dev libarchive13 libarchive-dev libxcb-xkb-dev libxcb-xkb1 libxcb-xinerama0 libxcb-cursor0 libxkbcommon-dev libxkbcommon-x11-dev autoconf zlib1g zlib1g-dev cmake gfortran build-essential flex libssl-dev libgl1-mesa-dev libsqlite3-dev r-base libglpk-dev libminizip-dev libfreexl-dev

⚠️ Some of these libraries might not be up-to-date and as a result JASP will complain. If this happens, you need to download, make and install those libraries individually. Alternatively, you can use the Linux version of Homebrew and install the up-to-dated libraries locally.

On Manjaro / Arch

sudo pacman -Syu autoconf bison boost cmake gcc gcc-fortran git glpk flex jags jsoncpp libarchive openssl patchelf r readstat zlib
# JAGS and Google's V8 are only available through the aur
# Note that only jaspProcess requires V8 and V8 takes a lot of time to compile
# To install them using the `yay` aur helper run:
yay -Syu jags v8-r

On Fedora/RHEL

sudo dnf group install "C Development Tools and Libraries"
sudo dnf install cairo-devel gsl-devel readline-devel readstat-devel gfortran libXt-devel libcurl-devel boost-devel lapack-devel libsqlite3x-devel openssl-devel libarchive-devel mesa-libGL-devel libxkbcommon-devel boost-static harfbuzz-devel fribidi-devel freetype-devel libpng-devel libtiff-devel libjpeg-devel cairo-devel mpfr-devel glpk-devel

We recommend you compile and install R from source to a location in your home folder and set this installation path in the CUSTOM_R_PATH CMAKE variable.

Additionally recommend you install JAGS from source and do not make use of platform binaries which may be provided by your distro. If needed you can add the JAGS path to the CMAKE_PREFIX_PATH variable.

Qt Framework and Qt Creator

You also need Qt Creator and Qt 6 to be able to build and test JASP's libraries and GUI. For this,

  • You need to download and install the Qt installer from Qt website.
  • After downloading the installer, run the installer and make sure that the following packages are selected for installation
    • Qt
      • Qt 6.7.0 (or newest stable Qt)
        • Desktop gcc 64-bit
        • Qt 5 Compatibility Module
        • Qt Shader Tools
        • Additional Libraries
          • Qt Web Engine
          • Qt Web Channel
          • Qt Positioning
      • Developer and Designer Tools
        • Qt Creator 13
        • Qt Creator 13 Debug Symbols
        • CMake
        • Ninja

Dependencies

On Linux JASP's CMake script will download and install ReadStat, JAGS and FreeXL for you when necessary.

Installing Qt Creator / Qt

Similar to Windows and macOS, you can download and install the Qt Framework from Qt website, here.

💡 Sometimes, dependeing on your Linux distribution, you might be able to get the Qt libraries using your package manager. For instance, if you are running any variant of an Arch Linux, e.g., Manjaro, pacman readily offers the latest build of the Qt libraries, and you can download it by running the following command, pacman -Syu qt6.

Configuring and Building JASP Desktop

After installing all the libraries and the Qt library, open the Qt Creator, and open the jasp-desktop/CMakeLists.txt. This initiates the configuration of the jasp-desktop/.

On Linux, you can configure the jasp-desktop to use a custom R installation on your system, to do so, you can set the CUSTOM_R_PATH variable to the home of your R installation, e.g., /usr/lib64/R.

In addition, if you do not wish to pollute your custom library directory, you can construct CMake to install all its libraries into the build folder. You can do this by setting the LINUX_LOCAL_BUILD to ON. In this case, JASP creates a new directory at <build-folder>/R/library and installs everything there.

Module Bundles

Each module is now delivered through our own R binary package repo. For Windows and MacOS we have some assurances on easily available binary packages from CRAN so we can prepackage these bundles and make them available via our own servers. However these are not available for linux, so you will have to roll your own. To make this a bit easier we have placed some scripts in jasp-desktop/Tools, which can be just to build one or more bundles easily.

Building All Modules

Often when building JASP you want to have all modules available to you. The following commands and a good deal of patience will get you there:

cd jasp-desktop/Tools
./buildAllDefaultJaspModules.sh

This will create a folder jasp-desktop/Tools/ModuleBundleBuildDir/Modules/ where it will clone all the modules JASP offers. After cloning all of these modules it will build and install them all to jasp-desktop/Modules/local making them available for each build of JASP, even if you cleaned the buildfolder completely.

Building Some Modules

The previously mentioned script achieves the build of each module by calling ./buildModuleBundlesLocally.sh ModuleBundleBuildDir/Modules/* in Tools. If you want to reinstall those modules (possibly after checking out different commits in there) you can of course run that line yourself. And suppose you have a module installed anywhere and you would like to simply build and install only that module you can run ./buildModuleBundlesLocally.sh /path/to/your/module.

Using the VS Code Dev Container

The repository includes a ready-to-use Dev Container that provides all build dependencies (CMake, Ninja, R, JAGS, Qt 6.8.3, …) preconfigured.

Prerequisites

  • Docker or a compatible container runtime
  • VS Code with the Dev Containers extension

Open in the Dev Container

  1. Open the jasp-desktop folder in VS Code.
  2. When prompted, select “Reopen in Container” (or open the Command Palette and run “Dev Containers: Reopen in Container”).
  3. First start will:
    • Initialize submodules
    • Detect a Conan profile

Build & run inside the container

You can build either with terminal, by opening a new terminal and:

mkdir ~/.config
export GITHUB_PAT=<your GitHub token>
export Qt6_DIR=/opt/Qt/6.8.3/gcc_64/lib/cmake
CMAKE_PREFIX_PATH=/opt/Qt/6.8.3/gcc_64/lib/cmake/ cmake -GNinja  -S . -B jasp-build
cmake --build jasp-build --target all -j6

# Start JASP desktop application
./jasp-build/Desktop/JASP --safeGraphics
QTWEBENGINE_REMOTE_DEBUGGING=8123 ./jasp-build/Desktop/JASP --safeGraphics 
# In Chrome or Edge, open http://localhost:8123 to inspect the webengine process

If X11 says no then allow local X clients:

xhost +local:
# and try again

If you see the JASP window is fully black then resize the window to force a redraw.

You can also use QT creator with

/opt/Qt/Tools/QtCreator/bin/qtcreator