daax-dev / daax-dev/nanofuse

image build: CLI fails with CGO-less build (SQLite layer-cache stub) even with --no-cache

Open
#310 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

nanofuse
Dominant language
Go
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Summary

nanofuse image build cannot run when the nanofuse CLI is built with CGO_ENABLED=0 (the default mage cli build), because it opens a SQLite layer-cache database at startup:

Error: cannot create layer cache: failed to open cache database: failed to enable foreign keys:
Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub

--no-cache does not avoid this — the cache DB is still initialized:

No-cache:  true
Error: cannot create layer cache: ... go-sqlite3 requires cgo to work. This is a stub

Details

  • The daemon (nanofused) is built with CGO (mage notes "with CGO for SQLite"), but the CLI (nanofuse) is not — yet the CLI hosts image build, which needs SQLite for the layer cache.
  • Workaround: rebuild the CLI with CGO_ENABLED=1 go build ./cmd/nanofuse (then image build proceeds past this point).

Fix direction

Either build the nanofuse CLI with CGO in the mage cli target (since image build needs it), or make --no-cache genuinely skip opening the cache DB (no SQLite dependency when caching is off), or move the layer cache to a CGO-free store.

Impact

image build is unusable from a standard CLI build; only a manually CGO-rebuilt CLI works.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the mage cli target and the nanofuse image build startup path, focusing on where the SQLite layer cache is initialized and how --no-cache is handled. Determine which fix direction fits the project, then verify that a standard CGO-less CLI can run image build and that no-cache behavior avoids an unnecessary cache database dependency.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sqlite
Domain
build-system, cli, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.