# Failure on build customized px4 firmware repo

Source: https://forum.modalai.com/topic/3199/failure-on-build-customized-px4-firmware-repo
Category: Development Drones (https://forum.modalai.com/category/44/development-drones)
Tags: px4-dev-kit
Posted: 2024-03-11 17:04:02 UTC by enrico.bandera 0
Replies: 4 · Views: 2076

## enrico.bandera 0 · 2024-03-11 17:04:02 UTC

Hi I am trying to build a customized px4 for voxl2
So I added our repo as submodule but the build fails with following error message:

/usr/local/workspace/px4-autopilot/boards/modalai/voxl2-slpi/src/drivers/dsp_hitl/dsp_hitl.cpp:49:10: fatal error: 'mavlink.h' file not found
#include <mavlink.h>

I have previously succesfully built with native px4-firmware repo, and also deployed on target.
I did not overwrite original px4-firmware, but I added a new px4-autopilot folder that has the same structure, hence I expect it build in same way.
Obviously I modified the existing scripts to use **px4-autopilot** folder instead of **px4-firmware**

May be this is not sufficient?
Thanks in Advance
Enrico

## Reply by Alex Kushleyev (ModalAI staff) · 2024-03-12 05:46:27 UTC

@enrico-bandera-0 ,

It sounds like you previously were able to build px4 for voxl2, which is good. The error you are receiving could be because you are not running the full build from the beginning. From the instructions located here : https://gitlab.com/voxl-public/voxl-sdk/services/voxl-px4 , you should run (inside `rb5-flight-px4-build-docker`)

```
./clean.sh
./build.sh
```

If that does not work, should go back and try to build our standard px4 from voxl-dev branch of `px4-firmware` or whichever branch / tag you wanted to start with.

## Reply by enrico.bandera 0 · 2024-03-12 08:49:31 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev yes, I did it exactly how described in https://gitlab.com/voxl-public/voxl-sdk/services/voxl-px4
The problem occurs when I try to replace the submodule px4-firmware with another (in this case it is named px4-autopilot) using git submodule add <path_to_repo>
Then I modified the build.sh clean.sh and make-package.sh in order to use the new repo/submodule instead the original one.
All this is done inside the rb5-flight-px4-build-docker. 

The error is:

```
/usr/local/workspace/px4-autopilot/boards/modalai/voxl2-slpi/src/drivers/dsp_hitl/dsp_hitl.cpp:49:10: fatal error: 'mavlink.h' file not found
#include <mavlink.h>
         ^~~~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.
make: *** [Makefile:232: modalai_voxl2-slpi] Error 1
cat: build/modalai_voxl2-slpi_default/src/lib/version/build_git_version.h: No such file or directory
*** End of qurt slpi build ***
/usr/local/workspace
User ID is 1000
Group ID is 1000
*** End of build ***
```

## Reply by enrico.bandera 0 · 2024-03-12 10:14:24 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev I could fix it!
The problem was in the git submodule configuration: the px4-autopilot repo, was not correctly configured and command git submodule update --init --recursive was incomplete.

Now I can correctly build our px4-autopilot inside docker container. And deploy to target, install and run it!

Kind Regards

## Reply by Alex Kushleyev (ModalAI staff) · 2024-03-12 15:33:14 UTC (in reply to enrico.bandera 0)

@enrico-bandera-0 Awesome! I am glad you figured it out.
