claytonrcarter / tree-sitter-phpdoc

PHPDoc grammar for tree-sitter
21 stars 10 forks source link

`tree-sitter-phpdoc` always fails to build. #34

Open raulchedrese opened 1 week ago

raulchedrese commented 1 week ago

I can't seem to get this parser to work with Rust Tree-sitter or Swift Tree-sitter. When attempting to compile the project after adding tree-sitter-phpdoc as a dependency I run into this error.

Undefined symbols for architecture arm64:
  "_tree_sitter_phpdoc_external_scanner_create", referenced from:
      _tree_sitter_phpdoc.language in parser.c.o
  "_tree_sitter_phpdoc_external_scanner_deserialize", referenced from:
      _tree_sitter_phpdoc.language in parser.c.o
  "_tree_sitter_phpdoc_external_scanner_destroy", referenced from:
      _tree_sitter_phpdoc.language in parser.c.o
  "_tree_sitter_phpdoc_external_scanner_scan", referenced from:
      _tree_sitter_phpdoc.language in parser.c.o
  "_tree_sitter_phpdoc_external_scanner_serialize", referenced from:
      _tree_sitter_phpdoc.language in parser.c.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any ideas?

claytonrcarter commented 1 week ago

Any ideas?

No, not really. I've not used this grammar directly in that way. I've added it to Zed, but in that case I believe it's compiled to WASM for consumption, so it's not directly built and linked in Rust. Neovim uses this grammar, but I think they're compiling and linking via C. My best effort at the moment is not very satisfying: are other tree-sitter libs building OK in your project and this is the only one failing, or is this the only one that you're using? Maybe also confirm that your include/link path is set correctly to build (and link) the scanner.c file, which is where those functions are defined. (eg perhaps your build is only trying to link the parser, but not also the scanner)

claytonrcarter commented 1 week ago

Actually, there is some commented-out scanner related code in the build.rs file. That file was autogenerated (in #32), and I didn't question what was in it. Perhaps we have some additional config to do because we're using a scanner as well as a parser? If so, I don't intend to fix that at this time, but I would welcome a PR that makes that work.