emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Treesit says grammar is unavailable when it


From: Yuan Fu
Subject: Re: Treesit says grammar is unavailable when it
Date: Tue, 12 Dec 2023 19:33:19 -0800
User-agent: Mozilla Thunderbird



On 12/4/23 4:43 AM, Gernot Kieseritzky wrote:
Hello!

Warning (treesit): Cannot activate tree-sitter, because language grammar
for python is unavailable (not-found): (libtree-sitter-python 
libtree-sitter-python.so)
No such file or directory
I had the same error when using "libtree-sitter-yaml.so" and, finally,
had some time for a deeper investigation. I tried the Emacs built-in
debugger (M-x debug-on-entry treesit_load_language) but I found the
error only occurs inside the C function "treesit-available-p". Since
this error occurred directly when Emacs loads the shared library
resting inside of my ".emacs.d/tree-sitter/" directory I resorted to
debugging the dynamic linker by starting Emacs with

$ LD_DEBUG=1; emacs 2> linker.log

and then just proceeded to activate "yaml-ts-mode". Then I hit this:

listdc++.so.6: error: version lookup error: version 'GLIBCXX_3.4.29'
not found (required by ~/.emacs.d/tree-sitter/libtree-sitter-yaml.so)

Turns out the yaml module is using C++ for its scanner component (see
https://github.com/ikatyang/tree-sitter-yaml) unlike all the other
plugins I am using (C, C++, JS and TS). But I compiled this module on
my own -- on the same machine -- so how can my system's C++ standard
library suddenly turn incompatible??

Well, it turns out I am using Alex Murray's Emacs snap package on my
Ubuntu 22.04 system being based on the "core20" snap base package
(i.e. it is based on Ubuntu 20). So this Emacs snap provides an older
set of build essentials including an incompatible C++ standard
library. So as a workaround I would need to cross-compile this module
using an Ubuntu 20 compatible environment. But the best solution is
probably to ask Alex Murray to add all available tree sitter parsers
in his snap.

Best regards,
Gernot Kieseritzky

Thanks for sharing this! Eli, this sort of thing might be good reasons to also print the error message from ldopen, rather than simply saying not found?

Yuan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]