Zero 言語入門 : インストールガイド

最新のコンパイラをインストールして、環境を検証します。

Zero 入門 : インストールガイド

作成 : クラスキャット・セールスインフォメーション
作成日時 : 05/22/2026
バージョン : v0.1.3

* 本記事は zerolang.ai の以下のページを参考にしています :

* サンプルコードの動作確認はしておりますが、必要な場合には適宜、追加改変しています。

 

クラスキャット AI 研究開発支援サービス ⭐️ 創立30周年(30th Anniversary)🎉💐

クラスキャット は AI に関する各種サービスを提供しています。お気軽にご相談ください :

  • AI 研究開発支援 [詳細]

    1. AI エージェント構築支援
    2. 画像認識 (医療系含む) / 画像生成

  • AI 導入個別相談会(無償)実施中! [詳細]

  • PoC(概念実証)を失敗させないための支援 [詳細]

お問合せ : 下記までお願いします。

  • クラスキャット セールス・インフォメーション
  • sales-info@classcat.com
  • ClassCatJP

 

 

Zero 入門 : インストールガイド

最新のコンパイラをインストールして、環境を検証します。

 

Zero のインストール

最新の Zero リリースをインストールします :

curl -fsSL https://zerolang.ai/install.sh | bash
export PATH="$HOME/.zero/bin:$PATH"
zero --version

インストーラーは、`github.com/vercel-labs/zero` から最新の対応するバイナリをダウンロードし、リリースチェックサムファイルと照合して検証し、$HOME/.zero/bin/zero に書き込みます。異なるインストールディレクトリを選択するには、ZERO_INSTALL_DIR を設定します。Linux では、デフォルトで musl 静的ビルドがインストールされます; glibc をターゲットとしたビルドをインストールするには、ZERO_LINUX_FLAVOR=gnu を設定してください。

 
`zero doctor` を使用してローカル環境をチェックします :

zero doctor
zero doctor --json

出力例

% zero doctor
zero doctor: warning
host: ok (darwin-arm64)
native C compiler: ok (Apple clang version 17.0.0 (clang-1700.3.19.1))
target C compiler: warning (target-capable C compiler not found; cross-target executable builds may be unavailable)
cross executable builds: warning (pass --cc/ZERO_CC or install a target-capable C compiler)
PATH: warning (PATH has 4 bad or empty entries out of 22)
host target: ok (supported)
target SDK/sysroot: warning (configure a target-capable C compiler/sysroot before building non-host executables)
target toolchains: warning (1 ready, 7 warnings, 0 errors; run `zero doctor --json` for per-target details)
WASI runner: warning (install wasmtime, wasmer, or wasmedge to execute wasm32-wasi artifacts locally)
.zero write: ok
targets: ok (run `zero targets`)
docs/examples: ok

サポートされているネイティブ実行ファイルのビルドは直接エミッター方式を使いますので、通常のパスでは C コンパイラは必要ありません。

`zero doctor` は、実際のビルドに影響を与える以下の項目をチェックします :

  • PATH の健全性 (health)

  • ワークスペースへの書き込みアクセス権限

  • バンドルされたターゲットのサポート状況

  • ターゲット SDK/sysroot の準備状況

  • 相互運用ツールの準備状況

 
`zero doctor –json` には、関連ツールのターゲットごとの準備状況マトリックスである targetToolchains が含まれます。現時点では、直接エミッターによるネイティブバイナリ生成を正式ルートとして採用しています。

"targetToolchains": [
    {"target": "darwin-arm64", "status": "ok", "message": "cc ready for darwin-arm64", "driverKind": "host-cc", "compiler": "cc", "selectionSource": "host-default", "targetTriple": "aarch64-macos", "linkerFlavor": "cc", "libcMode": "host-default", "requiresSysroot": false, "sysrootEnv": "", "sysrootStatus": "not-required"},
    {"target": "darwin-x64", "status": "warning", "message": "target-capable C compiler is required for darwin-x64; pass --cc/ZERO_CC or install the bundled-toolchain default", "driverKind": "target-cc", "compiler": "target-capable C compiler", "selectionSource": "target-manifest", "targetTriple": "x86_64-macos", "linkerFlavor": "cc", "libcMode": "sysroot", "requiresSysroot": true, "sysrootEnv": "ZERO_SYSROOT_X86_64_MACOS", "sysrootStatus": "missing"},
    {"target": "linux-musl-x64", "status": "warning", "message": "target-capable C compiler is required for linux-musl-x64; pass --cc/ZERO_CC or install the bundled-toolchain default", "driverKind": "target-cc", "compiler": "target-capable C compiler", "selectionSource": "target-manifest", "targetTriple": "x86_64-linux-musl", "linkerFlavor": "target-cc", "libcMode": "bundled-libc", "requiresSysroot": false, "sysrootEnv": "", "sysrootStatus": "not-required"},
    {"target": "linux-musl-arm64", "status": "warning", "message": "target-capable C compiler is required for linux-musl-arm64; pass --cc/ZERO_CC or install the bundled-toolchain default", "driverKind": "target-cc", "compiler": "target-capable C compiler", "selectionSource": "target-manifest", "targetTriple": "aarch64-linux-musl", "linkerFlavor": "target-cc", "libcMode": "bundled-libc", "requiresSysroot": false, "sysrootEnv": "", "sysrootStatus": "not-required"},
    {"target": "linux-x64", "status": "warning", "message": "target-capable C compiler is required for linux-x64; pass --cc/ZERO_CC or install the bundled-toolchain default", "driverKind": "target-cc", "compiler": "target-capable C compiler", "selectionSource": "target-manifest", "targetTriple": "x86_64-linux-gnu", "linkerFlavor": "target-cc", "libcMode": "sysroot", "requiresSysroot": true, "sysrootEnv": "ZERO_SYSROOT_X86_64_LINUX_GNU", "sysrootStatus": "missing"},
    {"target": "linux-arm64", "status": "warning", "message": "target-capable C compiler is required for linux-arm64; pass --cc/ZERO_CC or install the bundled-toolchain default", "driverKind": "target-cc", "compiler": "target-capable C compiler", "selectionSource": "target-manifest", "targetTriple": "aarch64-linux-gnu", "linkerFlavor": "target-cc", "libcMode": "sysroot", "requiresSysroot": true, "sysrootEnv": "ZERO_SYSROOT_AARCH64_LINUX_GNU", "sysrootStatus": "missing"},
    {"target": "win32-x64.exe", "status": "warning", "message": "target-capable C compiler is required for win32-x64.exe; pass --cc/ZERO_CC or install the bundled-toolchain default", "driverKind": "target-cc", "compiler": "target-capable C compiler", "selectionSource": "target-manifest", "targetTriple": "x86_64-windows-msvc", "linkerFlavor": "lld-link", "libcMode": "sysroot", "requiresSysroot": true, "sysrootEnv": "ZERO_SYSROOT_X86_64_WINDOWS_MSVC", "sysrootStatus": "missing"},
    {"target": "win32-arm64.exe", "status": "warning", "message": "target-capable C compiler is required for win32-arm64.exe; pass --cc/ZERO_CC or install the bundled-toolchain default", "driverKind": "target-cc", "compiler": "target-capable C compiler", "selectionSource": "target-manifest", "targetTriple": "aarch64-windows-msvc", "linkerFlavor": "lld-link", "libcMode": "sysroot", "requiresSysroot": true, "sysrootEnv": "ZERO_SYSROOT_AARCH64_WINDOWS_MSVC", "sysrootStatus": "missing"}
  ],
zero build --emit exe --target linux-musl-x64 examples/hello.0 --out .zero/out/hello

出力例

.zero/out/hello (241 B, 7 ms)

 
ローカルチェックアウトからコンパイラをビルドするには、リポジトリラッパーを使用します :

pnpm install
make -C native/zero-c
bin/zero --version

出力例

% pnpm install
Lockfile is up to date, resolution step is skipped
Packages: +23
+++++++++++++++++++++++
Progress: resolved 23, reused 14, downloaded 9, added 23, done

devDependencies:
+ @types/node 25.7.0
+ @vercel/sandbox 1.10.2
+ typescript 6.0.3

Done in 976ms using pnpm v10.11.0

% make -C native/zero-c
cc -std=c11 -Wall -Wextra -Wpedantic -Os -Iinclude src/checker.c src/emit_coff.c src/emit_elf_aarch64.c src/emit_elf64.c src/emit_macho64.c src/fs.c src/ir.c src/lexer.c src/main.c src/parser.c src/target.c -o ../../.zero/bin/zero

% bin/zero --version
zero 0.1.3

リポジトリ検証コマンドは以下のとおりです :

pnpm run conformance
pnpm run native:test
pnpm run docs:test
ZERO_BENCH_RUNS=1 pnpm run bench

 

以上