01mf02 / jaq

A jq clone focussed on correctness, speed, and simplicity
MIT License
2.61k stars 63 forks source link

Build failure for v1.3.0 on macos & linux, but building from latest main (1699a7d1fc7ede) works #176

Closed derekfrye closed 4 weeks ago

derekfrye commented 2 months ago

I just tried to compile the latest version with cargo, and maybe I'm doing something wrong but I can only get v1.2.0 to build. Here's what I tried.

Note, if i either cargo install jaq --version "1.2.0" or I clone from git (1699a7d1fc7ede as of now) I can build either of those. So IDK..? I am pretty new to rust so maybe I'm missing a step?

$ uname -a
Darwin NUSLANYKC904450 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:19:22 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T8112 arm64
$ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
$ rustc --version
rustc 1.77.2 (25ef9e3d8 2024-04-09)
$ cargo --version
cargo 1.77.2 (e52e36006 2024-03-26)
$ cargo install jaq
    Updating crates.io index
    Installing jaq v1.3.0
    Updating crates.io index
  Downloaded cc v1.0.96
  Downloaded 1 crate (76.6 KB) in 1.02s
   Compiling proc-macro2 v1.0.81
   ...
   Compiling jaq v1.3.0
error[E0599]: no variant or associated item named `Unset` found for enum `ariadne::Color` in the current scope
   --> /Users/a0761532/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jaq-1.3.0/src/main.rs:476:17
    |
476 |         (Color::Unset, Color::Unset)
    |                 ^^^^^ variant or associated item not found in `Color`

error[E0599]: no variant or associated item named `Unset` found for enum `ariadne::Color` in the current scope
   --> /Users/a0761532/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jaq-1.3.0/src/main.rs:476:31
    |
476 |         (Color::Unset, Color::Unset)
    |                               ^^^^^ variant or associated item not found in `Color`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `jaq` (bin "jaq") due to 2 previous errors
error: failed to compile `jaq v1.3.0`, intermediate artifacts can be found at `/var/folders/vf/9dvlj94d7d990822xvnpbqn40000gn/T/cargo-installa6qIVu`.

I get the same thing on my linux machine.

$ uname -a
Linux m1n3 6.8.7-402.asahi.fc39.aarch64+16k #1 SMP PREEMPT_DYNAMIC Wed Apr 24 00:11:34 UTC 2024 aarch64 GNU/Linux
qtfkwk commented 2 months ago

I'm on LInux and getting the same error installing via either cargo install jaq or cargo install --git https://github.com/01mf02/jaq, but the line reference I see is jaq/src/main.rs:498 not 476.

Color::Unset is indeed invalid, according to the Color enum:

enum Color {
    Always,
    Auto,
    Never,
}

How was this even able to publish to crates.io?

EDIT: Wrong Color... I missed use ariadne::{Color, Fmt, Label, Report, ReportKind}; on line 490

qtfkwk commented 2 months ago

ariadne::Color is really yansi::Color...

jaq depends on ariadne 0.4.0 (released 2024-01-01; 0.4.1 was just released 2024-04-25 but last commit to jaq was 2024-04-19)...

But this is weird: ariadne 0.4.0 depends on yansi 0.5.0 (released 2018-11-30; but latest is 1.0.1 on 2024-03-13)... so... ?

Also: yansi 0.5.0 Color::Unset is valid (?)

Side note relating to my previous comment: jaq/src/main.rs has a different Color enum, hence the use ariadne::{Color, Fmt, Label, Report, ReportKind}; on line 490.

qtfkwk commented 2 months ago

yansi::Color::Unset was removed on 2023-07-06: https://github.com/SergioBenitez/yansi/commit/b186eb5bfb9023969e78a958a7589d3860058ae8#diff-12d1cf56d5d03c679a5f8f1c48cfe969a5c4276a1bee8647cc548de13f18e465L9

aretrosen commented 2 months ago

@qtfkwk when you do cargo install --git https://github.com/aretrosen/jaq.git, the Cargo.lock file is not used. See https://github.com/rust-lang/cargo/issues/7169. Use cargo install --git https://github.com/aretrosen/jaq.git --locked.

01mf02 commented 2 months ago

This issue is due to a release of the ariadne package that does not respect semantic versioning. In the meantime, you can use cargo install --locked jaq.