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 the corresponding version for installation.

Two recommended installation methods:

  1. Install CMake via pip

sudo apt install python3 python3-pip
pip install cmake --upgrade
  1. Install 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 in Ubuntu 22.04 apt sources is 11.4, which is suitable for AimRT builds and can be installed directly

sudo apt install make gcc g++

Minimal Build

After installing the above content, 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

If you want to enable other options, you need to install the corresponding dependencies. For specific dependencies, please refer to Optional Dependencies

Optional Dependencies

Full Build

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

./build.sh

During the build process, AimRT will use FetchContent to pull dependencies from github. If the network environment is poor, you can use the following command to replace the FetchContent source to pull from the gitee mirror before building

source url_cn.bashrc
./build.sh $AIMRT_DOWNLOAD_FLAGS