Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to compile/install tree-sitter #96

Open
SamuelLarkin opened this issue May 8, 2024 · 5 comments
Open

Unable to compile/install tree-sitter #96

SamuelLarkin opened this issue May 8, 2024 · 5 comments

Comments

@SamuelLarkin
Copy link
Collaborator

SamuelLarkin commented May 8, 2024

Command

cargo install tree-sitter-cli

Logs

error[E0463]: can't find crate for `thiserror_impl`
   --> /home/larkins/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thiserror-1.0.60/src/lib.rs:248:9
    |
248 | pub use thiserror_impl::*;
    |         ^^^^^^^^^^^^^^ can't find crate

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

Info

which cargo
~/.cargo/bin/cargo
cargo --version
cargo 1.78.0 (54d8815d0 2024-03-26)
@nrcfieldsa
Copy link

Reproduced in new cargo install under my $HOME.

The issue does not appear to be related to disk space or a system error. Instead, it looks like there is an application / code issue with the following:

  • thiserror-impl: missing crate

Attempting to run the: cargo build command in the temporary path of thiserror results in the same issue with the following line: pub use thiserror_impl::*: can't find crate

The versions involved are:

  • thiserror-1.0.60
  • thiserror-impl-1.0.60

Attempting to use thiserror-1.0.59, results in the same error, has an issue with the line when using thiserror_impl.

@nrcfieldsa
Copy link

nrcfieldsa commented May 9, 2024

Even when getting this error the crate file can be seen to exist in the cache:

[admin.allan.fields@trixie-hn1 index.crates.io-6f17d22bba15001f]$ ls thiserror*
thiserror-1.0.60.crate  thiserror-impl-1.0.60.crate

[admin.allan.fields@trixie-hn1 index.crates.io-6f17d22bba15001f]$ ls *tree*
tree-sitter-0.22.6.crate      tree-sitter-config-0.22.6.crate     tree-sitter-loader-0.22.6.crate
tree-sitter-cli-0.22.6.crate  tree-sitter-highlight-0.22.6.crate  tree-sitter-tags-0.22.6.crate

@nrcfieldsa
Copy link

nrcfieldsa commented May 9, 2024

It seems there is a prior occurrence of a similar issue on macos related to corrupted cache entries and use of different tar. While I can't see why it would happen on Linux, it has a similar symptom (that cache entries do not exist or that the library checksum is invalid.)

apollographql/federation#123

Switching to a stable vesrion of rust vs. nightly as the default target and remove and re-creating my local cache didn't seem to work.

rustup default stable
rustup run default rustc --version
rustc 1.78.0 (9b00956e5 2024-04-29)
rustup run stable cargo install tree-sitter-cli
   Compiling regex v1.10.4
   Compiling thiserror-impl v1.0.60
   Compiling serde_derive v1.0.201
   Compiling clap_derive v4.5.4
error[E0463]: can't find crate for `thiserror_impl`
   --> /home/admin.allan.fields/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thiserror-1.0.60/src/lib.rs:248:9
    |
248 | pub use thiserror_impl::*;
    |         ^^^^^^^^^^^^^^ can't find crate

For more information about this error, try `rustc --explain E0463`.
error: could not compile `thiserror` (lib) due to 1 previous error
[admin.allan.fields@trixie-hn1 src]$ rustup update stable
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.78.0 (9b00956e5 2024-04-29)

info: checking for self-update
[admin.allan.fields@trixie-hn1 src]$ rustup run stable rustc --version
rustc 1.78.0 (9b00956e5 2024-04-29)

@nrcfieldsa
Copy link

Easy fix found. (Disable CCVMFS and it works)

$ which tar
$ module list
$ module --force purge   # disable CVMFS 
$ module list
$ which tar
$ rustup run stable cargo install tree-sitter-cli
[admin.allan.fields@trixie-hn1 src]$ rustup run stable cargo install tree-sitter-cli
    Updating crates.io index
  Installing tree-sitter-cli v0.22.6
    Updating crates.io index
   Compiling proc-macro2 v1.0.82
   Compiling unicode-ident v1.0.12
   Compiling cfg-if v1.0.0
   Compiling version_check v0.9.4
   Compiling libc v0.2.154
   Compiling cc v1.0.97
   Compiling bitflags v2.5.0
   Compiling once_cell v1.19.0
   Compiling memchr v2.7.2
   Compiling zerocopy v0.7.34
   Compiling regex-syntax v0.8.3
   Compiling serde v1.0.201
   Compiling thiserror v1.0.60
   Compiling rustix v0.38.34
   Compiling tinyvec_macros v0.1.1
   Compiling equivalent v1.0.1
   Compiling cfg_aliases v0.1.1
   Compiling serde_json v1.0.117
   Compiling linux-raw-sys v0.4.13
   Compiling utf8parse v0.2.1
   Compiling anyhow v1.0.83
   Compiling option-ext v0.2.0
   Compiling itoa v1.0.11
   Compiling colorchoice v1.0.1
   Compiling is_terminal_polyfill v1.70.0
   Compiling unicode-bidi v0.3.15
   Compiling anstyle-query v1.0.3
   Compiling semver v1.0.23
   Compiling anstyle v1.0.7
   Compiling percent-encoding v2.3.1
   Compiling ryu v1.0.18
   Compiling clap_lex v0.7.0
   Compiling tinyvec v1.6.0
   Compiling heck v0.5.0
   Compiling nix v0.28.0
   Compiling anstyle-parse v0.2.4
   Compiling strsim v0.11.1
   Compiling tree-sitter-loader v0.22.6
   Compiling fastrand v2.1.0
   Compiling log v0.4.21
   Compiling lazy_static v1.4.0
   Compiling form_urlencoded v1.2.1
   Compiling libloading v0.8.3
   Compiling httpdate v1.0.3
   Compiling ahash v0.8.11
   Compiling aho-corasick v1.1.3
   Compiling anstream v0.6.14
   Compiling unicode-normalization v0.1.23
   Compiling same-file v1.0.6
   Compiling chunked_transfer v1.5.0
   Compiling indoc v2.0.5
   Compiling ascii v1.1.0
   Compiling utf8-width v0.1.7
   Compiling home v0.5.9
   Compiling tree-sitter-cli v0.22.6
   Compiling rustc-hash v1.1.0
   Compiling glob v0.3.1
   Compiling smallbitvec v2.5.3
   Compiling difference v2.0.0
   Compiling ansi_term v0.12.1
   Compiling walkdir v2.5.0
   Compiling html-escape v0.2.13
   Compiling clap_builder v4.5.2
   Compiling tree-sitter v0.22.6
   Compiling tiny_http v0.12.0
   Compiling hashbrown v0.14.5
   Compiling idna v0.5.0
   Compiling quote v1.0.36
   Compiling syn v2.0.61
   Compiling url v2.5.0
   Compiling regex-automata v0.4.6
   Compiling indexmap v2.2.6
   Compiling dirs-sys v0.4.1
   Compiling filetime v0.2.23
   Compiling webbrowser v1.0.1
   Compiling dirs v5.0.1
   Compiling fs4 v0.8.3
   Compiling tempfile v3.10.1
   Compiling wasmparser v0.206.0
   Compiling ctrlc v3.4.4
   Compiling serde_derive v1.0.201
   Compiling thiserror-impl v1.0.60
   Compiling clap_derive v4.5.4
   Compiling regex v1.10.4
   Compiling clap v4.5.4
   Compiling tree-sitter-tags v0.22.6
   Compiling tree-sitter-highlight v0.22.6
   Compiling tree-sitter-config v0.22.6
    Finished `release` profile [optimized] target(s) in 33.23s
  Installing /home/admin.allan.fields/.cargo/bin/tree-sitter
   Installed package `tree-sitter-cli v0.22.6` (executable `tree-sitter`)
[admin.allan.fields@trixie-hn1 src]$ tree-sitter -h
tree-sitter 0.22.6
Max Brunsfeld <maxbrunsfeld@gmail.com>
Generates and tests parsers

Usage: tree-sitter <COMMAND>

Commands:
  init-config     Generate a default config file
  generate        Generate a parser
  build           Compile a parser
  build-wasm      Compile a parser to WASM
  parse           Parse files
  test            Run a parser's tests
  query           Search files using a syntax tree query
  highlight       Highlight a file
  tags            Generate a list of tags
  playground      Start local playground for a parser in the browser
  dump-languages  Print info about all known language parsers

Options:
  -h, --help     Print help
  -V, --version  Print version
[admin.allan.fields@trixie-hn1 src]$

@SamuelLarkin
Copy link
Collaborator Author

Thanks for your help @nrcfieldsa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants