FITSWebQL installation instructions

Author: Christopher ZAPART, Japanese Virtual Observatory, NAOJ
For help, to submit bug reports and feature requests please contact the developer directly: chris.zapart@nao.ac.jp
Supported OS: Linux, macOS, Windows 10 Linux Subsystem (Bash on Windows)
IMPORTANT: FITSWebQL has been re-written from scratch in the Rust programming language.

New functionality: FITS data cube preview with real-time streaming video (HEVC format).

Users are encouraged to switch to the new version.

To install the new Rust version please visit the fits_web_ql project on GitHub:

https://github.com/jvo203/fits_web_ql
To install the legacy C/C++ implementation please follow the guide below:

For macOS go here:1

For Linux (Ubuntu 18.04 LTS) go here:2

For Windows 10 go here:3

To just download the latest version, jump to the last section 4

macOS (Sierra)

1.1 GCC compiler, Make and other command-line tools

Open a terminal and type gcc
If there is no GCC installed macOS will prompt you to install xcode-tools from a GUI
Alternatively you can install the GCC compiler from the command-line by typing
xcode-select --install

1.2 Intel SPMD Program Compiler (ispc)

https://ispc.github.io
In the "Downloads" section select the binary for Mac
To install the compiler, place the binary executable "ispc" in your PATH (for example ~/bin/)

1.3 Homebrew package manager

https://coolestguidesontheplanet.com/installing-homebrew-on-macos-sierra-package-manager-for-unix-apps/
Execute the following from the command line (you will be prompted for your password in order to complete the installation):
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

1.4 LLVM with OpenMP support

From the command line type
brew install llvm

1.5 pkg-config

From the command line type
brew install pkg-config

1.6 glib-2.0

From the command line type
brew install glib

1.7 JPEG image library

From the command line type
brew install libjpeg

1.8 x264 encoding library

From the command line type
brew install x264

1.9 CMake

From the command line type
brew install cmake

1.10 Yasm assembler compiler (preferably 1.3.0 and greater)

From the command line type
brew install yasm

1.11 SDL and SDL_image libraries

From the command line type
brew install SDL SDL_image

1.12 Libmicrohttpd HTTP library

From the command line type
brew install libmicrohttpd

1.13 uWebSockets library

https://github.com/uNetworking/uWebSockets
From the command line
brew install openssl zlib libuv
Then in the uWebSockets website click on the green link "Clone or download", "Download ZIP"
Extract the folder "uWebSockets-master" into your home directory ("~/")
From the command line type
cd uWebSockets-master
make
sudo make install

1.14 jemalloc memory allocator

http://jemalloc.net
From the command line type
brew install jemalloc

1.15 BPG (Better Portable Graphics) image library

https://bellard.org/bpg/
Download and uncompress libbpg-0.9.8.tar.gz to your home directory (for example /Users/chris/)
From the command line execute the following steps:
cd /Users/chris/libbpg-0.9.8
Edit the Makefile and uncomment (enable) the option "CONFIG_APPLE=y" edit the Makefile and comment out (disable) the option "USE_BPGVIEW=y" (add '#': #USE_BPGVIEW=y), then
make
sudo make install
Finally, go to the last section 4 in order to complete the installation.

Linux (Ubuntu 18.04 LTS)

2.1 GCC compiler, Make and other command-line tools

Open a terminal and type
sudo apt-get install build-essential

2.2 Intel SPMD Program Compiler (ispc)

https://ispc.github.io
In the "Downloads" section select the binary for Linux
To install the compiler, place the binary executable "ispc" in your PATH (for example ~/bin/)

2.3 glib-2.0

From the command line type
sudo apt-get install libglib2.0-dev

2.4 JPEG image library

From the command line type
sudo apt-get install libjpeg-dev

2.5 BSD utilities library

From the command line type
sudo apt-get install libbsd-dev

2.6 x264 encoding library

From the command line type
sudo apt-get install libx264-dev

2.7 CMake

From the command line type
sudo apt-get install cmake

2.8 Yasm assembler compiler (preferably 1.3.0 and greater)

http://yasm.tortall.net/
From the command line type
sudo apt-get install yasm

2.9 Libmicrohttpd HTTP library

https://www.gnu.org/software/libmicrohttpd/
Download libmicrohttpd-latest.tar.gz, unpack into your home directory
From the command line type
cd libmicrohttpd-0.9.59
./configure
make
sudo make install
If the latest version is causing problems you may try using libmicrohttpd-0.9.55 which is known to have been quite stable

2.10 uWebSockets library

https://github.com/uNetworking/uWebSockets
From the command line
sudo apt-get install libssl-dev zlib1g-dev
Then in the uWebSockets website click on the green link "Clone or download", "Download ZIP"
Extract the folder "uWebSockets-master" into your home directory ("~/")
From the command line type
cd uWebSockets-master
make
sudo make install

2.11 jemalloc memory allocator

http://jemalloc.net
From the following website download the latest release (for example jemalloc-5.1.0.tar.bz2):
https://github.com/jemalloc/jemalloc/releases
Unpack it into your home directory
From the command line type
cd jemalloc-5.1.0
./configure
make
sudo make install

2.12 PNG image library version 1.6 and later

From the command line type
sudo apt-get install libpng-dev
(ubuntu 16.04: libpng16-dev)

2.13 BPG (Better Portable Graphics) image library

https://bellard.org/bpg/
Download and uncompress libbpg-0.9.8.tar.gz to your home directory
From the command line execute the following steps:
cd libbpg-0.9.8
Edit the Makefile and comment out (disable) the option "USE_BPGVIEW=y" (add '#': #USE_BPGVIEW=y), then
make
sudo make install

2.14 libcurl

https://curl.haxx.se/libcurl/
From the command line type
sudo apt-get install libcurl4-openssl-dev

2.15 NUMA

From the command line type
sudo apt-get install libnuma-dev

2.16 sqlite3

From the command line type
sudo apt-get install libsqlite3-dev
Finally, go to the last section 4 in order to complete the installation.

Windows 10 Ubuntu Linux Subsystem (Bash on Windows)

FITSWebQL can be compiled within the Bash on Windows environment.
Follow the Microsoft guide and install bash.
https://msdn.microsoft.com/ja-jp/commandline/wsl/install_guide
Then open the bash terminal, make sure you are in your home directory (i.e. /home/your_username) and follow the steps from the previous section "Linux (Ubuntu 18.04 LTS)2".
Finally, go to the last section 4 in order to complete the installation.

FITSWebQL (common for all platforms)

Download and unpack in your home directory the following gzipped tar archive:
http://jvo.nao.ac.jp/~chris/fitswebql-1.1.14.tar.gz (2018年05月18日)
Enter the FITSWebQL source directory (i.e. cd FITSWebQL)
From the command line type
make local
Assuming no compilation errors, launch FITSWebQL by typing
./fitswebql
[Bash on Windows]: Windows filesystem can be accessed from /mnt/c in bash. Using the cp command FITS files to be viewed need to be copied from the Windows filesystem to the Bash on Windows Ubuntu filesystem (for example “~/” inside of Bash on Windows).
Point your web browser to
http://localhost:9080
Navigate your filesystem and click on a FITS file that you wish to view.
To *SHUTDOWN* the fitswebql process, press Ctrl+C in the bash terminal where fitswebql is running

COMMENTS, RESTRICTIONS

In the “3D Surface” view mode the automatic JavaScript garbage collection does not seem to release fully large WebGL memory buffers, resulting in out-of-memory web browser freezes after using the 3D view mode a few times. In due time the issue will be investigated and (hopefully) resolved.