Setting up the waf Build Environment on Windows10 using WSL

These setup instructions describe how to setup “Bash on Ubuntu on Windows” (aka “Windows Subsystem for Linux”) which allows building with waf. Alternative setup instructions for building with make are here.


Setup steps


Starting with the Fall Creators Update (Windows 10 version 1803), enabling the Developer Mode is not longer required for using WSL.

  1. Enable Ubuntu on Windows which includes the following steps (original How-To Geek’s instructions here):

    • Under Control Panel >> Programs >> Turn Windows features on or off, enable “Windows Subsystem for Linux

    • Open the Microsoft Store and install Ubuntu 18.04 (Direct link:

    • Push the Launch button which will open a Bash terminal and ask for a username and password

  2. From withing the Ubuntu bash terminal, update your system to the latest packages:

    • sudo apt-get update
    • sudo apt-get upgrade
  3. Copy the Ardupilot source files to your local Ubuntu filesystem by cloning the git repository and updating the submodules. (Accessing the source files on your Windows filesystem won’t work because the must be kept on the native WSl filesystem)

    • git clone
    • cd ardupilot
    • git submodule init
    • git submodule update --recursive
  4. run the Tools/scripts/ script:

    • run the script ./Tools/scripts/ You will be asked for your Ubuntu root password which is the password provided in step 1 (above). Respond with “Y” when it asks if you wish to install a package.
  5. Remove arm-none-earbi-ar from the path in ~/.profile because the script installs the i386 version of the compiller, which does not run under a x64 WSL (unlike in real linux):

    • Open the file in a text editor nano ~/.profile
    • Search for the line export PATH=/opt/gcc-arm-none-eabi-4_9-2015q3/bin:$PATH and delete it
    • Hit Ctrl + O to save the file
  6. Install a 64 bit version of the compiler from the repositories:

    • apt-get install gcc-arm-none-eabi
  7. Reload the .profile script to let the changes take effect:

    • . ~/.profile

Build with Waf

You should now be able to start the “Ubuntu” application from your Windows Start menu and build with waf as described in

../_images/build-on-windows10-configure.jpg ../_images/build-on-windows10-compile.jpg


As of Windows 10 Build 16176 (April 2017), WSL (Windows Subsystem Linux) has support for access to USB serial peripherals. If you have not updated, please do so. That will allow you to compile and upload directly with the waf –upload option. You can also upload using a ground station. For example Mission Planner’s Initial Setup >> Install Firmware screen has a “Load custom firmware” link on the bottom right. If this link is not visible, open Config/Tuning >> Planner and set the “Layout” to “Advanced”.

For network connected flight controllers, such as linux targets, –upload does function as described in


You can run XWindows applications (including SITL) by installing VcXsrv on Windows and adding

export DISPLAY=:0.0

to your ~/.bashrc. For code editing you can install VSCode inside WSL.


If you want to unhide Ubuntu system folder on Windows, open a command prompt as administrator, navigate to Ubuntu system path (C:\Users\username\AppData\Local) and change the folder attributes. So (where “username” is your user name):

cd C:\Users\username\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState
attrib -s -h rootfs

You can make a direct access to “lxss” folder on your desktop for a quick navigation.