holoscan-install-source
NVIDIA/skills
Compilez le SDK Holoscan à partir du code source à l'aide de son script de compilation intégré basé sur Docker, ce qui permet d'obtenir une arborescence d'installation locale pour les applications basées sur CMake.
...Développer toutSDK Holoscan — Compilation à partir du code source
Objectif
Compiler le SDK Holoscan à partir de l’ nvidia-holoscan/holoscan-sdk à l’aide de son ./run script (qui s'exécute dans un conteneur Docker), afin de générer une arborescence d'installation locale utilisable comme dépendance CMake.
Prérequis
- Hôte Linux équipé d’un GPU NVIDIA et de son pilote (
nvidia-smi). git, Docker avec NVIDIA Container Toolkit (docker run --gpus allfonctionne), etdocker-buildx-plugin.- environ 20 Go d’espace disque libre pour le conteneur de compilation et les arborescences de compilation/installation.
- 10 à 30 minutes pour une première compilation « propre ».
Limitations
- Recommandé uniquement lorsque les paquets publiés (Conda / conteneur / apt / wheel) ne conviennent pas — symboles de débogage, options CMake personnalisées ou configurations non prises en charge.
- Nécessite toujours Docker — les
./runscript effectue la compilation à l’intérieur d’un conteneur ; il ne s’agit pas d’une véritable compilation « bare-metal ». - La compilation croisée vers aarch64 nécessite
qemu-user-staticsur l’hôte.
Étape 0 : Consultez les instructions d'installation officielles
Consultez toujours la section « Compilation à partir du code source » de https://docs.nvidia.com/holoscan/sdk-user-guide/sdk_installation.html (ainsi que la page GitHub associée README.md / DEVELOP.md correspondant à la balise choisie) avant de procéder à la compilation. Extrait : les ./run pour l’architecture cible et la version majeure de CUDA, les branches/balises prises en charge, les correctifs Dockerfile mentionnés pour cette version, ainsi que les noms de tests recommandés pour la vérification. En cas de divergence entre la documentation et les informations ci-dessous, la documentation prévaut.
Étape 1 : Prérequis
Vérifiez que Git et Docker (avec passthrough GPU) sont disponibles :
git --version
docker --version
docker run --rm --gpus all ubuntu:22.04 nvidia-smi
- Si Docker n’est pas installé → suivez les instructions d’installation sur https://docs.docker.com/engine/install/
- Si le passthrough GPU échoue → installez NVIDIA Container Toolkit :
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 - Si Docker buildx n’est pas installé :
sudo apt-get install docker-buildx-plugin
Étape 2 : Cloner le dépôt
Clonez le dépôt dans ~/holoscan/holoscan-sdk si nécessaire
mkdir -p ~/holoscan/
git clone https://github.com/nvidia-holoscan/holoscan-sdk.git
cd ~/holoscan/holoscan-sdk
Pour compiler une version spécifique (recommandé pour plus de stabilité) :
git tag | grep -E '^v[0-9]' | sort -V | tail -5 # list recent tags
git checkout v # e.g. v4.1.0
Étape 3 : Compilation
Le ./run build script gère la création du conteneur, la configuration de CMake, la compilation et l’installation en une seule étape. Prévenez l’utilisateur que cela prend entre 10 et 30 minutes lors de la première exécution (téléchargement de l’image de base + compilation).
./run build
Options courantes :
| Indicateur | Objectif |
|---|---|
--type debug |
Compilation de débogage (symboles, pas d’optimisation) |
--type RelWithDebInfo |
Version finale + symboles de débogage |
--arch aarch64 |
Compilation croisée pour ARM64 (nécessite une sudo apt install qemu-user-static) |
--gpu igpu |
une version iGPU pour Jetson/IGX |
--dryrun |
Prévisualiser les commandes sans les exécuter |
Si des erreurs de cache CMake surviennent après modification des options :
./run clear_cache && ./run build
Les résultats sont enregistrés dans ces dossiers et peuvent être récupérés avec ./run get_build_dir et ./run get_install_dir
- Répertoire de compilation :
build-cu- / - Répertoire d'installation :
install-cu.- /
Étape 4 : Exécuter les tests
Exécutez les tests suivants
- EXAMPLE_CPP_HELLO_WORLD_TEST
- EXAMPLE_PYTHON_HELLO_WORLD_TEST
- EXAMPLE_CPP_TENSOR_INTEROP_TEST
- EXAMPLE_PYTHON_TENSOR_INTEROP_TEST
- EXAMPLE_CPP_TESTEUR_DE_LECTURE_VIDÉO
- EXEMPLE_PYTHON_TESTEUR_DE_LECTEUR_VIDÉO
./run test
Pour exécuter les six tests requis en une seule fois, utilisez une expression régulière entre guillemets simples (le | doit être mise entre guillemets pour empêcher bash de la traiter comme un tube) :
./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"
Exécutez un test spécifique par son nom ou à l’aide d’une expression régulière :
./run test --name
./run test --options "-R '' --output-on-failure"
./run test --verbose
Important : placez toujours la chaîne d’expression régulière entre guillemets simples lorsqu’elle contient | — sans guillemets, bash interprète | comme un tube et la commande échoue avec le message command not found.
Résultat attendu : tous les tests sont réussis. Notez les éventuels échecs et signalez-les à l’utilisateur avant de continuer.
Étape 5 : pointer les applications vers l’arborescence d’installation
Une fois compilées, les applications peuvent utiliser l'arborescence d'installation comme dépendance CMake. Indiquez ce chemin à l'utilisateur :
/path/to/holoscan-sdk/install-cu-/
Il peut définir Holoscan_ROOT ou CMAKE_PREFIX_PATH vers ce répertoire lors de la compilation de ses propres applications.
Dépannage
| Symptôme | Solution |
|---|---|
bash: lors de l'exécution des tests |
L'expression régulière contient | — placez-la entre guillemets simples : --options "-R ' |
| Erreurs de cache CMake après modification d'une option | ./run clear_cache && ./run build |
| buildx de Docker introuvable | sudo apt-get install docker-buildx-plugin |
| GPU non visible à l'intérieur du conteneur de compilation | Vérifier NVIDIA Container Toolkit et relancer sudo nvidia-ctk runtime configure --runtime=docker |
| Échec de la compilation croisée (aarch64) | Installez qemu : sudo apt-get install qemu-user-static |
---
name: holoscan-install-source
description: Build the Holoscan SDK from source using its in-tree Docker-based build script, producing a local install tree for CMake-based applications.
license: Apache-2.0
---
# Holoscan SDK — Build from Source
## Purpose
Build the Holoscan SDK from the `nvidia-holoscan/holoscan-sdk` source tree using its `./run` script (which builds inside a Docker container), producing a local install tree consumable as a CMake dependency.
## Prerequisites
- Linux host with NVIDIA GPU + driver (`nvidia-smi`).
- `git`, Docker with NVIDIA Container Toolkit (`docker run --gpus all` works), and `docker-buildx-plugin`.
- ~20 GB free disk for the build container + build/install trees.
- 10–30 min for a clean first build.
## 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 `./run` script builds inside a container; this is not a true bare-metal build.
- Cross-compiling to aarch64 needs `qemu-user-static` on the host.
## Step 0: Consult the Official Install Instructions
Always fetch the "Build from Source" section of `https://docs.nvidia.com/holoscan/sdk-user-guide/sdk_installation.html` (and the linked GitHub `README.md` / `DEVELOP.md` for the chosen tag) before building. Extract: required `./run` 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.
## Step 1: Prerequisites
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`
## Step 2: Clone the Repository
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-sdk
```
To 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
```
## Step 3: Build
The `./run build` 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).
```bash
./run build
```
Common options:
| Flag | Purpose |
|------|---------|
| `--type debug` | Debug build (symbols, no optimization) |
| `--type RelWithDebInfo` | Release + debug symbols |
| `--arch aarch64` | Cross-compile for ARM64 (needs `sudo apt install qemu-user-static`) |
| `--gpu igpu` | iGPU build for Jetson/IGX |
| `--dryrun` | Preview commands without executing |
If CMake cache errors occur after changing options:
```bash
./run clear_cache && ./run build
```
Output lands in these folders, and can be retrieved with `./run get_build_dir` and `./run get_install_dir`
* Build dir: `build-cu<N>-<arch>/`
* Install dir: `install-cu<N>-<arch>/`.
## Step 4: Run Tests
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 test
```
To 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 --verbose
```
**Important:** Always single-quote the regex string when it contains `|` — without quotes, bash interprets `|` as a pipe and the command fails with `command not found`.
Expected: all tests pass. Note any failures and report them to the user before continuing.
## Step 5: Point Applications at the Install Tree
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 `Holoscan_ROOT` or `CMAKE_PREFIX_PATH` to this directory when building their own applications.
## Troubleshooting
| Symptom | Fix |
|---------|-----|
| `bash: <TEST_NAME>: command not found` when running tests | The regex contains `\|` — wrap it in single quotes: `--options "-R '<regex>'"` |
| CMake cache errors after option change | `./run clear_cache && ./run build` |
| Docker buildx not found | `sudo apt-get install docker-buildx-plugin` |
| GPU not visible inside build container | Verify NVIDIA Container Toolkit and re-run `sudo nvidia-ctk runtime configure --runtime=docker` |
| Cross-compile fails (aarch64) | Install qemu: `sudo apt-get install qemu-user-static` |
Tous les fichiers
5 fichiersInstaller holoscan-install-source
Téléchargez et décompressez les fichiers de compétences dans votre répertoire .claude/skills/.
Télécharger le ZIPClonez le dépôt et copiez les fichiers de compétence dans votre projet.
git clone https://github.com/NVIDIA/skills/tree/main/skills/holoscan-install-source # Copy SKILL.md to your .claude/skills/ directory
Copier





Maison
