Building J from source

The J programming language has pre-built free to use binaries for different operating systems. The J Software people also provide source code in a github repository. The source is licensed under the GPLv3 or a commercial license that you can negotiate with the company. This post outlines how to build a 64-bit version of J from source on a Linux based system.

Building

First step is to clone the source repository and copy the file jsrc/jversion-x.h to jsrc/jversion.h. This file contains the version number and other details that are returned by the 9!:14'' J system call. In the example here I'm using the /tmp directory for storage to make paths shorter for the post - you should use a directory more relevant to where you store source code and builds.

$ cd /tmp
$ git clone https://github.com/jsoftware/jsource
Cloning into 'jsource'...
remote: Enumerating objects: 195, done.
remote: Counting objects: 100% (195/195), done.
remote: Compressing objects: 100% (144/144), done.
remote: Total 16740 (delta 98), reused 96 (delta 50), pack-reused 16545
Receiving objects: 100% (16740/16740), 10.33 MiB | 903.00 KiB/s, done.
Resolving deltas: 100% (13571/13571), done.
$ cd jsource
$ cp jsrc/jversion-x.h jsrc/jversion.h

Building the system on Linux uses shell scripts located in the make subdirectory. Copy make/jvars.sh to somewhere where you can edit it so that it contains paths and other information relevant to your local system. In this example I'm copying it to the /tmp directory.

$ cp make/jvars.sh /tmp/

Edit your copy of jvars.sh so that the following environment variables are correct for your local system:

  • jgit - directory of the jsource that was closed above.
  • jbld - directory where build files will be stored.
  • CC - compiler to use for building the source.

For the setup in this post these entries would be:

jgit=/tmp/jsource
jbld=/tmp/jbld
CC=clang

Create the required jbld directories, source the jvars.sh file so the environment variables are set in the local environment and start the build process:

$ mkdir -p /tmp/jbld/jout /tmp/jbld/j64/bin 
$ . /tmp/jvars.sh
$ $jmake/build_all.sh

The resulting built binaries are now in $jbld/j64/bin:

$ ls /tmp/j64/bin/
jconsole  libjavx2.so  libjavx.so  libj.so  libtsdll.so

The J system requires other files, such as the standard library and addons. Copy these to the build directory with:

$ cp -r $jgit/jlibrary/* $jbld/j64

The J console can now be run using jconsole:

$ $jbld/j64/bin/jconsole
   1 + 2
3

Install Addons

I recommend installing all addons available:

$ $jbld/j64/bin/jconsole
   install'all'
Updating server catalog...
Installing 127 packages
Downloading base library...
Installing base library...
...

Build the Qt IDE

The J developers also provide source for their Qt based IDE. It is in the qtide github project. To clone, build and install:

$ git clone https://github.com/jsoftware/qtide
$ cd qtide
$ ./makeall.sh
...
$ cp -P ./bin/linux-x86_64/release/* $jbld/j64/bin/

Run the IDE with:

$jbld/j64/bin/jqt
Screenshot of jqt and the dissect tool