# Difficulties Compiling

**URL:** <https://discuss.bluerobotics.com/t/difficulties-compiling/5017>\
**Category:** Blue Robotics Software\
**Created:** [May 7, 2019, 7:44am UTC](https://discuss.bluerobotics.com/t/difficulties-compiling/5017 "2019-05-07T07:44:49Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChristopherLyon](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/christopherlyon/32/4688_2.png) [@ChristopherLyon](https://discuss.bluerobotics.com/u/ChristopherLyon)\
**Post date:** [May 7, 2019, 7:44am UTC](https://discuss.bluerobotics.com/t/difficulties-compiling/5017/1 "2019-05-07T07:44:49Z")

</div>

Hello,

I have been trying to compile a PX4 file, using both .WAF and Make, however they both end up failing in multiple ways. Attached image is from my latest attempt to compile (after a fresh clone and update) with “Make px4-v2”, where the compiler ended with a [CHECK-MODULES] Error 1 code.

Am I missing something? Everything should be ready to go as per the Developers guide in the ArduSub documentation.

Happy to send more info if needed 🙂

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

---

<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:** [May 7, 2019, 12:16pm UTC](https://discuss.bluerobotics.com/t/difficulties-compiling/5017/2 "2019-05-07T12:16:22Z")

</div>

Hi,

Make is deprecated, please provide the output with waf.  
Also, check again [our documentation](https://www.ardusub.com/developers/developers.html), you should be able to compile without problems.

---

<div class="post-metadata">

**Author:** ![ChristopherLyon](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/christopherlyon/32/4688_2.png) [@ChristopherLyon](https://discuss.bluerobotics.com/u/ChristopherLyon)\
**Post date:** [May 7, 2019, 2:19pm UTC](https://discuss.bluerobotics.com/t/difficulties-compiling/5017/3 "2019-05-07T14:19:17Z")

</div>

Followed documentation steps. Compiled with waf. Got this funny message…

“Cant use px4-v2, please use px4-v2 instead”

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

---

<div class="post-metadata">

**Author:** ![ChristopherLyon](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/christopherlyon/32/4688_2.png) [@ChristopherLyon](https://discuss.bluerobotics.com/u/ChristopherLyon)\
**Post date:** [May 7, 2019, 2:21pm UTC](https://discuss.bluerobotics.com/t/difficulties-compiling/5017/4 "2019-05-07T14:21:38Z")

</div>

Any tips?

---

<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:** [May 7, 2019, 2:26pm UTC](https://discuss.bluerobotics.com/t/difficulties-compiling/5017/5 "2019-05-07T14:26:24Z")

</div>

Hi,

Please [follow the documentation](https://www.ardusub.com/developers/developers.html), you are not in the correct tag.

* * *

Before compiling ArduSub, first checkout the stable version:

```auto
git fetch --tags
git checkout ArduSub-stable
git submodule update --recursive

```

---

<div class="post-metadata">

**Author:** ![ChristopherLyon](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/christopherlyon/32/4688_2.png) [@ChristopherLyon](https://discuss.bluerobotics.com/u/ChristopherLyon)\
**Post date:** [May 7, 2019, 3:19pm UTC](https://discuss.bluerobotics.com/t/difficulties-compiling/5017/6 "2019-05-07T15:19:50Z")

</div>

Still having difficulties. Getting this error during build:

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

Using Ubuntu 18.04, this is what i’m doing from a clean start:

- `sudo apt-get update && sudo apt-get upgrade`

- `git clone https://github.com/ardupilot/ardupilot.git`

- `cd ardupilot`

- `git submodule update --init --recursive`

- `./Tools/environment_install/install-prereqs-ubuntu.sh -y`

```auto
git fetch --tags
git checkout ArduSub-stable
git submodule update --recursive

```

```auto
./waf configure --board px4-v2

```

```auto
./waf build sub

```

Following these:  
[http://ardupilot.org/dev/docs/building-setup-windows10.html#building-setup-windows10](http://ardupilot.org/dev/docs/building-setup-windows10.html#building-setup-windows10)

[https://www.ardusub.com/developers/developers.html](https://www.ardusub.com/developers/developers.html)

What am I missing?

---

<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:** [May 7, 2019, 6:19pm UTC](https://discuss.bluerobotics.com/t/difficulties-compiling/5017/7 "2019-05-07T18:19:10Z")

</div>

you need gcc 4.9 to build ardusub stable

---

<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:** [May 7, 2019, 6:26pm UTC](https://discuss.bluerobotics.com/t/difficulties-compiling/5017/8 "2019-05-07T18:26:06Z")

</div>

Run the `install-prereqs` script after doing the `checkout ArduSub-stable`. You are installing the tools for the master branch but you are trying to compile last ArduSub-stable version.

---

<div class="post-metadata">

**Author:** ![ChristopherLyon](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/christopherlyon/32/4688_2.png) [@ChristopherLyon](https://discuss.bluerobotics.com/u/ChristopherLyon)\
**Post date:** [May 8, 2019, 7:10am UTC](https://discuss.bluerobotics.com/t/difficulties-compiling/5017/9 "2019-05-08T07:10:24Z")

</div>

Hi Patrick,

> [@patrickelectric](#):
>
> Run the `install-prereqs` script after doing the `checkout ArduSub-stable` .

When doing it in this order I get “-bash: ./Tools/environment\_install/install-prereqs-ubuntu.sh: No such file or directory”

You see that _after_ checking out the stable ArduSub branch, that the folder environment\_install dosent exist anymore:

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

Here is the pastebin of my log:

> **[Tool File - Pastebin.com](https://pastebin.com/faVhfeqe)**
>
> Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

---

<div class="post-metadata">

**Author:** ![ChristopherLyon](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/christopherlyon/32/4688_2.png) [@ChristopherLyon](https://discuss.bluerobotics.com/u/ChristopherLyon)\
**Post date:** [May 8, 2019, 7:36am UTC](https://discuss.bluerobotics.com/t/difficulties-compiling/5017/11 "2019-05-08T07:36:34Z")

</div>

Would be fantastic if a could get a step by step list of commands and dependencies, in the correct order, detailing how to get from a fresh cloned repository, to a successful build with waf. Jumping back and forth from various guides and links, (not knowing if you are running commands is the right order) is most likely my issue with getting this build compiled.

From what i’ve learned;

- Need to run install-prereqs in Ardusub branch

- ArduSub-stable v.3.5.4 April 1 2019 requires GCC version 4.9 to build.

- Compiling with Make is a bad idea (deprecated), as .WAF is becoming the new standard for building.

---

<div class="post-metadata">

**Author:** ![ChristopherLyon](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/christopherlyon/32/4688_2.png) [@ChristopherLyon](https://discuss.bluerobotics.com/u/ChristopherLyon)\
**Post date:** [May 9, 2019, 6:43am UTC](https://discuss.bluerobotics.com/t/difficulties-compiling/5017/12 "2019-05-09T06:43:05Z")

</div>

Update:

Tried fresh using Cygwin this time. ([Setting up the waf Build Environment on Windows using Cygwin — Dev documentation](http://ardupilot.org/dev/docs/building-setup-windows-cygwin.html#building-setup-windows-cygwin)). Installed GCC 4.9 ([4.9-2015-q3-update : GNU Arm Embedded Toolchain](https://launchpad.net/gcc-arm-embedded/+milestone/4.9-2015-q3-update)) And did:

```auto
    git clone https://github.com/ardupilot/ardupilot.git
    cd ardupilot
    git submodule update --init --recursive
    git fetch --tags
    git checkout ArduSub-stable
    git submodule update --recursive
   ./waf configure --board px4-v2

```

However, now the configure process fails because it can’t find “Cmake”  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/7/7bc82ed517fbdb7acc5723b29726e510fe535e72.png)

[The pastebin for my log is here.](https://pastebin.com/ned8UvTp)

What is causing cmake to not be found? Any help is greatly appreciated 🙂

* * *

A couple hours later, i’m back in WSL using Ubuntu, used WGET to download GCC 4.9 from here: [ArduPilot firmware : /Tools/STM32-tools](http://firmware.ardupilot.org/Tools/STM32-tools/)

During compile it cant find g++ or clang++ even though they are in the bin folder.

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

Environment setup script has been run in ArduSub stable branch with fetched tags, running GCC 4.9, submodules updated, still not configuring 😕

---

<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:** [May 9, 2019, 1:31pm UTC](https://discuss.bluerobotics.com/t/difficulties-compiling/5017/13 "2019-05-09T13:31:05Z")

</div>

> [@ChristopherLyon](#):
>
> - Compiling with Make is a bad idea (deprecated), as .WAF is becoming the new standard for building.

Using make is fine for ardusub stable.

> During compile it cant find g++ or clang++ even though they are in the bin folder.

You need to add the binary paths to your search PATH environment variable.

---

<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:** [May 9, 2019, 1:32pm UTC](https://discuss.bluerobotics.com/t/difficulties-compiling/5017/14 "2019-05-09T13:32:32Z")

</div>

Hi Christopher,

I’m sorry to inform you, but I was able to replicate your issue and we are going to update our documentation about it.  
You can check the issue status here:

> <https://github.com/bluerobotics/ardusub-gitbook/issues/71>
>
> It's not possible to follow the instructions with WSL and docker.
> ArduSub-stabl…e branch may be compatible only with Ubuntu 16.04 and not 18.04.
> Also related to: https://github.com/bluerobotics/ardusub-gitbook/issues/70

I did a test here with a docker image of ubuntu 18.04 that in theory is similar with your WSL version.

- Install necessary tools  
`apt update`  
`apt install build-essential cmake gcc-multilib genromfs git make python python-dev python-empy python-future python-matplotlib python-numpy python-opencv python-pip python-pyparsing python-scipy python-serial python-setuptools sudo unzip wget xz-utils zip`

- Download gcc-arm-none-eabi-4\_9  
`wget http://firmware.ardupilot.org/Tools/STM32-tools/gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2`  
`tar jxf gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2`  
`export PATH=$PATH:$PWD/gcc-arm-none-eabi-4_9-2015q3/bin`

- Configure and compile ArduSub-stable.

---

<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:** [May 9, 2019, 6:18pm UTC](https://discuss.bluerobotics.com/t/difficulties-compiling/5017/15 "2019-05-09T18:18:20Z")

</div>

@ChristopherLyon, if you like, I can compile here and send the resulting firmware to you. Patrick is working on updating the build instructions.

---

<div class="post-metadata">

**Author:** ![jonathan-santrovitsc](https://avatars.discourse-cdn.com/v4/letter/j/f08c70/32.png) [@jonathan-santrovitsc](https://discuss.bluerobotics.com/u/jonathan-santrovitsc)\
**Post date:** [March 19, 2020, 11:41pm UTC](https://discuss.bluerobotics.com/t/difficulties-compiling/5017/16 "2020-03-19T23:41:18Z")

</div>

@jwalser,

You can compile for me with a custom motor layout (attached) for an Pixhawk1 px4-v2?

I try everthing to compile, but not work

[AP\_Motors6DOF.txt](https://discuss.bluerobotics.com/uploads/short-url/7Qt5YZfkQDqvKlnn5KxVQRzRc4X.txt) (26.5 KB)
