Ubuntu 22.04 Source Build

Required Dependencies

CMake

The minimum CMake version required for AimRT compilation is 3.24. The CMake version installed via apt package manager in Ubuntu 22.04 is 3.22, which does not meet the requirement. Please visit the CMake official website to download and install the corresponding version.

There are two recommended installation methods:

  1. Install CMake via pip

sudo apt install python3 python3-pip
pip install cmake --upgrade
  1. Install using the official CMake installation script

wget https://github.com/Kitware/CMake/releases/download/v3.30.4/cmake-3.30.4-linux-x86_64.sh
sudo bash cmake-3.30.4-linux-x86_64.sh --prefix=/usr/local --skip-license

make/gcc/g++

The gcc version provided by apt in Ubuntu 22.04 is 11.4, which is suitable for AimRT build. It can be directly installed:

sudo apt install make gcc g++

Minimal Build

After installing the above components, you can perform a minimal build without external dependencies. The build options are as follows:

cmake -B build \
    -DCMAKE_BUILD_TYPE=Release \
    -DAIMRT_INSTALL=ON \
    -DCMAKE_INSTALL_PREFIX=./build/install \
    -DAIMRT_BUILD_TESTS=OFF \
    -DAIMRT_BUILD_EXAMPLES=ON \
    -DAIMRT_BUILD_PROTOCOLS=ON \
    -DAIMRT_BUILD_DOCUMENT=OFF \
    -DAIMRT_BUILD_RUNTIME=ON \
    -DAIMRT_BUILD_CLI_TOOLS=OFF \
    -DAIMRT_BUILD_PYTHON_RUNTIME=OFF \
    -DAIMRT_USE_FMT_LIB=ON \
    -DAIMRT_BUILD_WITH_PROTOBUF=ON \
    -DAIMRT_USE_LOCAL_PROTOC_COMPILER=OFF \
    -DAIMRT_USE_PROTOC_PYTHON_PLUGIN=OFF \
    -DAIMRT_BUILD_WITH_ROS2=OFF \
    -DAIMRT_BUILD_NET_PLUGIN=ON \
    -DAIMRT_BUILD_MQTT_PLUGIN=OFF \
    -DAIMRT_BUILD_ZENOH_PLUGIN=OFF \
    -DAIMRT_BUILD_ICEORYX_PLUGIN=OFF \
    -DAIMRT_BUILD_ROS2_PLUGIN=OFF \
    -DAIMRT_BUILD_RECORD_PLAYBACK_PLUGIN=ON \
    -DAIMRT_BUILD_TIME_MANIPULATOR_PLUGIN=ON \
    -DAIMRT_BUILD_PARAMETER_PLUGIN=ON \
    -DAIMRT_BUILD_LOG_CONTROL_PLUGIN=ON \
    -DAIMRT_BUILD_TOPIC_LOGGER_PLUGIN=ON \
    -DAIMRT_BUILD_OPENTELEMETRY_PLUGIN=ON \
    -DAIMRT_BUILD_GRPC_PLUGIN=ON \
    -DAIMRT_BUILD_PYTHON_PACKAGE=OFF

cmake --build build --config Release --target all -j

To enable other options, you need to install corresponding dependencies. Please refer to Optional Dependencies for specific requirements.

Optional Dependencies

Full Build

After installing all the above components, you can perform a full build. You can directly run the build.sh script in the root directory:

./build.sh

During the build process, AimRT will use FetchContent to pull dependencies from GitHub. If your network environment is poor, you can replace the FetchContent source with Gitee mirror before building:

source url_cn.bashrc
./build.sh $AIMRT_DOWNLOAD_FLAGS