Skip to content

SIRF SuperBuild on Bash on Ubuntu on Windows 10

Kris Thielemans edited this page Jun 18, 2024 · 17 revisions

This page is outdated. When using WSL2, our normal Linux installation instructions apply.

This page explains how to install the SIRF-SuperBuild and its dependencies using a clean install of "Ubuntu Bash for Windows".

Introduction to Ubuntu Bash for Windows (Windows Subsystem for Linux)

Windows 10 users can avoid the hassle of running a virtual machine with "Ubuntu Bash for Windows" (or simply Bash). It provides a bash shell and reasonably complete Linux environment, where most Linux tools can be used directly on Windows.

NB: Windows executables can also be run directly from bash, similar to other hacks such as git-bash, cygwin, MSYS, etc.

Enabling Bash for Windows

Requirements

  • 64-bit Windows 10 with "Anniversary Update (August 2016)" or later

Installation

  • Please follow the installation steps here.

Support of Graphical Applications

While graphical applications are not natively supported on Bash, one can still use an X server.

  1. Install an Xserver
  2. Set environment variable(s)
    • Run the following command in Bash: export DISPLAY=:0
    • Optionally, add the above command to .bashrc or .profile (located within the Bash home directory) to have it automatically executed on all new bash prompts.
      • nano .profile or nano .bashrc, then add the line at the end of the file and save (CTRL X, Y, ENTER).

Basic GUI applications (cmake-gui, gedit) should work fine.

Update Linux subsystem

sudo apt-get update
sudo apt-get upgrade

Now you should be all set to install and run SIRF!

Installation of SIRF using SIRF SuperBuild

The installation steps are basically the same as on Ubuntu (here).

However, I strongly suggest you to use a Windows folder as the installation folder. To do so:

  1. Create an empty folder "devel" in a Windows location, e.g. "Documents".
  2. Create "Documents" folder in Bash if it does not exist already.
    • mkdir -p ~/Documents
  3. Add a symbolic link in Bash
    • ln -s /mnt/c/Users/<YourUsername>/Documents/devel ~/Documents/devel
    • cd ~/Documents/devel

You can continue the installation starting with 1. Install Dependencies for SIRF.

Caveats, Recommendations, Warnings - Please read!

  • DO NOT attempt to modify Linux files in a Windows editor

Do not try to access, modify or remove a file located on the Subsystem from Windows. If you attempt to do so, you will lose your whole Bash installation. Luckily, you can access Windows from the Subsystem without problems as described below.

  • Windows native Python and Matlab cannot be used to build SIRF

Please use Linux native Python only (Matlab does not work on Bash at the moment), to build and run .py scripts.

N.B.: spyder runs smoothly on Bash ; you can run your .py scripts there within a user-friendly graphical interface.

Install it using sudo apt-get install spyder.

  • Create your bash scripts directly on Windows

You can download a text editor on Windows to create your bash files, such as Notepad++. You will have to use Unix line endings (LF) to be able to run a bash script, which are not handled well by window's built-in notepad.

With Notepad++: Settings -> Preferences -> New Document -> Format (Line ending) -> Unix. Converting a pre-existing file to Unix line endings with Edit -> EOL Conversion -> Unix.

  • Use files located in regular Windows folders, and use symbolic links in Bash

As it is very easy to access Windows folders and files from Bash (e.g. C:\Users\<YourUsername>\Desktop is located at /mnt/c/Users/<YourUsername>/Desktop), good practice would be to store as many files as you can in regular Windows locations and either run the commands in /mnt/c/Where/Your/Files/Are or, even easier, use symbolic links: if you use the previously created folder "devel" for all your data and scripts, you will be able to access them in ~/Documents/devel/ from Bash immediately. In this way, you have all the data (input and output images/sinograms) directly accessible in Windows, and you can reprocess/visualise the data with your regular tools: ImageJ, Amide, Matlab, etc.

Acknowledgements

First version created by Elise Emond, May 2017. More information here. Edited by Casper da Costa-Luis, May 2017.