How to: Compile ArduPilot on Windows 10 with Ubuntu Bash.

Hello everyone!

Since Windows 10 has Ubuntu as his new partner, I have been using the new Ubuntu bash for compile the ArduPilot code. Before this, a Virtual Machine was needed if you wanted to join Linux with Windows; for all is known that this way is a bit frustrating when you want to get full integration between both platforms.

No need to say that if you are a beginner with ArduPilot and you do not know nothing about Linux, you may desist on compile your modifications as you can not do it directly on Windows.

So, here is the solution to compile apm1/apm2 and Pixhawk in Windows without adding any strange thing: install "Bash on Ubuntu on Windows" and follow next tutorial.

For install "Bash on Ubuntu on Windows" there are many tutorials on the web. An example is here:

All right? Let´s go!

Notes: This tutorial is intended to be a "copy & paste" approach. Just follow text step by step and be patient with yourself ;). Using "Bash on Ubuntu on Windows" was discussed some time ago on "drone-discuss" forum, but I think that no exists a complete guide in the comunity (at least I have not been able to find it). Thanks to everyone that make Ardupilot possible!

Setup Ardupilot Dev Enviromment for Ubuntu bash on Windows 10

-First, you have to insert your local host to the /etc/hosts file:
sudo nano /etc/hosts

-Insert this below first line: "hostname"
         (where "hostname" is your PC name)

-Then, take root control over the bash:
sudo passwd root
su root

-Back to main directory:

-Install git:
sudo apt-get install git

-Install Arduino Core (for APM1/APM2 support):
sudo apt-get install make gawk arduino-core

-Make a new folder for future reference:
mkdir GitHub
cd GitHub

-Clone ardupilot git:
git clone

-Run the script:

-At this point, we need to install some extra tools, because for now, Ubuntu bash on Windows only supports native x64 programs:

sudo add-apt-repository ppa:george-edison55/cmake-3.x -y
sudo apt-get update
sudo apt-get install cmake

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.9

sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
sudo apt-get update
sudo apt-get install gcc-arm-none-eabi=

sudo apt-get update
sudo apt-get upgrade

-Now you have a nice compiler under Windows 10 thanks to Ubuntu.
 Next step is to prove it!

Compile ArduPilot Code

 For apm1/apm2 support is necesary to make a "" file (for compile ArduCopter 3.2.1),
 so navigate to main ardupilot git folder:
cd GitHub/ardupilot

-Is necesary to select correct branch:
git checkout ArduCopter-3.2.1
cd ArduCopter
make configure

-If everything is ok, compile the code:
cd ArduCopter
make apm1

make apm2

-Otherwise, if you want to compile last ArduPlane compatible code whith apm1/2 (ArduPlane 3.4),
 you need to preserve above commented "" file and change your git branch:
cd GitHub/ardupilot
git checkout ArduPlane-release-AVR

-If everything is ok, compile the code:
cd ArduPlane
make apm1

make apm2


-If you want to compile Pixhawk/PX4 code, "" file is not necesary.
 So if you have compiled apm1/apm2 code, you have to remove it:
cd GitHub/ardupilot

-Now, select correct branch (for example, master branch):
cd GitHub/ardupilot
git checkout master

-Navigate to your desired Ardupilot vehicule folder, in my case (complete path):

cd GitHub/ardupilot/ArduCopter

-In your vehicule folder, type "make" and press enter for see supported targets for compile.
 Just type "make" and your target, in my case:
make px4-v2

-If everything is ok, you will see a message like this:
 PX4 ArduCopter Firmware is in ArduCopter-v2.px4


-The new method of compilation "Waf" is also supported.

 Go to git ardupilot software:


cd GitHub/ardupilot/

-Configure your board:

./waf configure --board px4-v2

-Compile for your target:

./waf copter

-And here you are! You have compiled your code!

Tips: if you want to unhide Ubuntu system folder on Windwos, open a command prompt as administrator,
navigate to Ubuntu system path (C:\Users\username\AppData\Local) and change the folder attributes. So:
cd C:\Users\username\AppData\Local
         (where "username" is your user name)
attrib -s -h lxss

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

Regards from Spain,


Views: 2837

Comment by Javier Huarte on October 18, 2016 at 10:43am

Great¡¡¡ Awesome¡¡

Comment by robert bouwens on October 18, 2016 at 11:34am

not awesome ... but finally windows is getting usefull.

Comment by Andrew Tridgell on October 18, 2016 at 2:23pm

Thanks Dario!

Although my main development environment is Linux, I gave this a go today with a newly upgraded win10 box. Works nicely! I also found the full mavproxy graphical interface works nicely for SITL if I run the Xmimg X server.

Would you be interested in working on a page for this in our docs on

Cheers, Tridge

Comment by Andrew Tridgell on October 18, 2016 at 2:31pm

Here is a picture of SITL running on Win10:

Comment by Andrew Tridgell on October 18, 2016 at 4:48pm

a minor correction btw, apt-add-repository needs root, so needs sudo. Some of the apt-get install commands are also missing sudo.

we could have all of this in a script under Tools/scripts/

Comment by Nikita P on October 19, 2016 at 2:46am

I have got problem with adding add-apt-repository ppa:terry.guo/gcc-arm-embedded

After sudo apt-get update i have got error msg W: GPG error: precise Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6D1D8367A3421AFB

In order to solve it: I have got key file from , saved it to file key1; 

added it to system via: sudo apt-key add key1

And received succesfull message OK

After that sudo apt-get update gave me no errors.

Everything else was successful. I have build px4 firmware.

Comment by Leo Ran on October 19, 2016 at 5:36am


Comment by Dario Lindo Andres on October 19, 2016 at 7:44am

Hello everyone!

@Tridge: I have already corrected the lack of "sudo" command. Sorry for the inconvenience. Normally I always go into Ubuntu as "root", so I usually forget to enter "sudo".

What is the new system for upload docs to the wiki? GitHub? I have no problem in working on a page for this. Just guide me how to upload it to servers.

@Nikita P: I have not had the problem of entering the public key ... I have made the installation several months ago and do not remember that problem. Thank you for including the correction! ;)



Comment by Andrew Tridgell on October 20, 2016 at 6:03pm

@Dario, yes, docs are in github here:

thanks for the great tutorial!

Comment by Lucas De Marchi on October 20, 2016 at 6:05pm


Would be nice to get this instruction in our wiki, probably replacing older instructions. Thanks


You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service