holoscan-install-source
NVIDIA/skills
Compile o SDK do Holoscan a partir do código-fonte usando o script de compilação integrado à árvore de código, baseado no Docker, gerando uma árvore de instalação local para aplicativos baseados no CMake.
...Expandir tudoHoloscan SDK — Compilar a partir do código-fonte
Objetivo
Compilar o SDK do Holoscan a partir da nvidia-holoscan/holoscan-sdk árvore de código-fonte utilizando seu ./run script (que é executado dentro de um contêiner Docker), gerando uma árvore de instalação local que pode ser utilizada como dependência do CMake.
Pré-requisitos
- Host Linux com GPU NVIDIA + driver (
nvidia-smi). git, Docker com o NVIDIA Container Toolkit (docker run --gpus allfunciona) edocker-buildx-plugin.- cerca de 20 GB de espaço livre em disco para o contêiner de compilação + árvores de compilação/instalação.
- 10 a 30 minutos para uma primeira compilação limpa.
Limitações
- Recomendado apenas quando os pacotes publicados (Conda / contêiner / apt / wheel) não atendem aos requisitos — símbolos de depuração, opções personalizadas do CMake ou configurações não suportadas.
- Ainda requer o Docker — as
./runscript compila dentro de um contêiner; esta não é uma compilação verdadeiramente bare-metal. - A compilação cruzada para aarch64 requer
qemu-user-staticno host.
Passo 0: Consulte as instruções oficiais de instalação
Sempre consulte a seção “Compilar a partir do código-fonte” de https://docs.nvidia.com/holoscan/sdk-user-guide/sdk_installation.html (e o GitHub vinculado README.md / DEVELOP.md para a tag escolhida) antes de compilar. Extraia: flags obrigatórios ./run para a arquitetura de destino e a versão principal do CUDA, ramos/tags suportados, quaisquer correções no Dockerfile indicadas para a versão e os nomes de teste recomendados para verificação. Se a documentação divergir de qualquer informação abaixo, a documentação prevalece.
Passo 1: Pré-requisitos
Verifique se o git e o Docker (com passthrough de GPU) estão disponíveis:
git --version
docker --version
docker run --rm --gpus all ubuntu:22.04 nvidia-smi
- Se o Docker não estiver instalado → veja as instruções de instalação em https://docs.docker.com/engine/install/
- Se o passthrough da GPU falhar → instale o 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 - Se o Docker buildx estiver faltando:
sudo apt-get install docker-buildx-plugin
Passo 2: Clone o repositório
Clone o repositório para ~/holoscan/holoscan-sdk, se necessário
mkdir -p ~/holoscan/
git clone https://github.com/nvidia-holoscan/holoscan-sdk.git
cd ~/holoscan/holoscan-sdk
Para compilar uma tag de versão específica (recomendado para maior estabilidade):
git tag | grep -E '^v[0-9]' | sort -V | tail -5 # list recent tags
git checkout v # e.g. v4.1.0
Passo 3: Compilar
O ./run build script cuida da criação do contêiner, da configuração do CMake, da compilação e da instalação em uma única etapa. Avise o usuário de que isso leva de 10 a 30 minutos na primeira execução (baixa a imagem base + compila).
./run build
Opções comuns:
| Sinalizador | Finalidade |
|---|---|
--type debug |
Compilação de depuração (símbolos, sem otimização) |
--type RelWithDebInfo |
Versão de lançamento + símbolos de depuração |
--arch aarch64 |
Compilação cruzada para ARM64 (requer sudo apt install qemu-user-static) |
--gpu igpu |
compilação com iGPU para Jetson/IGX |
--dryrun |
Visualizar comandos sem executá-los |
Se ocorrerem erros de cache do CMake após a alteração das opções:
./run clear_cache && ./run build
A saída é salva nessas pastas e pode ser recuperada com ./run get_build_dir e ./run get_install_dir
- Diretório de compilação:
build-cu- / - Diretório de instalação:
install-cu.- /
Etapa 4: Executar testes
Execute os seguintes testes
- EXAMPLE_CPP_HELLO_WORLD_TEST
- EXAMPLE_PYTHON_HELLO_WORLD_TEST
- EXAMPLE_CPP_TENSOR_INTEROP_TEST
- EXAMPLE_PYTHON_TENSOR_INTEROP_TEST
- EXAMPLE_CPP_TESTE_DO_REPRODUTOR_DE_VÍDEO
- EXEMPLO_PYTHON_TESTE_DO_REPRODUTOR_DE_VÍDEO
./run test
Para executar todos os seis testes obrigatórios de uma só vez, use uma expressão regular entre aspas simples (o | deve ser colocada entre aspas para impedir que o bash a trate como um pipe):
./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"
Execute um teste específico pelo nome ou por expressão regular:
./run test --name
./run test --options "-R '' --output-on-failure"
./run test --verbose
Importante: Sempre coloque a expressão regular entre aspas simples quando ela contiver | — sem aspas, o bash interpreta | como um pipe e o comando falha com command not found.
Esperado: todos os testes são aprovados. Anote quaisquer falhas e informe-as ao usuário antes de continuar.
Etapa 5: Direcionar os aplicativos para a árvore de instalação
Depois de compilados, os aplicativos podem usar a árvore de instalação como uma dependência do CMake. Forneça este caminho ao usuário:
/path/to/holoscan-sdk/install-cu-/
Eles podem definir Holoscan_ROOT ou CMAKE_PREFIX_PATH para este diretório ao compilar seus próprios aplicativos.
Solução de problemas
| Sintoma | Solução |
|---|---|
bash: ao executar testes |
A expressão regular contém | — coloque-a entre aspas simples: --options "-R ' |
| Erros no cache do CMake após alteração de opção | ./run clear_cache && ./run build |
| buildx do Docker não encontrado | sudo apt-get install docker-buildx-plugin |
| GPU não está visível dentro do contêiner de compilação | Verifique o NVIDIA Container Toolkit e execute novamente sudo nvidia-ctk runtime configure --runtime=docker |
| Falha na compilação cruzada (aarch64) | Instale o 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` |
Todos os arquivos
5 arquivosInstalar holoscan-install-source
Baixe e extraia os arquivos das habilidades para o diretório .claude/skills/.
Baixar ZIPClone o repositório e copie os arquivos da habilidade para o seu projeto.
git clone https://github.com/NVIDIA/skills/tree/main/skills/holoscan-install-source # Copy SKILL.md to your .claude/skills/ directory
Copiar





Lar
