Skip to content

Fix toolchain Docker build: pre-fetch Nanvix OS artifacts#15

Closed
ppenna wants to merge 1 commit into
mainfrom
fix/dockerfile-prefetch-nanvix-os-artifacts
Closed

Fix toolchain Docker build: pre-fetch Nanvix OS artifacts#15
ppenna wants to merge 1 commit into
mainfrom
fix/dockerfile-prefetch-nanvix-os-artifacts

Conversation

@ppenna

@ppenna ppenna commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Problem

The toolchain image build fails at the GCC stage 0 configure step:

ERROR: Failed to download Nanvix release. Ensure 'gh' is installed and authenticated.
[ERROR] Failed to download dependencies
[ERROR] Configuration failed

The GCC z script on the v13.3.0 branch added a step in download_steps() (run during ./z configure) that downloads the public nanvix/nanvix OS release (v0.13.17) via gh release download to stage libposix.a, user.ld, and the nanvixd binaries into the install prefix. gh is not installed or authenticated inside this Docker builder, so the build fails. (The nanvix/gcc and nanvix/newlib CI builds succeed because GitHub-hosted runners ship gh with a token.)

Fix

Stage the same Nanvix OS artifacts into ${PREFIX} with curl before building GCC. The z script then detects them as already present and skips the gh download:

Nanvix OS libraries already present in '/opt/nanvix/lib/'.

The release tag, asset name and SHA-256 mirror the constants in nanvix/gcc's z script, and are exposed as ARGs for easy maintenance. No build secrets or auth required (the asset is public).

Validation

Built the image locally with the latest published component tags:

  • BINUTILS_COMMIT=nanvix-v2.42-686c3b0673c
  • GCC_COMMIT=nanvix-v13.3.0-e795b98ca52-stage1
  • NEWLIB_COMMIT=nanvix-v4.4.0-c3cdbe37a-gcc

Results:

  • Full build succeeds (binutils -> GCC stage 0 -> newlib -> GCC stage 1).
  • Runtime smoke test passes: i686-nanvix-gcc (GCC) 13.3.0, i686-nanvix-g++ (GCC) 13.3.0, GNU assembler/ld (GNU Binutils) 2.42.
  • CI-equivalent cross-compile test: i686-nanvix-gcc compiles tests/hello.c to a valid i686 ELF32 EXEC executable.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

The GCC `z` script (v13.3.0) downloads the public nanvix/nanvix OS
release via `gh` during `z configure` to obtain libposix.a, user.ld and
the nanvixd binaries. `gh` is not installed or authenticated inside the
Docker builder, so the toolchain build failed at the GCC stage0 configure
step with "Failed to download Nanvix release".

Stage these artifacts into the install prefix with curl before building
GCC. The `z` script then detects them and skips the `gh` download. The
release tag, asset name and SHA-256 mirror the constants in nanvix/gcc's
`z` script.

Validated locally: full image build succeeds and i686-nanvix-gcc 13.3.0
cross-compiles tests/hello.c to a valid i686 ELF executable.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ppenna

ppenna commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by nanvix/gcc#58, which decouples the Nanvix OS artifact download from z configure (the proper upstream fix). The toolchain Dockerfile no longer needs the curl pre-fetch hack.

@ppenna ppenna closed this Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant