Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added compilation steps #5117

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
34 changes: 29 additions & 5 deletions dev/source/docs/building-the-code.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,42 @@ Setting up the Build Environment
- :ref:`Setup the Build Environment on Windows <building-setup-windows>`
- :ref:`Setup the Build Environment on MacOSX <building-setup-mac>`


Building / Compiling
--------------------

**Linux / MacOSX users:**
Once the build environment is set up as above, run the following commmands prior to the initial build. (For Windows users, this is using WSL, as set up above):

- Linux and MacOSX users should build with waf as described in `BUILD.md <https://github.com/ArduPilot/ardupilot/blob/master/BUILD.md>`__.
- `git clone https://github.com/ArduPilot/ardupilot`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have setup the enviroement in previous setup, so no need to git clone again

- `cd ardupilot`
- `git submodule update --recursive --init`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we shouldn't need this as previous instruction have done it already

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A link to those instructions here would suffice.

Copy link
Member

@hendjoshsr71 hendjoshsr71 Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree.

Somewhere on the welcome to dev with ardupilot we must show how to use the basics of waf.

That little link to the giant list in build.md is easy to miss and has too much detail...
We need a cohesive easy to follow story.

I originally figured out how to use waf because I watched the commands the ArduPilot vscode extension was producing.

- `./Tools/gittools/submodule-sync.sh`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should only be used in case of emergency....its a sledge hammer....please remove it....we can add a note in the branching doc about using it in case of emergency where you cant get the modules updated correctly

Copy link
Contributor Author

@David-OConnor David-OConnor May 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

submodule init line removed It seems the other two are required for me. The first line prevents this error:

Build failed -> task in 'dronecan' failed (exit status 2): {task 140083940872752: dronecangen -> } (run with -v to display more information)

The second prevents this:

Build failed
 -> task in 'ChibiOS_lib' failed (exit status 2):
        {task 140009737052320: ChibiOS_lib hwdef.h,hw.dat,include_dirs,board.c,board.h,bouncebuffer.c,bouncebuffer.h,chconf.h,crashdump.c,ffconf.h,flash.c,flash.h,halconf.h,hrt.c,hrt.h,malloc.c,mcuconf.h,poll.h,ppm.h,spi_hook
        // ... (many lines of red text)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed on fresh build

- `./waf configure --board *BoardName*`
- `./waf clean` (Optional; may be useful in some cases)

.. youtube:: lNSvAPZOM_o
`*BoardName*` above is the name of the board, as labeled by its associated folder in
`/ardupiot/libraries/AP_HAL_ChibiOS/hwdef`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, board name isn't restricted to Chibios boards.
./waf list_boards show all the boards


Run the following command, each time you wish to build:
`./waf copter`

(Substitute `plane`, `rover` etc for `copter` as required)


**Note for Windows users**
If possible, run the build steps above from a WSL directory, *not* from a directory on your
Windows filesystem. Building from the Windows filesystem is very slow.

**Windows users:**

- Windows users should fellow the directions described on :ref:`Setup Build Environment on Windows <building-setup-windows>`.
**Details**

- Additional detailed information is available in this document: `BUILD.md <https://github.com/ArduPilot/ardupilot/blob/master/BUILD.md>`__.


- This video demonstrates building on a Linux PC:

.. youtube:: lNSvAPZOM_o


**Board specific instructions:**

Expand Down