serenadeai / java-tree-sitter

Java bindings for tree-sitter
MIT License
126 stars 35 forks source link

FileNotFoundError when running ./build.py ... #9

Closed D00mch closed 2 years ago

D00mch commented 2 years ago

New to treesitter. Just wanted to try in from clojure with java api.

  1. I cloned this project.
  2. Run ./gradlew assemble.
  3. Download tree-sitter-dart;
  4. Run ./build.py libjava-tree-sitter ~/path/to/dart/tree-sitter-dart

And I get: FileNotFoundError: [Errno 2] No such file or directory: 'libjava-tree-sitter/src/parser.c'. And there is no libjava-tree-sitter/src/parser.c in this project (like there is in tree-sitter-dart, for example).

So maybe docs are outdated?

I also tried not to pass the first arg (libjava-tree-sitter), and it failed with:

/Users/m1/IdeaProjects/java/java-tree-sitter/lib/ai_serenade_treesitter_TreeSitter.cc:5:10: fatal error: 'tree_sitter/api.h'
file not found
#include <tree_sitter/api.h>
...
distutils.errors.CompileError: command '/usr/bin/cc' failed with exit code 1
johanneshorner commented 2 years ago

You can specify a different output file with the "-o" flag or omit it to use the default "libjava-tree-sitter" name. So you could use "./build.py -o 'your-file-name' ~/path/to/dart/tree-sitter-dart". Regarding the second error you got, have you pulled the tree-sitter submodule? Git doesn't do that automatically on clone. So inside the repository you pulled, do --> "git submodule update --init --recursive"

thekalinga commented 2 years ago

Can this information be added to main readme so that 1st timers like me (who never deal with this stuff) will appreciate.