ShuguangSun / tree-sitter-ess-r

R with tree-sitter support.
GNU General Public License v3.0
8 stars 2 forks source link

Language load failed #3

Closed pcinereus closed 1 year ago

pcinereus commented 1 year ago

Hi,

When I attempt to install tree-sitter-ess-r via use-package, I get the following: .... undefined symbol: tree_sitter_r_external_scanner_create"

If I install via M-x package-install, it installs, but then I get the same error when attempting to do something like: M-x tree-sitter-ess-r-using-r-faces

Any thoughts would be most welcome.

ShuguangSun commented 1 year ago

Do you install the r.dll or r.so as descripted in the README? The dynamic lib is not shipped with this package or tree-sitter-langs.

pcinereus commented 1 year ago

Thanks @ShuguangSun. I did copy R.so to the suggested path (I think)

The steps I followed were:

  1. sudo pacman -S tree-sitter
  2. Added the following to my init.el
    (use-package tree-sitter
    :ensure t
    )
    (use-package tree-sitter-langs
    :ensure t
    )
  3. git clone https://github.com/r-lib/tree-sitter-r.git
  4. gcc ./src/parser.c -fPIC -I./ --shared -o r.so
  5. cp ./r.so ~/.emacs.default/elpa/tree-sitter-langs-20220508.636/bin (Note, either there is a typo in your instructions at this point - there seems to be an additional "langs" in the path given in the instructions, or, I have the wrong version of tree-sitter-langs). Your path indicated /path/to/tree-sitter-langs/langs/bin.
  6. mkdir ~/.emacs.default/elpa/tree-sitter-langs-20220508.636/queries/r
  7. cp ./queries/* ~/.emacs.default/elpa/tree-sitter-langs-20220508.636/queries/r

References https://emacs-tree-sitter.github.io/installation/ https://github.com/ShuguangSun/tree-sitter-ess-r/tree/2781d18303110549b4e61cb6b465b1dcbe3635f8

ShuguangSun commented 1 year ago

How about this way? The tree-sitter-r changed some code to using stdc++ recently.

gcc ./src/parser.c ./src/scanner.cc -lstdc++ -fPIC -I./ -I./src/ -I./src/tree_sitter --shared -o r.so

pcinereus commented 1 year ago

Yes. that seems to have done the trick. I must apologize , I did see that note at the end of your instructions, but I had thought that it was specific to windows - since it referred to r.dll and came after that section. I should really have adapted it and tried it first. Thanks again

ShuguangSun commented 1 year ago

I'll update the README