Skip to content

build: forward -Dshadow to zquic so downstreams dedupe it (release v0.1.3) - #82

Merged
ch4r10t33r merged 1 commit into
mainfrom
fix/zquic-dedup-shadow
Jul 14, 2026
Merged

build: forward -Dshadow to zquic so downstreams dedupe it (release v0.1.3)#82
ch4r10t33r merged 1 commit into
mainfrom
fix/zquic-dedup-shadow

Conversation

@ch4r10t33r

Copy link
Copy Markdown
Collaborator

Problem

A downstream that depends on both zig-ethp2p and zig-libp2p (e.g. zeam) failed to link with:

error: file exists in modules 'zquic' and 'zquic0'

Zig keys dependency deduplication on the option set passed to b.dependency. zig-libp2p instantiates zquic as b.dependency("zquic", .{ .target, .optimize, .shadow }), whereas this package passed only .{ .target, .optimize }. The differing option sets produced two distinct zquic module instances that collide when linked into one binary. (Matching only the URL/hash was not enough — the option set must match too.)

Fix

Add a -Dshadow build option (default false, identical name/default to zig-libp2p) and forward it to the zquic dependency, so both parents instantiate zquic with the same option set and Zig resolves a single shared module.

No source changes. Verified locally: zig-ethp2p suite stays green, and a downstream zeam build that pulls both zig-ethp2p and zig-libp2p now links a single zquic and builds cleanly.

zig-libp2p instantiates zquic as `b.dependency("zquic", .{..., .shadow})`,
while this package passed no `.shadow`. Zig keys dependency deduplication on
the option set, so the differing sets produced two separate zquic module
instances in any downstream (e.g. zeam) that pulls both zig-ethp2p and
zig-libp2p — colliding as `error: file exists in modules 'zquic' and
'zquic0'`.

Add a `-Dshadow` build option (default false, same name/default as
zig-libp2p) and forward it to the zquic dependency so both instantiate zquic
with an identical option set and Zig resolves a single shared module.
@ch4r10t33r
ch4r10t33r merged commit cffd2c8 into main Jul 14, 2026
7 checks passed
@ch4r10t33r
ch4r10t33r deleted the fix/zquic-dedup-shadow branch July 14, 2026 17:04
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