build: forward -Dshadow to zquic so downstreams dedupe it (release v0.1.3) - #82
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A downstream that depends on both zig-ethp2p and zig-libp2p (e.g. zeam) failed to link with:
Zig keys dependency deduplication on the option set passed to
b.dependency. zig-libp2p instantiates zquic asb.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
-Dshadowbuild option (defaultfalse, 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.