emacs-devel
[Top][All Lists]
Advanced

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

Re: Tree-sitter integration on feature/tree-sitter


From: Daniel Martín
Subject: Re: Tree-sitter integration on feature/tree-sitter
Date: Sat, 14 May 2022 20:50:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (darwin)

Yuan Fu <casouri@gmail.com> writes:
>> 
>> Thanks for working on this.  What is the best way to report
>> problems/contribute patches?  
>
> Thanks, you can just send a patch to me or open a report on debbugs and send 
> a patch there.
>

Thanks, I'll send patches to Debbugs from now on.

>
>> I've tried to build the branch and got a
>> "file not found" error when including <tree_sitter/api.h> (I have
>> tree-sitter correctly installed via Homebrew on macOS).  I've fixed the
>> problem with the following patch:
>> 
>> diff --git a/configure.ac b/configure.ac
>> index bf97dd017c..5a82d47db3 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -3115,7 +3115,6 @@ AC_DEFUN
>>     [HAVE_TREE_SITTER=yes], [HAVE_TREE_SITTER=no])
>>   if test "${HAVE_TREE_SITTER}" = yes; then
>>     AC_DEFINE(HAVE_TREE_SITTER, 1, [Define if using tree-sitter.])
>> -    TREE_SITTER_LIBS=-ltree-sitter
>>     TREE_SITTER_OBJ="treesit.o"
>>   fi
>> fi
>
> Could you explain a bit why removing this line works for you? And what 
> specific problem are you solving? I’m not so savvy in autotools.
>

The problem I tried to solve was this linker error:

  ld: library not found for -ltree-sitter

The reason is that the custom library directory on my system,
/opt/homebrew/Cellar/, needs to be set via -L, but setting
TREE_SITTER_LIBS overrided that.  Pkg-config already provides the
necessary linker flags to use the library.

With my change, I get the following in config.log:

TREE_SITTER_LIBS='-L/opt/homebrew/Cellar/tree-sitter/0.20.6/lib -ltree-sitter'

which is similar, for example, to how Jansson is linked:

JSON_LIBS='-L/opt/homebrew/Cellar/jansson/2.14/lib -ljansson'

and all compiles and links successfully.

N.B: I don't know if this would work on MS-Windows.  Perhaps MS-Windows
loads tree-sitter dynamically and will need a special case that just
unsets TREE_SITTER_LIBS.


reply via email to

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