Home        Store        Docs        Blog

Difficulties Compiling

(Christopher Lyon) #1

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 :slight_smile:

(Patrick José Pereira) #2

Hi,

Make is deprecated, please provide the output with waf.
Also, check again our documentation, you should be able to compile without problems.

(Christopher Lyon) #3

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

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

(Christopher Lyon) #4

Any tips?

(Patrick José Pereira) #5

Hi,

Please follow the documentation, you are not in the correct tag.


Before compiling ArduSub, first checkout the stable version:

git fetch --tags
git checkout ArduSub-stable
git submodule update --recursive
(Christopher Lyon) #6

Still having difficulties. Getting this error during build:

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

git fetch --tags
git checkout ArduSub-stable
git submodule update --recursive
./waf configure --board px4-v2
./waf build sub

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

https://www.ardusub.com/developers/developers.html

What am I missing?

(Jacob) #7

you need gcc 4.9 to build ardusub stable

(Patrick José Pereira) #8

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.

(Christopher Lyon) #9

Hi Patrick,

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:

Here is the pastebin of my log:

https://pastebin.com/faVhfeqe

(Christopher Lyon) #11

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.

(Christopher Lyon) #12

Update:

Tried fresh using Cygwin this time. (http://ardupilot.org/dev/docs/building-setup-windows-cygwin.html#building-setup-windows-cygwin). Installed GCC 4.9 (https://launchpad.net/gcc-arm-embedded/+milestone/4.9-2015-q3-update) And did:

    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

The pastebin for my log is here.

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


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

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

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

(Jacob) #13

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.

(Patrick José Pereira) #14

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:

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.

    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 &&
    ./waf build sub`
    
Help building ardusub fork
(Jacob) #15

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

1 Like