Enlarge /. Tux looks surprisingly comfortable in a Windows environment.
Last week, Microsoft and Canonical (the company behind the Ubuntu Linux distribution) were scheduled to host a Windows Subsystem for Linux (WSL) developer conference on Microsoft's Redmond campus. Ars was invited and I had plane tickets in hand – but the physical conference was canceled at the last minute because of the corona virus.
Note that I said the physical conference was canceled – the WSLconf itself continued with 22 speakers and 21 lectures. Virtual attendees were reported to be more than twice the (sold out) physical attendee registration and included developers from around the world. Presentations were held on Bluejeans' video conferencing platform, and Canonical's developer lawyer Hayden Barnes says the recorded sessions will soon be generally available.
What is a WSL? And how do I install it?
Enter features in the start menu of a modern Windows 10 build and open the Windows feature applet.
Activate the Windows subsystem for Linux function.
Restart to complete the installation of the WSL function. Note that you are not done yet. You still need a user environment under WSL.
Start -> enter Store and open the Microsoft Store.
Search for Ubuntu in the Store applet.
We chose the Ubuntu 18.04 environment – but Ubuntu 16.04 is available as well as OpenSUSE, Kali, Debian, and more.
Once the Ubuntu environment has completed the installation, you will have a brand new Ubuntu Linux VM – complete with a mount on your Windows C: drive!
Most Ars readers will already know that there is a Windows subsystem for Linux and that it does … Linux stuff. However, it is less clear how you actually install it or why you want it.
The installation part is simple and free, but it requires two separate steps. First, you need to install WSL as a Windows feature using the Features applet, which you can access directly from the Start menu. This includes a relatively quick download followed by an immediate restart.
Once the WSL function is installed, the next step installs an actual Linux distribution underneath. There are many options available, including Kali, Debian, OpenSUSE, Alpine and two versions of Ubuntu (Long Term Support). We chose the latest Ubuntu LTS. If you search for Ubuntu in the store, it will be displayed immediately and installed with one click (followed by a download of several hundred megabytes).
As soon as the download and installation for Ubuntu 18.04 have been completed, Ubuntu 18.04 LTS is displayed as an app in the start menu. When you click on it, a console window opens that should be immediately known to all Linux users. It is a bash prompt that is in another Ubuntu installation. And it should – under the hood, you'll see a full Ubuntu virtual machine running on Hyper-V.
The main differences between WSL and a standard Hyper-V VM are in the integration. No guest drivers need to be installed, and the C: drive is already provided as read / write access under / mnt / c. You can read and write files easily and seamlessly across operating system boundaries without having to think too much about it.
Now that I know what WSL is, why do I want it?
To demonstrate how easy it is to build Linux and Windows programs within the WSL, we will install some packages.
We created an extremely simple "hello" program in Nim, compiled and executed it. Hello you!
Then we compile the same program with Mingw-w64 and copy its output into our Windows directory under C: User. Presto, Windows program! From Linux!
Let's face it here – if you're not a developer, Linux user, or someone who is already curious about Linux, you probably won't. If you're a Linux user – or Linux curious – WSL is a great way to get your feet wet and experiment freely without having to do a dual boot. This largely replaces older workarounds such as the venerable Cygwin, which provided a partially Linux-like userland environment that is still running on Windows itself.
While it is possible to run some GUI apps (Graphical User Interface) under WSL with an additional X server like MobaXTerm, this is not the current focus of the WSL – at least it is not what the people presenting at WSLconf and are present, most interesting What most developers are enthusiastic about is the simple cross-platform development under WSL.
For demonstration, we created a simple program in Hello World style with Nim. Nim is a parent language that offers easy compilation into standard C code. The C code is then executed by the GCC compiler to generate an executable binary file.
We want to make it clear that Nim is by no means the only way to create cross-platform code on WSL. We just used it here as a clean, quick, and easy way to create a Hello World-style app without a lot of cruft to see what's going on.
Echo "Hello", paramStr (1), "!"
Compiling this nim code creates an executable that takes the first argument and greets the user:
user @ linux: ~ $ nim compile ./hello.nim
(Debug stuff removed)
user @ linux: ~ $ ./hello you
user @ linux: ~ $
If you pass nim and compile some additional arguments, while you are still in the Linux environment, you can instead create an executable Windows file, copy the resulting hello.exe file to your C: drive, and then copy it to Windows itself To run.
C: Users unprivileged> hello.exe you
C: Users not privileged>
This is clearly a very trivial example – but it is not difficult to find much larger and more powerful examples of the same basic technology that is used in much larger environments.
Case Study: EA's Frostbite Engine
By using WSL and Visual Studio, companies can quickly integrate Windows native developers into Linux build environments and significantly simplify their tool chains. EA's use of Visual Studio and WSL to build and debug the Frostbite Engine is a good example:
At EA, our Frostbite Engine has a Linux component that is used for our dedicated servers and that serves many of our most popular games. When we saw Microsoft add support for Linux in a workload in Visual Studio, it caught my interest!
At EA, our game developers are used to a Windows environment for development, so we thought it would be difficult to force them to develop directly in a Linux environment (…). After the release of the Visual Studio Linux workload, we found that Microsoft had basically integrated all tools / processes well into a Visual Studio workload, so we could ask our developers to install and debug it directly in Visual Studio!
So far, the integration into WSL and the remote debugging that the workload offers has been a success and has drastically cleaned up our tools / processes related to debugging / developing Linux. Our developers were very happy with the improved experience.
EA and Frostbite are by no means the only example of large projects that benefit from Microsoft's relatively new – but clearly serious – commitment to extensive Linux integration and support. Much of the renaissance in Linux gaming in recent years has been due to the support of the Linux unit through the Unity engine. However, many people may not know that the engine's Linux support is based on .NET, which is itself a full cross version. Platform development environment.
Enlarge /. Aside from the conversations themselves, it's a little shocking that an event hosted by Microsoft has released a schedule with Google Sheets.
The actual lectures at the WSL included topics such as Infosec, Devops automation, Kubernetes and more. We look forward to their general availability and will update them here with links as soon as they do.