holoscan-install-source
NVIDIA/skills
Holoscan SDKのソースコードを、ツリー内に含まれるDockerベースのビルドスクリプトを使用してビルドし、CMakeベースのアプリケーション用のローカルインストールツリーを生成します。
...すべて拡張しますHoloscan SDK — ソースからビルドする
目的
nvidia-holoscan/holoscan-sdkのソースツリーから、その./runスクリプト(Docker コンテナ内でビルドを行う)を使用して Holoscan SDK をビルドし、CMake の依存関係として利用できるローカルインストールツリーを生成します。
前提条件
- NVIDIA GPU およびドライバ(
nvidia-smi)がインストールされた Linux ホスト。 git、NVIDIA Container Toolkit を含む Docker(docker run --gpus allが動作する環境)、およびdocker-buildx-plugin。- ビルドコンテナおよびビルド/インストールツリー用に、約 20 GB の空きディスク容量。
- 初回ビルド(クリーンビルド)には10~30分程度かかります。
制限事項
- 公開されているパッケージ(Conda / コンテナ / apt / wheel)では対応できない場合(デバッグシンボル、カスタム CMake オプション、またはサポートされていない設定など)にのみ推奨されます。
- Docker が依然として必要です。
./runスクリプトはコンテナ内でビルドを行うため、これは真のベアメタルビルドではありません。 - aarch64 へのクロスコンパイルには、ホスト上の
qemu-user-staticが必要です。
ステップ 0: 公式のインストール手順を参照する
ビルドを行う前には、必ずhttps://docs.nvidia.com/holoscan/sdk-user-guide/sdk_installation.htmlの「Build from Source」セクション(および選択したタグに対応するリンク先の GitHub のREADME.md/DEVELOP.md)を確認してください。 抜粋:ターゲットアーキテクチャおよびCUDAメジャーに必要な./runフラグ、サポートされているブランチ/タグ、リリースで指定されている Dockerfile のパッチ、および検証用に推奨されるテスト名。ドキュメントの内容が以下の内容と矛盾する場合は、ドキュメントの記載が優先されます。
ステップ 1: 前提条件
git および Docker(GPU パストスルー対応)が利用可能かどうかを確認してください:
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をインストールしてください:
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
ステップ 2: リポジトリをクローンする
必要に応じて、リポジトリを ~/holoscan/holoscan-sdk にクローンします
mkdir -p ~/holoscan/
git clone https://github.com/nvidia-holoscan/holoscan-sdk.git
cd ~/holoscan/holoscan-sdk
特定のリリースタグをビルドする場合(安定性を重視する場合に推奨):
git tag | grep -E '^v[0-9]' | sort -V | tail -5 # 最近のタグを一覧表示
git checkout v # 例: v4.1.0
ステップ 3: ビルド
./run buildスクリプトは、コンテナの作成、CMake の設定、コンパイル、インストールを1つのステップで処理します。初回実行時には10~30分かかる(ベースイメージのダウンロード+コンパイル)ことをユーザーに警告してください。
./run build
一般的なオプション:
| フラグ | 目的 |
|---|---|
--type debug |
デバッグビルド(シンボル付き、最適化なし) |
--type RelWithDebInfo |
リリース版+デバッグシンボル |
--arch aarch64 |
ARM64向けクロスコンパイル(sudo apt install qemu-user-static が必要) |
--gpu igpu |
Jetson/IGX 向けの iGPU ビルド |
--dryrun |
実行せずにコマンドをプレビューする |
オプション変更後にCMakeキャッシュエラーが発生した場合:
./run clear_cache && ./run build
出力は以下のフォルダに保存され、./run get_build_dirおよび./run get_install_dirで取得できます
- ビルドディレクトリ:
build-cu- / - インストールディレクトリ:
install-cu.- /
ステップ 4: テストの実行
以下のテストを実行します
- 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
./run test
6つの必須テストをすべて一度に実行するには、一重引用符で囲んだ正規表現を使用します(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 test --name
./run test --options "-R '' --output-on-failure"
./run test --verbose
重要:正規表現文字列に「|」が含まれる場合は、必ず一重引用符で囲んでください。引用符がないと、bash は「|」をパイプとして解釈し、「コマンドが見つかりません」というエラーでコマンドが失敗します。
期待される結果:すべてのテストが成功すること。失敗があった場合はそれを記録し、続行する前にユーザーに報告してください。
ステップ 5: アプリケーションのインストールツリーを指定する
ビルドが完了すると、アプリケーションはインストールツリーを CMake の依存関係として使用できるようになります。ユーザーに次のパスを伝えてください:
/path/to/holoscan-sdk/install-cu-/
ユーザーは、独自のアプリケーションをビルドする際に、Holoscan_ROOTまたはCMAKE_PREFIX_PATH をこのディレクトリに設定できます。
トラブルシューティング
| 症状 | 解決策 |
|---|---|
テストの実行時に「bash:」というエラーが表示される |
正規表現に| が含まれているため、一重引用符で囲んでください:--options "-R ' |
| オプション変更後のCMakeキャッシュエラー | ./run clear_cache && ./run build |
| Docker buildx が見つかりません | sudo apt-get install docker-buildx-plugin |
| ビルドコンテナ内でGPUが認識されない | NVIDIA Container Toolkit を確認し、sudo nvidia-ctk runtime configure --runtime=dockerを再実行してください |
| クロスコンパイルに失敗しました (aarch64) | 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` |
すべてのファイル
5件のファイルholoscan-install-sourceをインストール
スキルファイルをダウンロードし、.claude/skills/ ディレクトリに解凍してください。
ZIPをダウンロードリポジトリをクローンし、スキルファイルをプロジェクトにコピーしてください。
git clone https://github.com/NVIDIA/skills/tree/main/skills/holoscan-install-source # Copy SKILL.md to your .claude/skills/ directory
コピー





家
