How to: Install e3 on Windows 10 with WSL

Warning

This page is not fully tested. Some instructions may be incomplete, but are provided as a guide to getting e3 installed in WSL on Windows 10.

Note

WSL does not support RedHat/CentOS/Fedora Linux distros in its online configuration. It is possible to install other distros using the documentation here.

This will allow you to install a CentOS WSL instance, which will be more compatible with the standard OS in use at ESS.

This is a guide to install EPICS on a Windows 10, focusing on either a Debian or Ubuntu Shell.

If you are working in a Windows environment and need to run locally EPICS to test some IOC, most likely you have to install a Linux VM or have a dual-booting machine.

In order to avoid the overhead of a VM or to boot one or the other OS in your machine, you can work with both OS seamlessly, installing a Linux Bash Shell on Windows 10 through Windows Subsystem for Linux (WSL).

In the bash shell you can install all the packages you need via apt commands, including the GNU Linux Compiler Collection and all the libraries you need to compile EPICS.

There is only one caveat at the moment, which is the different way Windows and Linux bind a multicast UDP socket (needed by PV Access; there is no problem with Channel Access).

So even if you are using GCC Linux, since you are not running on a VM, you should use the Windows way to bind socket. At the moment this is not handled in the proper way on EPICS source code, but can be temporarily fixed with a patch on one file (blockingUDPTransport.cpp).

Optionally, if you would like to have also a X Window Server to open Linux GUI, you can install Xming (https://sourceforge.net/projects/xming/)

If you would like to open multiple shells in a console window you can use ConEmu application ( https://conemu.github.io/ )

Step-by-step guide

  1. Install WSL and your preferred Linux Shell (Debian or Ubuntu) (see https://docs.microsoft.com/en-au/windows/wsl/install-win10 )

  2. Once you run the Shell, it will ask you to create a UNIX username/password.

  3. Update the system:

    [iocuser@host:~]$ sudo apt-get update
    [iocuser@host:~]$ sudo apt-get upgrade
    
  4. Install the packages you need via apt-get. Install the packages needed for EPICS as explained in the GitLab e3 repo. This list has the names for CentOS; for Debian/Ubuntu there will be some packages that are listed under different names (e.g. boost-devel -> libboost-dev). The uname -r option is not useful in this context to install the right Linux headers, but they will be installed automatically as dependencies of other packages.

  5. Follow the instructions to clone and setup e3 but do not compile base; i.e. do only

    [iocuser@host:~/e3]$ bash e3.bash gbase
    [iocuser@host:~/e3]$ bash e3.bash ibase
    
  6. Apply the patch BUDPT.patch:

    Warning

    At the moment, we don’t know where to find the BUDPT.patch file. Until that is resolved, please skip Step 6. All communications with the IOC will be restricted to Channel Access.

    [iocuser@host:~]$ cd <yourepicsdir>/e3-base/epics-base/modules/pvAccess/src/remote
    

    copy the patch file in that directory and do the command:

    [iocuser@host:<yourepicsdir>/e3-base/epics-base/modules/pvAccess/src/remote]$ patch < BUDPT.patch
    
  7. Compile EPICS base:

    [iocuser@host:~/e3]$ bash e3.bash bbase
    
  8. Continue installing requirements and modules

  9. (Optional) if you installed Xming, remember to add this env variable to your .bashrc

    [iocuser@host:~]$ export DISPLAY=localhost:0.0
    
  10. Run your IOC !

If you have issues with WSL2, you can try adding the following to your bashrc:

[iocuser@host:~]$ export DISPLAY=$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):0.0

See https://github.com/microsoft/WSL/issues/4106 for more details.

Note

From the Linux Shell you can access your Windows disk as well, which is usually mounted on /mnt/c.

And you can run also Windows exe files from the shell, like for instance NETSTAT.exe.

Warning

You can access your Linux filesystem from Windows as a network mount, but you should treat it as read-only, else risk damage.