BrianHicks/tree-grepper

Can't build with cargo

roland-5 opened this issue · 2 comments

I cloned repository and tried cargo build --release:

   Compiling libc v0.2.138
   Compiling cfg-if v1.0.0
   Compiling autocfg v1.1.0
   Compiling crossbeam-utils v0.8.14
   Compiling proc-macro2 v1.0.47
   Compiling memchr v2.5.0
   Compiling unicode-ident v1.0.5
   Compiling quote v1.0.21
   Compiling syn v1.0.105
   Compiling scopeguard v1.1.0
   Compiling io-lifetimes v1.0.3
   Compiling log v0.4.17
   Compiling winapi-build v0.1.1
   Compiling serde_derive v1.0.154
   Compiling regex-syntax v0.6.28
   Compiling rustix v0.36.5
   Compiling winapi v0.3.9
   Compiling rustversion v1.0.9
   Compiling linux-raw-sys v0.1.3
   Compiling kernel32-sys v0.2.2
   Compiling once_cell v1.16.0
   Compiling rayon-core v1.11.0
   Compiling bitflags v1.3.2
   Compiling serde v1.0.154
   Compiling memoffset v0.7.1
   Compiling crossbeam-epoch v0.9.13
   Compiling crossbeam-queue v0.3.8
   Compiling winapi v0.2.8
   Compiling aho-corasick v0.7.20
   Compiling bstr v1.1.0
   Compiling serde_json v1.0.94
   Compiling os_str_bytes v6.4.1
   Compiling crossbeam-channel v0.5.6
   Compiling same-file v1.0.6
   Compiling fnv v1.0.7
   Compiling anyhow v1.0.69
   Compiling either v1.8.0
   Compiling walkdir v2.3.2
   Compiling clap_lex v0.3.0
   Compiling thread_local v1.1.4
   Compiling ryu v1.0.11
   Compiling itoa v1.0.4
   Compiling termcolor v1.1.3
   Compiling heck v0.4.0
   Compiling lazy_static v1.4.0
   Compiling crossbeam-deque v0.8.2
   Compiling strsim v0.10.0
   Compiling itertools v0.10.5
   Compiling jobserver v0.1.25
   Compiling regex v1.7.0
   Compiling num_cpus v1.14.0
   Compiling crossbeam v0.8.2
   Compiling bump_alloc v0.1.0
   Compiling cc v1.0.79
   Compiling strum v0.24.1
   Compiling rayon v1.7.0
   Compiling tree-sitter v0.20.9
   Compiling tree-grepper v2.5.0-pre (/home/roland/dotyyy/tree-grepper)
   Compiling globset v0.4.10
The following warnings were emitted during compilation:

warning: cc1: fatal error: vendor/tree-sitter-c/src/parser.c: No such file or directory
warning: compilation terminated.

error: failed to run custom build command for `tree-grepper v2.5.0-pre (/home/roland/dotyyy/tree-grepper)`

Caused by:
  process didn't exit successfully: `/home/roland/dotyyy/tree-grepper/target/release/build/tree-grepper-3f929d756c9d5198/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-changed=build.rs
  cargo:rerun-if-changed=vendor/tree-sitter-c/src/parser.c
  TARGET = Some("x86_64-unknown-linux-gnu")
  OPT_LEVEL = Some("3")
  HOST = Some("x86_64-unknown-linux-gnu")
  cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
  CC_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
  CC_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
  CFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
  CFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "vendor/tree-sitter-c/src" "-o" "/home/roland/dotyyy/tree-grepper/target/release/build/tree-grepper-fd2d422433e54b48/out/vendor/tree-sitter-c/src/parser.o" "-c" "vendor/tree-sitter-c/src/parser.c"
  cargo:warning=cc1: fatal error: vendor/tree-sitter-c/src/parser.c: No such file or directory
  cargo:warning=compilation terminated.
  exit status: 1

  --- stderr


  error occurred: Command "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "vendor/tree-sitter-c/src" "-o" "/home/roland/dotyyy/tree-grepper/target/release/build/tree-grepper-fd2d422433e54b48/out/vendor/tree-sitter-c/src/parser.o" "-c" "vendor/tree-sitter-c/src/parser.c" with args "cc" did not execute successfully (status code exit status: 1).


warning: build failed, waiting for other jobs to finish...

rustc 1.68.0 (2c8cc3432 2023-03-06)

ah, I see you followed the instructions in the README, but they're slightly wrong. Do you have Nix? It's way easier to just use that. If you don't have it, there's a script defined in shell.nix which sets up the grammars in the right place, but you'd have to port it out of Nix to run it normally. 😬 I'll update the instructions to no longer recommend a cargo-only method.

Sorry this is a hassle. I keep meaning to set up automatic builds but haven't found the time.

Thank you for quick answer and explaining. It's not a problem. I never used Nix package manager, but I will try to look at it in the future and then try tree-grepper. Thanks!