# Upload Ardusub code to pixhawk using waf

**URL:** <https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473>\
**Category:** Blue Robotics Software\
**Created:** [April 12, 2018, 2:41pm UTC](https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473 "2018-04-12T14:41:42Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexis](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@alexis](https://discuss.bluerobotics.com/u/alexis)\
**Post date:** [April 12, 2018, 2:41pm UTC](https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473/1 "2018-04-12T14:41:43Z")

</div>

Hello,  
I have recently started working with a BlueRov2 and I the reason I am writing this post is to get help uploading code to the pixhawk.  
After downloading the ardupilot repository, I made some modifications (just some simple methods on the joystick.cpp custom cases) and now I am trying to follow the instructions to upload the code using waf. However I have some difficulties.

I first used the following line to configure the board (I think that is the px4-v2 model) and everything went well.

./waf configure --board px4-v2  
-\>‘configure’ finished successfully (0.592s)

Now I think I should use this one to upload it to the pixhawk:  
./waf configure --board --rsync-dest   
In my case:  
./waf configure --board px4-v2 --rsync-dest [pi@192.168.2.2](mailto:pi@192.168.2.2)…???

How should I continue?

I hope my problem was correctly explained.

Finally, I would also like to know why the library is switching to using waf instead of the classic cmakelists, a common known standart tool to build code.

Thank you for your time,  
Alexis

---

<div class="post-metadata">

**Author:** ![patrickelectric](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/patrickelectric/32/2162_2.png) [@patrickelectric](https://discuss.bluerobotics.com/u/patrickelectric)\
**Post date:** [April 12, 2018, 2:59pm UTC](https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473/2 "2018-04-12T14:59:14Z")

</div>

Hi Alexis,

> [@alexis](#):
>
> I first used the following line to configure the board (I think that is the px4-v2 model) and everything went well.
> 
> ./waf configure --board px4-v2
> 
> -\>‘configure’ finished successfully (0.592s)
> 
> Now I think I should use this one to upload it to the pixhawk:
> 
> ./waf configure --board --rsync-dest
> 
> In my case:
> 
> ./waf configure --board px4-v2 --rsync-dest [pi@192.168.2.2](mailto:pi@192.168.2.2)…???
> 
> How should I continue?

To build ardusub, you will need to configure waf to create a pixhawk v2 binary.

- ./waf configure --board px4-v2

After that, it will be necessary to build ardusub and not others vehicles.

- ./waf build sub --verbose

Now, to upload ardusub, you’ll need to connect the pixhawk in your computer and do the upload.

- ./waf --upload sub

It’s not possible to update ardusub via rsync, this argument is used for Linux boards, in BlueROV2 the raspberry is used only as a companion computer and not to control the ROV itself.

> [@alexis](#):
>
> Finally, I would also like to know why the library is switching to using waf instead of the classic cmakelists, a common known standart tool to build code.

This is for historical reasons in ArduPilot project, but before waf the build system was Makefiles and not CMakeLists.

---

<div class="post-metadata">

**Author:** ![jwalser](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/jwalser/32/2234_2.png) [@jwalser](https://discuss.bluerobotics.com/u/jwalser)\
**Post date:** [April 12, 2018, 3:37pm UTC](https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473/3 "2018-04-12T15:37:08Z")

</div>

You will not be able to upload to the autopilot connected to a remote host with the build tools in the ardupilot repository alone.

You will need to transfer the file to the remote host, and then run the px\_uploader.py script located in the tools directory of the arudpilot repository (transfer the script to the remote host, too).

If you are using a BlueROV2, or a Raspberry Pi with our companion computer image, then an easier way might be to use the UI at [http://192.168.2.2:2770/system](http://192.168.2.2:2770/system).

---

<div class="post-metadata">

**Author:** ![alexis](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@alexis](https://discuss.bluerobotics.com/u/alexis)\
**Post date:** [April 13, 2018, 9:14am UTC](https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473/4 "2018-04-13T09:14:31Z")

</div>

Thank you for your replies.  
Patrick José I am no sure I did understand the line “./waf --upload sub”. Should I run this from inside the pixhawk? How can the command know where to upload the “sub”?

On the other hand, It may be easier to follow Jacob instructions. I should be able to send the binaries/files created by waf via scp to the raspberry pi (we are using your companion computer image) and then use the script px\_uploader.py to upload it to the pixhawk. I will try to understand it’s usage.  
I will also take a look at the UI you mention. I did not know that utility. Why 2770? Is it a random number defined by BlueRobotics?

Sorry for this questions which may be basic for you but I am still a student and I have difficulties finding documentation.

---

<div class="post-metadata">

**Author:** ![patrickelectric](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/patrickelectric/32/2162_2.png) [@patrickelectric](https://discuss.bluerobotics.com/u/patrickelectric)\
**Post date:** [April 13, 2018, 1:07pm UTC](https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473/5 "2018-04-13T13:07:46Z")

</div>

Hi Alexis,

Sorry for not putting this in a clear way.

> [@alexis](#):
>
> Patrick José I am no sure I did understand the line “./waf --upload sub”. Should I run this from inside the pixhawk?

All commands of my previous post should be done in the root folder of your ArduPilot source code, it’s the local of waf script. The pixhawk should be connected in your computer usb.

To do what Jacob said, related to [http://192.168.2.2:2770/system](http://192.168.2.2:2770/system) webpage, you will need:

- Build ArduSub with `./waf build sub`
- Go to the /system webpage.
- Select **Choose File** , the .px4 file will be in `build/px4-v2/bin` inside ArduPilot root folder.
- Click in **Upload**.  
After that, you will see the flash process happening.

```txt
Attempting upload from file /tmp/data/ardusub.px4
Stopping mavproxy
Flashing Pixhawk...
Loaded firmware for 9,0, size: 909212 bytes, waiting for the bootloader...
attempting reboot on /dev/ttyACM0...
Found board 9,0 bootloader rev 4 on /dev/ttyACM0
ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 
Erase : [====================] 100.0%
Program: [====================] 100.0%
Verify : [====================] 100.0%
Rebooting.

Waiting to restart mavproxy...
Restarting mavproxy
Complete!

```

---

<div class="post-metadata">

**Author:** ![jwalser](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/jwalser/32/2234_2.png) [@jwalser](https://discuss.bluerobotics.com/u/jwalser)\
**Post date:** [April 13, 2018, 2:55pm UTC](https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473/6 "2018-04-13T14:55:28Z")

</div>

> [@alexis](#):
>
> Why 2770? Is it a random number defined by BlueRobotics?

Yes.

---

<div class="post-metadata">

**Author:** ![alexis](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@alexis](https://discuss.bluerobotics.com/u/alexis)\
**Post date:** [April 17, 2018, 12:31pm UTC](https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473/7 "2018-04-17T12:31:40Z")

</div>

Hello Jacob and Patrick,  
Sorry for the late reply. Everything now is clear and working. Thank you for your assistance.  
Alexis

---

<div class="post-metadata">

**Author:** ![rnr](https://avatars.discourse-cdn.com/v4/letter/r/ac91a4/32.png) [@rnr](https://discuss.bluerobotics.com/u/rnr)\
**Post date:** [September 15, 2018, 6:24am UTC](https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473/8 "2018-09-15T06:24:38Z")

</div>

![image](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/8/87882161905eb0a1ff878747fee181006cb69f43.png)

Which directory should I be in to do this terminal flashing?

The usual ardupilot folder is not doing the job for me.  
Let me check the GUI Flashing method.

Thanks for the info anyway.

---

<div class="post-metadata">

**Author:** ![reimonha](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/reimonha/32/10323_2.png) [@reimonha](https://discuss.bluerobotics.com/u/reimonha)\
**Post date:** [September 21, 2022, 10:14pm UTC](https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473/9 "2022-09-21T22:14:19Z")

</div>

I have an issue @patrickelectric , you commented that all the commands that you talk about were to be executed on the root folder of the ArduPilot. For this, should I insert the SD card from the pixhawk to the computer, run the commands given, which will compile and upload the (modified) firmware on it.

Later on, I can insert it on the pixhawk with the changes uploaded.

Or the Arduipilot root folder can be access from the companion (raspberry)? If so, do you know about the path for it? There is a ardusub folder on the companion, but containing different information, python code, and shell scripts, looks different from the ardusub git repo.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [September 22, 2022, 7:39am UTC](https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473/10 "2022-09-22T07:39:58Z")

</div>

Hi @reimonha, welcome to the forum 🙂

You may wish to look through our [uploading ArduSub docs](https://www.ardusub.com/developers/developers.html#uploading-locally).

To clarify Patrick’s points above:

1. configuring `waf` and building ArduSub should be done from the root of the `ardupilot` source code repository on your topside computer
2. for uploading firmware,
  - if you want you can use `waf` to upload to a Pixhawk that has a direct USB connection to your topside computer, but
  - it would be most common to upload via the Companion (or [BlueOS](https://discuss.bluerobotics.com/t/blueos-official-release/12024)) web interface (from a browser in your topside computer), when the Pixhawk is connected via USB to the onboard (Raspberry Pi) computer

---

<div class="post-metadata">

**Author:** ![reimonha](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/reimonha/32/10323_2.png) [@reimonha](https://discuss.bluerobotics.com/u/reimonha)\
**Post date:** [September 22, 2022, 7:20pm UTC](https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473/11 "2022-09-22T19:20:02Z")

</div>

Thanks a lot @EliotBR for your response, the process is now more clear, but I got another issue now on hands, I dont know if I should made a different post, but as it is on line with this post subject, I will keep it here.

Before running the `./waf build sub`, command promt is telling me to first run `./waf configure`. For this, running alone any of this work, it opens VScode with the waf code, I see it is a python code, thus, i run it with `python ./waf`

Python version: Python 3.10.6

It requires g++ compiler, I installed it from [MinGW - Minimalist GNU for Windows download | SourceForge.net](https://sourceforge.net/projects/mingw/) , it is recognized and on path.

g++.exe ([MinGW.org](http://MinGW.org) GCC-6.3.0-1) 6.3.0  
Copyright (C) 2016 Free Software Foundation, Inc.  
This is free software; see the source for copying conditions. There is NO  
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Nevertheless, when run `python ./waf configure` it print this:

```auto
Setting top to : C:\Users\ramon\Documents\Stan\ROV\ArduSub\ardupilot 
Setting out to : C:\Users\ramon\Documents\Stan\ROV\ArduSub\ardupilot\build
Autoconfiguration : enabled
Setting board to : sitl
Using toolchain : native
Checking for 'g++' (C++ compiler) : Traceback (most recent call last):
  File "C:\Users\ramon\Documents\Stan\ROV\ArduSub\ardupilot\modules\waf\waflib\Scripting.py", line 158, in waf_entry_point
    run_commands()
  File "C:\Users\ramon\Documents\Stan\ROV\ArduSub\ardupilot\modules\waf\waflib\Scripting.py", line 251, in run_commands
    ctx = run_command(cmd_name)
  File "C:\Users\ramon\Documents\Stan\ROV\ArduSub\ardupilot\modules\waf\waflib\Scripting.py", line 235, in run_command
    ctx.execute()
  File "C:\Users\ramon\Documents\Stan\ROV\ArduSub\ardupilot\modules\waf\waflib\Configure.py", line 159, in execute
    super(ConfigurationContext, self).execute()
  File "C:\Users\ramon\Documents\Stan\ROV\ArduSub\ardupilot\modules\waf\waflib\Context.py", line 204, in execute
    self.recurse([os.path.dirname(g_module.root_path)])
  File "C:\Users\ramon\Documents\Stan\ROV\ArduSub\ardupilot\modules\waf\waflib\Context.py", line 286, in recurse
    user_function(self)
  File "C:\Users\ramon\Documents\Stan\ROV\ArduSub\ardupilot\wscript", line 441, in configure
    cfg.get_board().configure(cfg)
  File "C:\Users\ramon\Documents\Stan\ROV\ArduSub\ardupilot\Tools/ardupilotwaf\boards.py", line 41, in configure
  File "C:\Users\ramon\Documents\Stan\ROV\ArduSub\ardupilot\modules\waf\waflib\Tools\gxx.py", line 152, in configure
    conf.find_gxx()
  File "C:\Users\ramon\Documents\Stan\ROV\ArduSub\ardupilot\modules\waf\waflib\Configure.py", line 316, in fun
    return f(*k, **kw)
  File "C:\Users\ramon\Documents\Stan\ROV\ArduSub\ardupilot\Tools/ardupilotwaf\toolchain.py", line 32, in find_gxx
    conf.get_cc_version(cxx, gcc=True)
  File "C:\Users\ramon\Documents\Stan\ROV\ArduSub\ardupilot\modules\waf\waflib\Configure.py", line 316, in fun
    return f(*k, **kw)
  File "C:\Users\ramon\Documents\Stan\ROV\ArduSub\ardupilot\modules\waf\waflib\Tools\c_config.py", line 1014, in get_cc_version
    out, err = conf.cmd_and_log(cmd, output=0, stdin=open('/dev/null','r'), env=env)
FileNotFoundError: [Errno 2] No such file or directory: '/dev/null'

```

I ran all this from the ardupilot root folder on the topside computer.

Thanks.

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [September 23, 2022, 1:04pm UTC](https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473/12 "2022-09-23T13:04:18Z")

</div>

Are you following the [build instructions](https://www.ardusub.com/developers/developers.html), or something else? Configure should be run with a specified board, and the build environment should be set up beforehand.

---

<div class="post-metadata">

**Author:** ![reimonha](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/reimonha/32/10323_2.png) [@reimonha](https://discuss.bluerobotics.com/u/reimonha)\
**Post date:** [September 26, 2022, 9:08pm UTC](https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473/13 "2022-09-26T21:08:01Z")

</div>

Yes, I have follow the instruction step by step.

About that problem, i already solved it, installing again the g++ and gcc compilers. Some errors have pop out but i was able to solve them, nevertheless now I am facing an issue that I dont even know what it is doing.

I attach the screenshot with the issue, this comes when running the waf configure.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/8/87cfcba739fb40498818fa41754549468743bb35.png)

Everything was going good, but it tries to open a file, I see the path is no right because it is a path inside a path, that is why the argument (path) is invalid, and is understandable why it is failing, the issue is that I am not so sure how to fix that path, or in which script that command is getting executed.

I am working with Windows 10, Python 3.10.7, gcc and g++ ([MinGW.org](http://MinGW.org) GCC-6.3.0-1) 6.3.0 (from my last post I change laptop).

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [September 27, 2022, 5:00am UTC](https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473/14 "2022-09-27T05:00:00Z")

</div>

> [@reimonha](#):
>
> About that problem, i already solved it, installing again the g++ and gcc compilers. Some errors have pop out but i was able to solve them …

Glad to hear it! 🙂

> [@reimonha](#):
>
> … I am not so sure how to fix that path, or in which script that command is getting executed.

I’m also not sure why or where it’s doing that. Given the error message specifies there’s a complete log in `C:\Users\stan\Documents\ardupilot\build\config.log` can you check there to see if there’s a more complete error message, before we try digging into the internals of waf?

---

<div class="post-metadata">

**Author:** ![reimonha](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/reimonha/32/10323_2.png) [@reimonha](https://discuss.bluerobotics.com/u/reimonha)\
**Post date:** [September 27, 2022, 5:15pm UTC](https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473/15 "2022-09-27T17:15:35Z")

</div>

Yes, sorry i didn’t attach that, but even though for me that log was not of much help, hope you can understand it better.  
[config\_220926.txt](https://discuss.bluerobotics.com/uploads/short-url/lXv3FlfjCGJA6e8EUZyn3rhbRkK.txt) (32.9 KB)

---

<div class="post-metadata">

**Author:** ![reimonha](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/reimonha/32/10323_2.png) [@reimonha](https://discuss.bluerobotics.com/u/reimonha)\
**Post date:** [September 28, 2022, 11:25pm UTC](https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473/16 "2022-09-28T23:25:59Z")

</div>

Hi @EliotBR , a little update.

I dig more into the code, i had to modify it a little but, but i was able to configure it, but now, when i run “./waf build sub” i get the next:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/0/0f8f1cb3316bf45f7fb2c908b195383931ec66c3.png)

I already try opening cmd as administrator and even using gsudo for the permissions, but no luck.

Thanks.

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [September 29, 2022, 4:03am UTC](https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473/17 "2022-09-29T04:03:06Z")

</div>

> [@reimonha](#):
>
> I dig more into the code, i had to modify it a little but, but i was able to configure it

Good to hear! 🙂

> [@reimonha](#):
>
> but now, when i run “./waf build sub” i get the next:
> 
> ```auto
> [Errno 13] Permission denied: 'C:\\Users\\stan\\AppData\\Local\\Temp\\tmps6nsbudx'
> Failed to created ap_romfs_embedded.h
> 
> ```

Not sure what’s going on here, so I’ve asked our software team in case they have some ideas 🙂

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [September 30, 2022, 3:29am UTC](https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473/18 "2022-09-30T03:29:27Z")

</div>

> [@EliotBR](#):
>
> … I’ve asked our software team in case they have some ideas 🙂

Following up:

> [@williangalvani](#):
>
> Not sure - I’d think the user should have access to their local folder.  
> I think most Windows users use WSL to build ArduSub.

That also matches the ArduPilot docs, which [note that](https://ardupilot.org/dev/docs/building-setup-windows.html)

> [@Setup for building with waf using Cygwin](#):
>
> Cygwin is not recommended for new developers.

If you don’t want to use WSL, perhaps someone in the [general ArduPilot forum](https://discuss.ardupilot.org) has some more experience with waf on Windows with Cygwin 🙂

---

<div class="post-metadata">

**Author:** ![reimonha](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/reimonha/32/10323_2.png) [@reimonha](https://discuss.bluerobotics.com/u/reimonha)\
**Post date:** [September 30, 2022, 10:19pm UTC](https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473/19 "2022-09-30T22:19:30Z")

</div>

Hi @EliotBR , thanks for the response, i have follow more the WSL installation, and now i am running it with it.

![image](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/9/9568f57cad2c7b8763ac0bb92a8912856906d103.png)  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/9/9bbbc5027c6d1bd0f8e466f9eb809362f475b1c3.png)

Configuration is done correctly, but now build command now breaks somewhere else:

```auto
rov@GWTN156-7:/mnt/c/Users/stan/ardupilot$ sudo python3 waf build sub
Setting top to : /mnt/c/Users/stan/ardupilot
Setting out to : /mnt/c/Users/stan/ardupilot/build
Autoconfiguration : enabled
Setting board to : Pixhawk1
Using toolchain : arm-none-eabi
Checking for 'g++' (C++ compiler) : /usr/bin/arm-none-eabi-g++
Checking for 'gcc' (C compiler) : /usr/bin/arm-none-eabi-gcc
Checking for c flags '-MMD' : yes
Checking for cxx flags '-MMD' : yes
CXX Compiler : g++ 10.3.1
Checking for program 'make' : /usr/bin/make
Checking for program 'arm-none-eabi-objcopy' : /usr/bin/arm-none-eabi-objcopy
Including /mnt/c/Users/stan/ardupilot/libraries/AP_HAL_ChibiOS/hwdef/fmuv3/hwdef.dat
Setup for MCU STM32F427xx
Writing hwdef setup in /mnt/c/Users/stan/ardupilot/build/Pixhawk1/hwdef.h
Writing DMA map
Generating ldscript.ld
No default parameter file found
Checking for env.py
env set WITH_FATFS=1
env set PROCESS_STACK=0x1C00
env set MAIN_STACK=0x600
env set IOMCU_FW=0
env set PERIPH_FW=0
env set HAL_NUM_CAN_IFACES=2
env set BOARD_FLASH_SIZE=2048
env set CPU_FLAGS=['-mcpu=cortex-m4', '-mfpu=fpv4-sp-d16', '-mfloat-abi=hard', '-DARM_MATH_CM4', '-u_printf_float']
env set CORTEX=cortex-m4
env set APJ_BOARD_ID=9
env set APJ_BOARD_TYPE=STM32F427xx
env set USBID=0x1209/0x5741
env set BOOTLOADER_EMBED=1
env set FLASH_RESERVE_START_KB=16
env set FLASH_TOTAL=2080768
env set CHIBIOS_BUILD_FLAGS=USE_FATFS=yes CHIBIOS_STARTUP_MK=os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk CHIBIOS_PLATFORM_MK=os/hal/ports/STM32/STM32F4xx/platform.mk MCU=cortex-m4 ENV_UDEFS=-DCHPRINTF_USE_FLOAT=1
Enabling ChibiOS asserts : no
Enabling malloc guard : no
Enabling ChibiOS thread statistics : no
Enabling -Werror : no
Checking for intelhex module: : disabled
Checking for HAVE_CMATH_ISFINITE : yes
Checking for HAVE_CMATH_ISINF : yes
Checking for HAVE_CMATH_ISNAN : yes
Checking for NEED_CMATH_ISFINITE_STD_NAMESPACE : yes
Checking for NEED_CMATH_ISINF_STD_NAMESPACE : yes
Checking for NEED_CMATH_ISNAN_STD_NAMESPACE : yes
Checking for header endian.h : not found
Checking for header byteswap.h : not found
Checking for HAVE_MEMRCHR : no
Checking for program 'python' : /usr/bin/python3
Checking for python version >= 2.7.0 : 3.10.6
Checking for program 'python' : /usr/bin/python3
Checking for python version >= 2.7.0 : 3.10.6
Source is git repository : yes
Update submodules : yes
Checking for program 'git' : /usr/bin/git
Gtest : STM32 boards currently don't support compiling gtest
Checking for program 'arm-none-eabi-size' : /usr/bin/arm-none-eabi-size
Benchmarks : disabled
Unit tests : disabled
Scripting : enabled
Scripting runtime checks : enabled
Debug build : disabled
Coverage build : disabled
Checking for program 'rsync' : /usr/bin/rsync
Waf: Entering directory `/mnt/c/Users/stan/ardupilot/build/Pixhawk1'
Checking for env.py
env added WITH_FATFS=1
env added PROCESS_STACK=0x1C00
env added MAIN_STACK=0x600
env added IOMCU_FW=0
env added PERIPH_FW=0
env added HAL_NUM_CAN_IFACES=2
env added BOARD_FLASH_SIZE=2048
env appended CPU_FLAGS=['-mcpu=cortex-m4', '-mfpu=fpv4-sp-d16', '-mfloat-abi=hard', '-DARM_MATH_CM4', '-u_printf_float']
env added CORTEX=cortex-m4
env added APJ_BOARD_ID=9
env added APJ_BOARD_TYPE=STM32F427xx
env added USBID=0x1209/0x5741
env added BOOTLOADER_EMBED=1
env added FLASH_RESERVE_START_KB=16
env added FLASH_TOTAL=2080768
env added CHIBIOS_BUILD_FLAGS=USE_FATFS=yes CHIBIOS_STARTUP_MK=os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk CHIBIOS_PLATFORM_MK=os/hal/ports/STM32/STM32F4xx/platform.mk MCU=cortex-m4 ENV_UDEFS=-DCHPRINTF_USE_FLOAT=1
Embedding file bootloader.bin:/mnt/c/Users/stan/ardupilot/Tools/bootloaders/Pixhawk1_bl.bin
Embedding file hwdef.dat:/mnt/c/Users/stan/ardupilot/build/Pixhawk1/hw.dat
Embedding file io_firmware.bin:Tools/IO_Firmware/iofirmware_lowpolh.bin
[6/10] Processing modules/mavlink/message_definitions/v1.0/ardupilotmega.xml
Waf: Leaving directory `/mnt/c/Users/stan/ardupilot/build/Pixhawk1'
Build failed
Traceback (most recent call last):
  File "/mnt/c/Users/stan/ardupilot/modules/waf/waflib/Task.py", line 348, in process
    ret = self.run()
  File "/mnt/c/Users/stan/ardupilot/Tools/ardupilotwaf/mavgen.py", line 55, in run
    from pymavlink.generator import mavgen
  File "/mnt/c/Users/stan/ardupilot/modules/mavlink/pymavlink/generator/mavgen.py", line 26, in <module>
    from future import standard_library
ModuleNotFoundError: No module named 'future'

```

I already try installing that module, using pip install future, pip3 install future, python3 -m pip install future, inside and outside the WSL (PowerShell and CMD), but no luck.  
If I open a file and import it, it is recognize, in WSL and PowerShell, and I have even run a test code where I import that module, but have no luck with the build.

I see that in the Task class on “/ardupilot/Tools/ardupilotwaf/mavgen.py”, you set a PATH, an env PATH, thus i dont know if somewhere there is messing with the Python path.

PD: I re-run waf configure after pip installation future. I also use waf clean to clean configuration, and re-run configure, both methods without any luck.

I know this is a weird case, but thanks for the help.

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [October 3, 2022, 2:13am UTC](https://discuss.bluerobotics.com/t/upload-ardusub-code-to-pixhawk-using-waf/2473/20 "2022-10-03T02:13:21Z")

</div>

`waf` is expected to be run with `./waf <args>`, whereas you’re using `sudo python3 waf args` (which [is likely in a different environment](https://stackoverflow.com/a/50315865), that `future` is presumably not installed into). I’d suggest you try running normally 🙂
