The Windows Subsystem for Linux (WSL) is a new feature of Windows 10 (1) that allows you to run native Linux programs directly on Windows, alongside other Windows applications.
When WSL is enabled, it installs an Ubuntu user-mode image that was created by Canonical, the company behind Ubuntu Linux. It loads and runs the Linux Bash shell and provides many of the command-line tools that you would expect when running Ubuntu Linux. It is based on the Ubuntu 14.04.5 LTS release.
It is easy to install. (2, 3, 4) Turn on developer mode and then enable the Windows Subsystem for Linux feature.
It will then download and install WSL and provide a new application called Bash on Ubuntu on Windows.
Launching it will open a Bash shell that provides most of the commonly used Linux command-line tools like ls, cd, grep and applications such as the vim text editor.
You can install additional Ubuntu applications using the apt-get command. The filesystem layout is what you would expect under Linux, with the Windows drives available under /mnt.
X11 And Graphical Applications
WSL doesn't officially support graphical applications, but some people have installed a separate X11 server and found that it works. (5)
I downloaded and installed the Xming X server for Windows. (6) After launching Xming from the Start menu, I set the DISPLAY environment variable from the Bash shell:
I was then able to run a number of X11 applications.
My preferred Linux text editor, emacs, did not work (it did work in text mode) but some basic X11 applications (installed using sudo apt-get install x11-apps) all seemed to work quite well. The Firefox browser is reported to work.
I thought it would be interesting to try building Qt inside WSL. I followed the standard procedure for building Qt 5.8.0 on Ubuntu Linux (7), installing the dependencies it needs and then running configure and make.
Once all the correct dependencies were installed, the configure program ran correctly and I was able to build all Qt modules with the exception of the very large qtwebengine where I encountered some out of memory errors.
I was pleased to see that with the X server running and using Qt's xcb back end, Qt Designer, Qt Assistant, and most of the Qt widget and QML demos that I tried ran successfully.
Perhaps pushing my luck, I then tried building the Qt Creator IDE. While it successfully built, running it just resulted in a black window. Qt Creator reported an error about QSharedMemory, which likely isn't supported under WSL, so that might have been the cause of the problem but it would require more investigation.
The Windows Subsystem for Linux is currently considered a Beta release. In my short time using it, it seemed quite stable. I did have to restart it a few times when it started reporting out-of-memory errors during large Qt compiles, but general use of the Bash shell seemed quite reliable.
WSL can be useful if you want a Linux-like environment on Windows, including the ability to run scripts and tools like grep, find, awk, sed, etc. I found it particularly useful to be able to use ssh to copy files from another machine over the network.
If you prefer working in the Linux environment and have to use Windows, I would encourage you to try it out.
- Bash on Ubuntu on Windows, Microsoft MSDN website, https://msdn.microsoft.com/en-us/commandline/wsl/about
- Installation Guide, Microsoft MSDN website, https://msdn.microsoft.com/en-us/commandline/wsl/install_guide
- How to Install and Use the Linux Bash Shell on Windows 10, How-To Geek website, http://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/
- Everything You Can Do With Windows 10’s New Bash Shell, How-To Geek website, http://www.howtogeek.com/265900/everything-you-can-do-with-windows-10s-new-bash-shell/
- Windows 10's Bash shell Can Run Graphical Linux Applications, PC World website, http://www.pcworld.com/article/3055403/windows/windows-10s-bash-shell-can-run-graphical-linux-applications-with-this-trick.html
- Xming X Server for Windows, Xming project website, https://sourceforge.net/projects/xming/
- How to Compile Qt from Source Code on Linux, ICS blog post, https://www.ics.com/blog/how-compile-qt-source-code-linux