holoscan-install-source
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHoloscan SDK — Build from Source
Holoscan SDK — 从源码构建
Purpose
目的
Build the Holoscan SDK from the source tree using its script (which builds inside a Docker container), producing a local install tree consumable as a CMake dependency.
nvidia-holoscan/holoscan-sdk./run使用源码树中的脚本(在Docker容器内构建)从源码构建Holoscan SDK,生成可作为CMake依赖使用的本地安装目录树。
nvidia-holoscan/holoscan-sdk./runPrerequisites
前置条件
- Linux host with NVIDIA GPU + driver ().
nvidia-smi - , Docker with NVIDIA Container Toolkit (
gitworks), anddocker run --gpus all.docker-buildx-plugin - ~20 GB free disk for the build container + build/install trees.
- 10–30 min for a clean first build.
- 配备NVIDIA GPU及驱动的Linux主机(可运行)。
nvidia-smi - 已安装、带有NVIDIA Container Toolkit的Docker(确保
git可正常运行),以及docker run --gpus all。docker-buildx-plugin - 构建容器及构建/安装目录树需要约20GB的可用磁盘空间。
- 首次完整构建需要10-30分钟。
Limitations
限制说明
- Only recommended when published packages (Conda / container / apt / wheel) don't fit — debug symbols, custom CMake options, or unsupported configs.
- Still requires Docker — the script builds inside a container; this is not a true bare-metal build.
./run - Cross-compiling to aarch64 needs on the host.
qemu-user-static
- 仅当已发布的软件包(Conda/容器/apt/wheel)无法满足需求时推荐使用,比如需要调试符号、自定义CMake选项或不支持的配置。
- 仍然需要Docker——脚本在容器内构建,并非真正的裸机构建。
./run - 交叉编译到aarch64架构需要在主机上安装。
qemu-user-static
Step 0: Consult the Official Install Instructions
步骤0:查阅官方安装说明
Always fetch the "Build from Source" section of (and the linked GitHub / for the chosen tag) before building. Extract: required flags for the target architecture and CUDA major, supported branches/tags, any Dockerfile patches called out for the release, and the test names recommended for verification. If the doc disagrees with anything below, the doc wins.
https://docs.nvidia.com/holoscan/sdk-user-guide/sdk_installation.htmlREADME.mdDEVELOP.md./run在构建前,请务必查看中的「从源码构建」章节(以及所选标签对应的GitHub上的/文档)。提取以下信息:目标架构和CUDA主版本所需的参数、支持的分支/标签、该版本提及的任何Dockerfile补丁,以及推荐用于验证的测试名称。如果本文档与官方文档存在冲突,以官方文档为准。
https://docs.nvidia.com/holoscan/sdk-user-guide/sdk_installation.htmlREADME.mdDEVELOP.md./runStep 1: Prerequisites
步骤1:检查前置条件
Check that git and Docker (with GPU passthrough) are available:
bash
git --version
docker --version
docker run --rm --gpus all ubuntu:22.04 nvidia-smi- If Docker is missing → help install from https://docs.docker.com/engine/install/
- If GPU passthrough fails → install NVIDIA Container Toolkit:
bash
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list \ | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' \ | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit sudo nvidia-ctk runtime configure --runtime=docker && sudo systemctl restart docker - If Docker buildx is missing:
sudo apt-get install docker-buildx-plugin
确认git和支持GPU透传的Docker已安装可用:
bash
git --version
docker --version
docker run --rm --gpus all ubuntu:22.04 nvidia-smi- 如果未安装Docker → 请从https://docs.docker.com/engine/install/获取安装帮助
- 如果GPU透传失败 → 安装NVIDIA Container Toolkit:
bash
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list \ | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' \ | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit sudo nvidia-ctk runtime configure --runtime=docker && sudo systemctl restart docker - 如果未安装Docker buildx:执行
sudo apt-get install docker-buildx-plugin
Step 2: Clone the Repository
步骤2:克隆仓库
Clone repo to ~/holoscan/holoscan-sdk if needed
bash
mkdir -p ~/holoscan/
git clone https://github.com/nvidia-holoscan/holoscan-sdk.git
cd ~/holoscan/holoscan-sdkTo build a specific release tag (recommended for stability):
bash
git tag | grep -E '^v[0-9]' | sort -V | tail -5 # list recent tags
git checkout v<VERSION> # e.g. v4.1.0如果需要,将仓库克隆到~/holoscan/holoscan-sdk目录:
bash
mkdir -p ~/holoscan/
git clone https://github.com/nvidia-holoscan/holoscan-sdk.git
cd ~/holoscan/holoscan-sdk若要构建特定的发布版本标签(推荐用于稳定性):
bash
git tag | grep -E '^v[0-9]' | sort -V | tail -5 # 列出最近的标签
git checkout v<VERSION> # 示例:v4.1.0Step 3: Build
步骤3:构建
The script handles container creation, CMake configuration, compilation, and install in one step. Warn the user this takes 10–30 minutes on first run (downloads base image + compiles).
./run buildbash
./run buildCommon options:
| Flag | Purpose |
|---|---|
| Debug build (symbols, no optimization) |
| Release + debug symbols |
| Cross-compile for ARM64 (needs |
| iGPU build for Jetson/IGX |
| Preview commands without executing |
If CMake cache errors occur after changing options:
bash
./run clear_cache && ./run buildOutput lands in these folders, and can be retrieved with and
./run get_build_dir./run get_install_dir- Build dir:
build-cu<N>-<arch>/ - Install dir: .
install-cu<N>-<arch>/
./run buildbash
./run build常用选项:
| 参数 | 用途 |
|---|---|
| 调试版本构建(包含调试符号,无优化) |
| 发布版本+调试符号 |
| 交叉编译为ARM64架构(需安装 |
| 为Jetson/IGX构建iGPU版本 |
| 预览命令但不执行 |
如果修改选项后出现CMake缓存错误:
bash
./run clear_cache && ./run build构建输出会存放在以下目录,可通过和获取路径:
./run get_build_dir./run get_install_dir- 构建目录:
build-cu<N>-<arch>/ - 安装目录:.
install-cu<N>-<arch>/
Step 4: Run Tests
步骤4:运行测试
Run the following tests
- EXAMPLE_CPP_HELLO_WORLD_TEST
- EXAMPLE_PYTHON_HELLO_WORLD_TEST
- EXAMPLE_CPP_TENSOR_INTEROP_TEST
- EXAMPLE_PYTHON_TENSOR_INTEROP_TEST
- EXAMPLE_CPP_VIDEO_REPLAYER_TEST
- EXAMPLE_PYTHON_VIDEO_REPLAYER_TEST
bash
./run testTo run all six required tests at once, use a single-quoted regex (the must be quoted to prevent bash from treating it as a pipe):
|bash
./run test --options "-R 'EXAMPLE_CPP_HELLO_WORLD_TEST|EXAMPLE_PYTHON_HELLO_WORLD_TEST|EXAMPLE_CPP_TENSOR_INTEROP_TEST|EXAMPLE_PYTHON_TENSOR_INTEROP_TEST|EXAMPLE_CPP_VIDEO_REPLAYER_TEST|EXAMPLE_PYTHON_VIDEO_REPLAYER_TEST' --output-on-failure"Run a specific test by name or regex:
bash
./run test --name <test_name>
./run test --options "-R '<regex>' --output-on-failure"
./run test --verboseImportant: Always single-quote the regex string when it contains — without quotes, bash interprets as a pipe and the command fails with .
||command not foundExpected: all tests pass. Note any failures and report them to the user before continuing.
运行以下测试:
- EXAMPLE_CPP_HELLO_WORLD_TEST
- EXAMPLE_PYTHON_HELLO_WORLD_TEST
- EXAMPLE_CPP_TENSOR_INTEROP_TEST
- EXAMPLE_PYTHON_TENSOR_INTEROP_TEST
- EXAMPLE_CPP_VIDEO_REPLAYER_TEST
- EXAMPLE_PYTHON_VIDEO_REPLAYER_TEST
bash
./run test若要一次性运行全部六项必填测试,请使用单引号包裹正则表达式(必须对进行转义,避免bash将其视为管道符):
|bash
./run test --options "-R 'EXAMPLE_CPP_HELLO_WORLD_TEST|EXAMPLE_PYTHON_HELLO_WORLD_TEST|EXAMPLE_CPP_TENSOR_INTEROP_TEST|EXAMPLE_PYTHON_TENSOR_INTEROP_TEST|EXAMPLE_CPP_VIDEO_REPLAYER_TEST|EXAMPLE_PYTHON_VIDEO_REPLAYER_TEST' --output-on-failure"按名称或正则表达式运行特定测试:
bash
./run test --name <test_name>
./run test --options "-R '<regex>' --output-on-failure"
./run test --verbose重要提示: 当正则表达式包含时,请务必用单引号包裹——如果不加引号,bash会将解释为管道符,导致命令执行失败并提示。
||command not found预期结果:所有测试通过。若出现任何测试失败,请记录并告知用户后再继续。
Step 5: Point Applications at the Install Tree
步骤5:将应用指向安装目录树
Once built, applications can use the install tree as a CMake dependency. Give the user this path:
/path/to/holoscan-sdk/install-cu<N>-<arch>/They can set or to this directory when building their own applications.
Holoscan_ROOTCMAKE_PREFIX_PATH构建完成后,应用可将该安装目录树作为CMake依赖使用。告知用户以下路径:
/path/to/holoscan-sdk/install-cu<N>-<arch>/用户在构建自己的应用时,可将或设置为该目录。
Holoscan_ROOTCMAKE_PREFIX_PATHTroubleshooting
故障排查
| Symptom | Fix |
|---|---|
| The regex contains |
| CMake cache errors after option change | |
| Docker buildx not found | |
| GPU not visible inside build container | Verify NVIDIA Container Toolkit and re-run |
| Cross-compile fails (aarch64) | Install qemu: |
| 症状 | 解决方法 |
|---|---|
运行测试时出现 | 正则表达式包含 |
| 修改选项后出现CMake缓存错误 | 执行 |
| 找不到Docker buildx | 执行 |
| 构建容器内无法识别GPU | 验证NVIDIA Container Toolkit是否安装正确,重新执行 |
| 交叉编译失败(aarch64架构) | 安装qemu: |