image build: CLI fails with CGO-less build (SQLite layer-cache stub) even with --no-cache
Nobody has claimed this yet.
- 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 (magenotes "with CGO for SQLite"), but the CLI (nanofuse) is not — yet the CLI hostsimage build, which needs SQLite for the layer cache. - Workaround: rebuild the CLI with
CGO_ENABLED=1 go build ./cmd/nanofuse(thenimage buildproceeds 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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