Ship vendored sonic-rs in the Hex package - #49
Merged
Conversation
The root Cargo.toml redirects the sonic-rs dependency to the vendored
copy via `[patch.crates-io]`, and that Cargo.toml is published, but
native/sonic-rs was never in the `files:` list. Cargo then resolves the
patch to a path that does not exist in the package:
error: failed to load source for dependency `sonic-rs`
Caused by: Unable to update .../native/sonic-rs
Precompiled NIFs hide this for the eight targets the release workflow
builds, so it only surfaces when RustlerPrecompiled falls back to
compiling from source — musl/Alpine, Windows, and any NIF version other
than 2.15 — where the dependency cannot be installed at all.
Ship the crate's src, Cargo.toml, and LICENSE. Verified by unpacking the
built tarball and running `cargo build --release -p torque_nif` in it,
which now compiles sonic-rs from the package's own copy. Adds roughly
200 KB to a 41 KB tarball.
Owner
Author
|
@gilbertwong96 this is part of the 0.2.7 release which is now on hex.pm. Cheers! |
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.
Summary
The published Hex package cannot be built from source. The root
Cargo.toml— which is published — redirects the sonic-rs dependency to our vendored, patched copy:but
native/sonic-rswas never in thefiles:list, so Cargo resolves that patch to a path the package doesn't contain:Precompiled NIFs mask this for the eight targets the release workflow builds, so it only bites when
RustlerPrecompiledfalls back to compiling from source — musl/Alpine, Windows, any NIF version other than 2.15, or an explicitforce_build. Those users can't install Torque at all.This ships the crate's
src,Cargo.toml, andLICENSE(the last one also being the right thing to do for vendored third-party code).Verified by unpacking the built tarball and compiling it standalone:
Before this change the same command fails at
cargo metadatawith exit 101.Tarball grows from ~41 KB to roughly 240 KB.
Note: this defect predates v0.2.6 — v0.2.5 and earlier have it too. v0.2.6 is tagged and on GitHub Releases but was never published to Hex, so no released package needs correcting.