# marmot sysroot (/docs/commands/sysroot)

<!-- Generated by scripts/gen.mjs from `marmot sysroot --help` and scripts/commands.mjs. Do not edit by hand. -->

marmot sysroot add linux/arm64 fetches Debian stable's glibc and kernel headers, libc link files and gcc runtime files for the target into marmot's cache. The packages are checked against Debian's index. marmot build -target then compiles cgo packages for the target and links the executable here with ld.lld. -libc musl builds musl from its release source for marmot build -static. list shows what is installed, remove deletes one.

```text title="Usage"
marmot sysroot add|list|remove [-libc musl] [GOOS/GOARCH] [flags]
```

## Examples [#examples]

```sh
marmot sysroot add linux/arm64
marmot build -target linux/arm64 -o app .
marmot sysroot add -libc musl linux/amd64
marmot build -static -target linux/amd64 -o app .
marmot sysroot list
```

## Cross builds of cgo packages [#cross-builds-of-cgo-packages]

A cross build of a cgo package needs the C headers and libraries of the target.
`marmot sysroot add` fetches them once into marmot's cache:

```sh
marmot sysroot add linux/arm64
marmot build -target linux/arm64 -o app .
```

The glibc sysroot holds the glibc and kernel headers, libc's link files and gcc's runtime files of
Debian stable. marmot checks each package against Debian's index. The build links the executable
on your machine with ld.lld.

## Static executables with musl [#static-executables-with-musl]

```sh
marmot sysroot add -libc musl linux/amd64
marmot build -static -target linux/amd64 -o app .
```

The musl sysroot is built from the musl release source. `marmot sysroot list` shows what is
installed. `marmot sysroot remove` deletes one. [Cross builds](/docs/install#cross-builds) has more.

## Full help [#full-help]

```text title="marmot sysroot --help"
marmot sysroot add linux/arm64 fetches Debian stable's glibc and kernel headers, libc link files and gcc runtime files for the target into marmot's cache. The packages are checked against Debian's index. marmot build -target then compiles cgo packages for the target and links the executable here with ld.lld. -libc musl builds musl from its release source for marmot build -static. list shows what is installed, remove deletes one.

Usage:
  marmot sysroot add|list|remove [-libc musl] [GOOS/GOARCH] [flags]

Examples:
marmot sysroot add linux/arm64
marmot build -target linux/arm64 -o app .
marmot sysroot add -libc musl linux/amd64
marmot build -static -target linux/amd64 -o app .
marmot sysroot list

Flags:
  -h, --help   help for sysroot
```