Autoware.Auto
|
|
You need to be inside an ADE container, or have installed the dependencies manually. See Installation.
If you haven't done so already, get the source code with
Optionally, you can choose a DDS implementation other than the default Cyclone DDS: Choosing a DDS Vendor
If running tests or demos, also pull binary files with
It is strongly advised to use the colcon defaults file provided by Autoware.Auto to ensure that binaries are consistently built with the same flags.
Test if the required environment variable COLCON_DEFAULTS_FILE
has been properly set by typing the following:
If the output is empty, follow the instruction below to configure it.
After creating a fresh new ADE home according to Installation with ADE, the .bashrc
will be populated to set the COLCON_DEFAULTS_FILE
environment variable.
To use the colcon defaults configuration file with an existing ADE home, type the following from within ADE
Take the defaults file that comes with the Autoware.Auto source checkout and add it to your shell startup; e.g.
or manually export the variable in the terminal in which compilation commands are issued; e.g.
To build all packages in Autoware.Auto, navigate into the AutowareAuto
directory and run
It's important that you always run colcon build
from the repository root. If everything went well, you should not see "failed" on your screen, although "packages had stderr output" is okay.
See Compilation Optimization And Debugging Parameters for further details to influence how the code is built.
To verify that everything works as expected, see if all tests pass:
The first command will run the tests attached to the packages in your workspace. The second command gives you detailed output from the tests on which ones passed and which failed.
ROS 2 uses the colcon
build system. For more information and details about options and flags, take a look at
and see the colcon documentation. In the following, a few of the most useful options are listed. Note that colcon
options are spelled with an underscore instead of a dash – this is a common cause of typos.
To just build a single package:
Note that this does not automatically also build or rebuild its dependencies recursively. To do that:
These options are also accepted by colcon test
.
To add a compiler flag to all packages, e.g. for enabling the undefined behavior sanitizer:
While building Autoware.Auto, here are some common options for compilation build types:
Release
: Optimized and fastDebug
: With debug flags but slow because not all compilation optimizations are appliedRelWithDebInfo
: Fast and allows debugging to a fair-enough degreeRelWithDebInfo
.Debug
or not set at all.Edit the colcon defaults configuration file to permanently pass extra -cmake-args
to colcon build
or select a different default build type. These settings can be overridden on demand by passing command-line arguments to colcon
.
C++ targets in Autoware.Auto are built with additional options set centrally by the directives in autoware_auto_cmake.cmake
and the autoware_set_compile_options()
function defined in that file. The settings are imported to a package through depending on the autoware_auto_cmake
package in a package.xml
and importing the build dependencies in CMakeLists.txt
See Seeing compiler commands to check the compiler flags.
colcon build --cmake-args -DAUTOWARE_OPTIMIZATION_OF_SLOW_TARGETS=ON
.In order to let IDEs analyze the build dependencies and symbol relationships, a compilation database can be generated with the following flag:
colcon
isn't very good at being stateless, so when you build, make changes, and build again, you can sometimes end up with a different result than when you build from scratch. To make sure you're getting a fresh build of a package, just do
to remove all build artifacts associated with that package. Alternatively, if you don't want to delete the old binaries, you can specify custom build and install directories:
To see the compiler and linker invocations for a package, use
Most issues with building Autoware.Auto are caused by out-of-date software or old build files. To update ade
and the Docker containers it manages as well as clear old builds, run the following in your adehome/AutowareAuto
folder:
If you are using Autoware.Auto outside of ade
, try updating your system and running the following in your AutowareAuto
folder and re-building (where $ROS_DISTRO
is the current distro, e.g. foxy
):
If you are still having trouble after these commands have been run, please see the Support Guidelines for where to ask questions.