polarmutex / beancount-language-server

A Language Server Protocol (LSP) for beancount files
MIT License
139 stars 15 forks source link

cargo install error due to conflicting tree-sitter versions #529

Closed rmiceli closed 1 month ago

rmiceli commented 1 month ago

Installation fails on my laptop (fedora 40, rust v1.79.0) with cargo install beancount-language-server

It looks like cargo compiles both tree-sitter v0.20.10 and v0.22.6, and then runs into a conflict when trying to compile beancount-language-server.

Is anyone else running into this issue? Or maybe this is just a problem with my setup?

Here is the complete installation log. Let me know if more info would help.

> cargo install beancount-language-server
Installing crate beancount-language-server@1.3.4…
    Updating crates.io index
  Installing beancount-language-server v1.3.4
    Updating crates.io index
     Locking 131 packages to latest compatible versions
      Adding bitflags v1.3.2 (latest: v2.6.0)
      Adding dashmap v5.5.3 (latest: v6.0.1)
      Adding hermit-abi v0.3.9 (latest: v0.4.0)
      Adding idna v0.5.0 (latest: v1.0.2)
      Adding lsp-types v0.95.1 (latest: v0.97.0)
      Adding matchers v0.1.0 (latest: v0.2.0)
      Adding regex-automata v0.1.10 (latest: v0.4.7)
      Adding regex-syntax v0.6.29 (latest: v0.8.4)
      Adding tree-sitter v0.20.10 (latest: v0.22.6)
      Adding wasi v0.11.0+wasi-snapshot-preview1 (latest: v0.13.1+wasi-0.2.0)
      Adding windows-core v0.52.0 (latest: v0.58.0)
      Adding windows-sys v0.48.0 (latest: v0.52.0)
      Adding windows-targets v0.48.5 (latest: v0.52.6)
      Adding windows_aarch64_gnullvm v0.48.5 (latest: v0.52.6)
      Adding windows_aarch64_msvc v0.48.5 (latest: v0.52.6)
      Adding windows_i686_gnu v0.48.5 (latest: v0.52.6)
      Adding windows_i686_msvc v0.48.5 (latest: v0.52.6)
      Adding windows_x86_64_gnu v0.48.5 (latest: v0.52.6)
      Adding windows_x86_64_gnullvm v0.48.5 (latest: v0.52.6)
      Adding windows_x86_64_msvc v0.48.5 (latest: v0.52.6)
   Compiling proc-macro2 v1.0.86
   Compiling unicode-ident v1.0.12
   Compiling libc v0.2.155
   Compiling cc v1.1.6
   Compiling memchr v2.7.4
   Compiling autocfg v1.3.0
   Compiling regex-syntax v0.8.4
   Compiling once_cell v1.19.0
   Compiling serde v1.0.204
   Compiling cfg-if v1.0.0
   Compiling smallvec v1.13.2
   Compiling itoa v1.0.11
   Compiling crossbeam-utils v0.8.20
   Compiling tinyvec_macros v0.1.1
   Compiling serde_json v1.0.120
   Compiling utf8parse v0.2.2
   Compiling tinyvec v1.8.0
   Compiling regex-syntax v0.6.29
   Compiling log v0.4.22
   Compiling anstyle-parse v0.2.4
   Compiling colorchoice v1.0.1
   Compiling lazy_static v1.5.0
   Compiling tracing-core v0.1.32
   Compiling pin-project-lite v0.2.14
   Compiling percent-encoding v2.3.1
   Compiling anstyle v1.0.7
   Compiling thiserror v1.0.63
   Compiling anstyle-query v1.1.0
   Compiling is_terminal_polyfill v1.70.0
   Compiling unicode-bidi v0.3.15
   Compiling parking_lot_core v0.9.10
   Compiling option-ext v0.2.0
   Compiling powerfmt v0.2.0
   Compiling num-traits v0.2.19
   Compiling lock_api v0.4.12
   Compiling ryu v1.0.18
   Compiling deranged v0.3.11
   Compiling anstream v0.6.14
   Compiling aho-corasick v1.1.3
   Compiling form_urlencoded v1.2.1
   Compiling tracing-log v0.2.0
   Compiling quote v1.0.36
   Compiling dirs-sys v0.4.1
   Compiling crossbeam-channel v0.5.13
   Compiling syn v2.0.72
   Compiling sharded-slab v0.1.7
   Compiling unicode-normalization v0.1.23
   Compiling thread_local v1.1.8
   Compiling anyhow v1.0.86
   Compiling clap_lex v0.7.1
   Compiling strsim v0.11.1
   Compiling num-conv v0.1.0
   Compiling time-core v0.1.2
   Compiling scopeguard v1.2.0
   Compiling idna v0.5.0
   Compiling time v0.3.36
   Compiling clap_builder v4.5.10
   Compiling dirs v5.0.1
   Compiling num_cpus v1.16.0
   Compiling iana-time-zone v0.1.60
   Compiling tree-sitter v0.22.6
   Compiling regex-automata v0.1.10
   Compiling regex-automata v0.4.7
   Compiling tree-sitter v0.20.10
   Compiling tree-sitter-beancount v2.3.3
   Compiling bitflags v1.3.2
   Compiling str_indices v0.4.3
   Compiling hashbrown v0.14.5
   Compiling ropey v1.6.1
   Compiling chrono v0.4.38
   Compiling threadpool v1.8.1
   Compiling matchers v0.1.0
   Compiling shellexpand v3.1.0
   Compiling dashmap v5.5.3
   Compiling bytes v1.6.1
   Compiling linked-list v0.0.3
   Compiling glob v0.3.1
   Compiling regex v1.10.5
   Compiling clap v4.5.10
   Compiling serde_derive v1.0.204
   Compiling tracing-attributes v0.1.27
   Compiling thiserror-impl v1.0.63
   Compiling serde_repr v0.1.19
   Compiling tracing v0.1.40
   Compiling tracing-subscriber v0.3.18
   Compiling tracing-appender v0.2.3
   Compiling url v2.5.2
   Compiling lsp-types v0.95.1
   Compiling lsp-server v0.7.6
   Compiling beancount-language-server v1.3.4
error[E0308]: mismatched types
    --> /home/rob/.var/app/io.neovim.nvim/data/cargo/registry/src/index.crates.io-6f17d22bba15001f/beancount-language-server-1.3.4/src/beancount_data.rs:124:45
     |
124  |         let query = tree_sitter::Query::new(tree_sitter_beancount::language(), query_string)
     |                     ----------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `tree_sitter::Language`, found a different `tree_sitter::Language`
     |                     |
     |                     arguments to this function are incorrect
     |
     = note: `tree_sitter::Language` and `tree_sitter::Language` have similar names, but are actually distinct types
note: `tree_sitter::Language` is defined in crate `tree_sitter`
    --> /home/rob/.var/app/io.neovim.nvim/data/cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.22.6/binding_rust/lib.rs:54:1
     |
54   | pub struct Language(*const ffi::TSLanguage);
     | ^^^^^^^^^^^^^^^^^^^
note: `tree_sitter::Language` is defined in crate `tree_sitter`
    --> /home/rob/.var/app/io.neovim.nvim/data/cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.20.10/binding_rust/lib.rs:43:1
     |
43   | pub struct Language(*const ffi::TSLanguage);
     | ^^^^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `tree_sitter` are being used?
note: associated function defined here
    --> /home/rob/.var/app/io.neovim.nvim/data/cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.20.10/binding_rust/lib.rs:1348:12
     |
1348 |     pub fn new(language: Language, source: &str) -> Result<Self, QueryError> {
     |            ^^^

error[E0308]: mismatched types
    --> /home/rob/.var/app/io.neovim.nvim/data/cargo/registry/src/index.crates.io-6f17d22bba15001f/beancount-language-server-1.3.4/src/beancount_data.rs:145:45
     |
145  |         let query = tree_sitter::Query::new(tree_sitter_beancount::language(), query_string)
     |                     ----------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `tree_sitter::Language`, found a different `tree_sitter::Language`
     |                     |
     |                     arguments to this function are incorrect
     |
     = note: `tree_sitter::Language` and `tree_sitter::Language` have similar names, but are actually distinct types
note: `tree_sitter::Language` is defined in crate `tree_sitter`
    --> /home/rob/.var/app/io.neovim.nvim/data/cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.22.6/binding_rust/lib.rs:54:1
     |
54   | pub struct Language(*const ffi::TSLanguage);
     | ^^^^^^^^^^^^^^^^^^^
note: `tree_sitter::Language` is defined in crate `tree_sitter`
    --> /home/rob/.var/app/io.neovim.nvim/data/cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.20.10/binding_rust/lib.rs:43:1
     |
43   | pub struct Language(*const ffi::TSLanguage);
     | ^^^^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `tree_sitter` are being used?
note: associated function defined here
    --> /home/rob/.var/app/io.neovim.nvim/data/cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.20.10/binding_rust/lib.rs:1348:12
     |
1348 |     pub fn new(language: Language, source: &str) -> Result<Self, QueryError> {
     |            ^^^

error[E0308]: mismatched types
   --> /home/rob/.var/app/io.neovim.nvim/data/cargo/registry/src/index.crates.io-6f17d22bba15001f/beancount-language-server-1.3.4/src/forest.rs:60:33
    |
60  |             parser.set_language(tree_sitter_beancount::language())?;
    |                    ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `tree_sitter::Language`, found a different `tree_sitter::Language`
    |                    |
    |                    arguments to this method are incorrect
    |
    = note: `tree_sitter::Language` and `tree_sitter::Language` have similar names, but are actually distinct types
note: `tree_sitter::Language` is defined in crate `tree_sitter`
   --> /home/rob/.var/app/io.neovim.nvim/data/cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.22.6/binding_rust/lib.rs:54:1
    |
54  | pub struct Language(*const ffi::TSLanguage);
    | ^^^^^^^^^^^^^^^^^^^
note: `tree_sitter::Language` is defined in crate `tree_sitter`
   --> /home/rob/.var/app/io.neovim.nvim/data/cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.20.10/binding_rust/lib.rs:43:1
    |
43  | pub struct Language(*const ffi::TSLanguage);
    | ^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `tree_sitter` are being used?
note: method defined here
   --> /home/rob/.var/app/io.neovim.nvim/data/cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.20.10/binding_rust/lib.rs:357:12
    |
357 |     pub fn set_language(&mut self, language: Language) -> Result<(), LanguageError> {
    |            ^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /home/rob/.var/app/io.neovim.nvim/data/cargo/registry/src/index.crates.io-6f17d22bba15001f/beancount-language-server-1.3.4/src/handlers.rs:35:31
    |
35  |                 .set_language(tree_sitter_beancount::language())
    |                  ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `tree_sitter::Language`, found a different `tree_sitter::Language`
    |                  |
    |                  arguments to this method are incorrect
    |
    = note: `tree_sitter::Language` and `tree_sitter::Language` have similar names, but are actually distinct types
note: `tree_sitter::Language` is defined in crate `tree_sitter`
   --> /home/rob/.var/app/io.neovim.nvim/data/cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.22.6/binding_rust/lib.rs:54:1
    |
54  | pub struct Language(*const ffi::TSLanguage);
    | ^^^^^^^^^^^^^^^^^^^
note: `tree_sitter::Language` is defined in crate `tree_sitter`
   --> /home/rob/.var/app/io.neovim.nvim/data/cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.20.10/binding_rust/lib.rs:43:1
    |
43  | pub struct Language(*const ffi::TSLanguage);
    | ^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `tree_sitter` are being used?
note: method defined here
   --> /home/rob/.var/app/io.neovim.nvim/data/cargo/registry/src/index.crates.io-6f17d22bba15001f/tree-sitter-0.20.10/binding_rust/lib.rs:357:12
    |
357 |     pub fn set_language(&mut self, language: Language) -> Result<(), LanguageError> {
    |            ^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0308`.
error: could not compile `beancount-language-server` (lib) due to 4 previous errors
error: failed to compile `beancount-language-server v1.3.4`, intermediate artifacts can be found at `/tmp/cargo-installJjVd9U`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
spawn: cargo failed with exit code 101 and signal 0. 
polarmutex commented 1 month ago

the main branched has been fixed, I may need to do a patch release to fix cargo install issues

yacoob commented 1 month ago

Can we have that release, so it's installable via Mason again? :)

polarmutex commented 1 month ago

I pushed a release this morning, let me know if it is fixed

yacoob commented 1 month ago

Mason repo has updated the version they're referencing, and it installed fine just now :)

Thanks!