Julien-cpsn / ATAC

A simple API client (postman like) in your terminal
https://atac.julien-cpsn.com/
MIT License
2.02k stars 86 forks source link

[BUG] Can't Install with Cargo #111

Open Tahinli opened 2 months ago

Tahinli commented 2 months ago

Hi, I saw this project couple minutes ago in Orhun's FrOSCon 2024 presentation and wanted to install immediately. Unfortunately I got error when I try cargo install atac This is not happening with cargo install atac --locked

error[E0277]: `Cell<std::option::Option<NonNull<LinkedListLink>>>` cannot be shared between threads safely
   --> /home/tahinli/.cargo/registry/src/index.crates.io-6f17d22bba15001f/boa_engine-0.19.0/src/builtins/atomics/futex.rs:161:37
    |
161 | ...atic CRITICAL_SECTION: Mutex<FutexWaiters> = Mutex::new(FutexWaiters {
    |                           ^^^^^^^^^^^^^^^^^^^ `Cell<std::option::Option<NonNull<LinkedListLink>>>` cannot be shared between threads safely
    |
    = help: within `FutexWaiter`, the trait `Sync` is not implemented for `Cell<std::option::Option<NonNull<LinkedListLink>>>`, which is required by `Mutex<FutexWaiters>: Sync`
    = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock`
note: required because it appears within the type `LinkedListLink`
   --> /home/tahinli/.cargo/registry/src/index.crates.io-6f17d22bba15001f/intrusive-collections-0.9.7/src/linked_list.rs:63:12
    |
63  | pub struct Link {
    |            ^^^^
note: required because it appears within the type `FutexWaiter`
   --> /home/tahinli/.cargo/registry/src/index.crates.io-6f17d22bba15001f/boa_engine-0.19.0/src/builtins/atomics/futex.rs:167:19
    |
167 | pub(crate) struct FutexWaiter {
    |                   ^^^^^^^^^^^
    = note: required for `UnsafeRef<FutexWaiter>` to implement `Send`
    = note: 2 redundant requirements hidden
    = note: required for `NodeRef<Owned, usize, LinkedList<FutexWaiterAdapter>, ...>` to implement `Send`
note: required because it appears within the type `Option<NodeRef<Owned, usize, LinkedList<...>, ...>>`
   --> /home/tahinli/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:574:10
    |
574 | pub enum Option<T> {
    |          ^^^^^^
note: required because it appears within the type `BTreeMap<usize, intrusive_collections::LinkedList<FutexWaiterAdapter>>`
   --> /home/tahinli/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/collections/btree/map.rs:173:12
    |
173 | pub struct BTreeMap<
    |            ^^^^^^^^
note: required because it appears within the type `small_map::Inner<usize, intrusive_collections::LinkedList<FutexWaiterAdapter>, 16>`
   --> /home/tahinli/.cargo/registry/src/index.crates.io-6f17d22bba15001f/boa_engine-0.19.0/src/small_map/mod.rs:30:6
    |
30  | enum Inner<K, V, const ARRAY_SIZE: usize> {
    |      ^^^^^
note: required because it appears within the type `SmallMap<usize, intrusive_collections::LinkedList<FutexWaiterAdapter>, 16>`
   --> /home/tahinli/.cargo/registry/src/index.crates.io-6f17d22bba15001f/boa_engine-0.19.0/src/small_map/mod.rs:25:19
    |
25  | pub(crate) struct SmallMap<K, V, const ARRAY_SIZE: usize> {
    |                   ^^^^^^^^
note: required because it appears within the type `FutexWaiters`
   --> /home/tahinli/.cargo/registry/src/index.crates.io-6f17d22bba15001f/boa_engine-0.19.0/src/builtins/atomics/futex.rs:178:19
    |
178 | pub(crate) struct FutexWaiters {
    |                   ^^^^^^^^^^^^
    = note: required for `Mutex<FutexWaiters>` to implement `Sync`
    = note: shared static variables must have a type that implements `Sync`
    = note: the full name for the type has been written to '/tmp/cargo-installGfCW6s/release/deps/boa_engine-666df1078c4c6020.long-type-12970242786354345523.txt'
    = note: consider using `--verbose` to print the full type name to the console
    = note: the full name for the type has been written to '/tmp/cargo-installGfCW6s/release/deps/boa_engine-666df1078c4c6020.long-type-18312804925675621542.txt'
    = note: consider using `--verbose` to print the full type name to the console

For more information about this error, try `rustc --explain E0277`.
error: could not compile `boa_engine` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `atac v0.18.0`, intermediate artifacts can be found at `/tmp/cargo-installGfCW6s`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

little PR that may help people: https://github.com/Julien-cpsn/ATAC/pull/112#issue-2512135012

ardrigh commented 2 months ago

The --locked option also throws warnings about crates being yanked. So either way using cargo install has some issues.

> cargo install atac --locked
    Updating crates.io index
  Installing atac v0.18.0
    Updating crates.io index
warning: package `bytemuck v1.16.1` in Cargo.lock is yanked in registry `crates-io`, consider running without --locked
warning: package `bytes v1.6.0` in Cargo.lock is yanked in registry `crates-io`, consider running without --locked
Tahinli commented 2 months ago

The --locked option also throws warnings about crates being yanked. So either way using cargo install has some issues.

Yep it throws warnings but at least compile and run. Since we can't follow every update of every dependency, locked will provide us consistency.

rcornea commented 1 month ago

i just ran into this 'boa_engine' compilation fail today when trying to 'cargo install atac'.

installed rustc version is 1.79.0, as requested in the README.

edit: 'rustup update'd to rustc 1.81.0, 'boa_engine' still won't compile.

edit2: cloned the ATAC repo and both 'cargo run' and 'cargo build --release' result in a successful compilation. this looks like some kind of crates.io packaging problem?

it seems the boa project tracked the issue here https://github.com/boa-dev/boa/issues/3982, but somehow marked it as completed without ever referencing any commits that might have solved it.