GNU bug report logs - #78754
Tree-sitter started versioning their shared library filenames

Previous Next

Package: emacs;

Reported by: Peter Oliver <p.d.oliver <at> mavit.org.uk>

Date: Tue, 10 Jun 2025 18:53:04 UTC

Severity: normal

Done: Yuan Fu <casouri <at> gmail.com>

To reply to this bug, email your comments to 78754 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#78754; Package emacs. (Tue, 10 Jun 2025 18:53:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Peter Oliver <p.d.oliver <at> mavit.org.uk>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 10 Jun 2025 18:53:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Peter Oliver <p.d.oliver <at> mavit.org.uk>
To: bug-gnu-emacs <at> gnu.org
Subject: Tree-sitter started versioning their shared library filenames
Date: Tue, 10 Jun 2025 19:52:21 +0100 (BST)
[Message part 1 (text/plain, inline)]
The Makefiles distributed with Tree-sitter parsers used to install to, say, /usr/lib/libtree-sitter-foo.so.0.0.  Consequently, Emacs currently expects parsers to have names like this.

Recent Makefiles instead install to /usr/lib/libtree-sitter-foo.so.14.0 or /usr/lib/libtree-sitter-foo.so.15.0 (where 14 or 15 is the Tree-sitter ABI version, taken from LANGUAGE_VERSION in the parser’s src/parser.c).  Emacs should look in these places as well.

Presumably we should ask the libtree-sitter we’re using what ABI versions it supports, rather than hard-coding 14 and 15.

-- 
Peter Oliver

Reply sent to Yuan Fu <casouri <at> gmail.com>:
You have taken responsibility. (Wed, 11 Jun 2025 06:48:02 GMT) Full text and rfc822 format available.

Notification sent to Peter Oliver <p.d.oliver <at> mavit.org.uk>:
bug acknowledged by developer. (Wed, 11 Jun 2025 06:48:02 GMT) Full text and rfc822 format available.

Message #10 received at 78754-done <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Peter Oliver <p.d.oliver <at> mavit.org.uk>
Cc: 78754-done <at> debbugs.gnu.org
Subject: Re: bug#78754: Tree-sitter started versioning their shared library
 filenames
Date: Tue, 10 Jun 2025 23:47:38 -0700

> On Jun 10, 2025, at 11:52 AM, Peter Oliver <p.d.oliver <at> mavit.org.uk> wrote:
> 
> The Makefiles distributed with Tree-sitter parsers used to install to, say, /usr/lib/libtree-sitter-foo.so.0.0.  Consequently, Emacs currently expects parsers to have names like this.
> 
> Recent Makefiles instead install to /usr/lib/libtree-sitter-foo.so.14.0 or /usr/lib/libtree-sitter-foo.so.15.0 (where 14 or 15 is the Tree-sitter ABI version, taken from LANGUAGE_VERSION in the parser’s src/parser.c).  Emacs should look in these places as well.
> 
> Presumably we should ask the libtree-sitter we’re using what ABI versions it supports, rather than hard-coding 14 and 15.
> 
> -- 
> Peter Oliver

Thanks for the heads-up! I pushed a change to emacs-30 to look for all supported versions. Eg, if the tree-sitter library supports language version 13 to 15, Emacs will try to look for libtree-sitter-foo.so.13.0, libtree-sitter-foo.so.14.0, and libtree-sitter-foo.so.15.0.

Yuan



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78754; Package emacs. (Wed, 11 Jun 2025 08:51:01 GMT) Full text and rfc822 format available.

Message #13 received at 78754 <at> debbugs.gnu.org (full text, mbox):

From: Stéphane Marks <shipmints <at> gmail.com>
To: 78754 <at> debbugs.gnu.org, casouri <at> gmail.com, p.d.oliver <at> mavit.org.uk
Cc: 78754-done <at> debbugs.gnu.org
Subject: Re: bug#78754: Tree-sitter started versioning their shared library
 filenames
Date: Wed, 11 Jun 2025 09:49:42 +0100
[Message part 1 (text/plain, inline)]
On Wed, Jun 11, 2025 at 7:48 AM Yuan Fu <casouri <at> gmail.com> wrote:

>
>
> > On Jun 10, 2025, at 11:52 AM, Peter Oliver <p.d.oliver <at> mavit.org.uk>
> wrote:
> >
> > The Makefiles distributed with Tree-sitter parsers used to install to,
> say, /usr/lib/libtree-sitter-foo.so.0.0.  Consequently, Emacs currently
> expects parsers to have names like this.
> >
> > Recent Makefiles instead install to /usr/lib/libtree-sitter-foo.so.14.0
> or /usr/lib/libtree-sitter-foo.so.15.0 (where 14 or 15 is the Tree-sitter
> ABI version, taken from LANGUAGE_VERSION in the parser’s src/parser.c).
> Emacs should look in these places as well.
> >
> > Presumably we should ask the libtree-sitter we’re using what ABI
> versions it supports, rather than hard-coding 14 and 15.
> >
> > --
> > Peter Oliver
>
> Thanks for the heads-up! I pushed a change to emacs-30 to look for all
> supported versions. Eg, if the tree-sitter library supports language
> version 13 to 15, Emacs will try to look for libtree-sitter-foo.so.13.0,
> libtree-sitter-foo.so.14.0, and libtree-sitter-foo.so.15.0.
>

This is indeed a welcome improvement.  Unless I'm reading it wrong, it
looks like the ABI tests go 0.0 forward through 15 (modulo what's
intrinsically supported).  Should the tests be reversed so the most recent
ABI takes precedence?

-Stephane
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78754; Package emacs. (Wed, 11 Jun 2025 08:51:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78754; Package emacs. (Wed, 11 Jun 2025 12:35:01 GMT) Full text and rfc822 format available.

Message #19 received at 78754 <at> debbugs.gnu.org (full text, mbox):

From: Peter Oliver <p.d.oliver <at> mavit.org.uk>
To: casouri <at> gmail.com
Cc: 78754 <at> debbugs.gnu.org,
 Stéphane Marks <shipmints <at> gmail.com>
Subject: Re: bug#78754: Tree-sitter started versioning their shared library
 filenames
Date: Wed, 11 Jun 2025 13:34:11 +0100 (BST)
[Message part 1 (text/plain, inline)]
On Wed, 11 Jun 2025, Stéphane Marks wrote:

> On Wed, Jun 11, 2025 at 7:48 AM Yuan Fu <casouri <at> gmail.com> wrote:
>
>       > On Jun 10, 2025, at 11:52 AM, Peter Oliver
>       <p.d.oliver <at> mavit.org.uk> wrote:
>       >
>       > Recent Makefiles instead install to
>       /usr/lib/libtree-sitter-foo.so.14.0 or
>       /usr/lib/libtree-sitter-foo.so.15.0 (where 14 or 15 is the
>       Tree-sitter ABI version, taken from LANGUAGE_VERSION in the
>       parser’s src/parser.c).  Emacs should look in these places as
>       well.
>       >
>
>       Thanks for the heads-up! I pushed a change to emacs-30 to look
>       for all supported versions. Eg, if the tree-sitter library
>       supports language version 13 to 15, Emacs will try to look for
>       libtree-sitter-foo.so.13.0, libtree-sitter-foo.so.14.0, and
>       libtree-sitter-foo.so.15.0.
> 
> This is indeed a welcome improvement.  Unless I'm reading it wrong, it looks
> like the ABI tests go 0.0 forward through 15 (modulo what's intrinsically
> supported).  Should the tests be reversed so the most recent ABI takes
> precedence?

Seems reasonable to me.

Additionally, I think we only need to check .0 only if
TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION is less than 15.  Anything
newer than that should be using the new file-naming scheme.

See attached patch.

-- 
Peter Oliver
[0001-Search-for-Tree-sitter-parsers-in-descending-languag.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78754; Package emacs. (Wed, 11 Jun 2025 12:42:05 GMT) Full text and rfc822 format available.

Message #22 received at 78754 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stéphane Marks <shipmints <at> gmail.com>
Cc: casouri <at> gmail.com, p.d.oliver <at> mavit.org.uk, 78754 <at> debbugs.gnu.org
Subject: Re: bug#78754: Tree-sitter started versioning their shared library
 filenames
Date: Wed, 11 Jun 2025 15:41:00 +0300
> Cc: 78754-done <at> debbugs.gnu.org
> From: Stéphane Marks <shipmints <at> gmail.com>
> Date: Wed, 11 Jun 2025 09:49:42 +0100
> 
>  Thanks for the heads-up! I pushed a change to emacs-30 to look for all supported versions. Eg, if the
>  tree-sitter library supports language version 13 to 15, Emacs will try to look for
>  libtree-sitter-foo.so.13.0, libtree-sitter-foo.so.14.0, and libtree-sitter-foo.so.15.0.
> 
> This is indeed a welcome improvement.  Unless I'm reading it wrong, it looks like the ABI tests go 0.0 forward
> through 15 (modulo what's intrinsically supported).  Should the tests be reversed so the most recent ABI
> takes precedence?

Indeed, I think the loop should be in the opposite direction, from
the highest supported ABI version to the lowest.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78754; Package emacs. (Thu, 12 Jun 2025 07:04:02 GMT) Full text and rfc822 format available.

Message #25 received at 78754 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: p.d.oliver <at> mavit.org.uk, 78754 <at> debbugs.gnu.org,
 Stéphane Marks <shipmints <at> gmail.com>
Subject: Re: bug#78754: Tree-sitter started versioning their shared library
 filenames
Date: Thu, 12 Jun 2025 00:03:13 -0700

> On Jun 11, 2025, at 5:41 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> Cc: 78754-done <at> debbugs.gnu.org
>> From: Stéphane Marks <shipmints <at> gmail.com>
>> Date: Wed, 11 Jun 2025 09:49:42 +0100
>> 
>> Thanks for the heads-up! I pushed a change to emacs-30 to look for all supported versions. Eg, if the
>> tree-sitter library supports language version 13 to 15, Emacs will try to look for
>> libtree-sitter-foo.so.13.0, libtree-sitter-foo.so.14.0, and libtree-sitter-foo.so.15.0.
>> 
>> This is indeed a welcome improvement.  Unless I'm reading it wrong, it looks like the ABI tests go 0.0 forward
>> through 15 (modulo what's intrinsically supported).  Should the tests be reversed so the most recent ABI
>> takes precedence?
> 
> Indeed, I think the loop should be in the opposite direction, from
> the highest supported ABI version to the lowest.

We’re adding candidates using Fcons, so candidates added later are in the front of the list, no?

Yuan



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78754; Package emacs. (Thu, 12 Jun 2025 08:35:02 GMT) Full text and rfc822 format available.

Message #28 received at 78754 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: p.d.oliver <at> mavit.org.uk, 78754 <at> debbugs.gnu.org, shipmints <at> gmail.com
Subject: Re: bug#78754: Tree-sitter started versioning their shared library
 filenames
Date: Thu, 12 Jun 2025 11:34:04 +0300
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Thu, 12 Jun 2025 00:03:13 -0700
> Cc: Stéphane Marks <shipmints <at> gmail.com>,
>  78754 <at> debbugs.gnu.org,
>  p.d.oliver <at> mavit.org.uk
> 
> 
> 
> > On Jun 11, 2025, at 5:41 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> > 
> >> Cc: 78754-done <at> debbugs.gnu.org
> >> From: Stéphane Marks <shipmints <at> gmail.com>
> >> Date: Wed, 11 Jun 2025 09:49:42 +0100
> >> 
> >> Thanks for the heads-up! I pushed a change to emacs-30 to look for all supported versions. Eg, if the
> >> tree-sitter library supports language version 13 to 15, Emacs will try to look for
> >> libtree-sitter-foo.so.13.0, libtree-sitter-foo.so.14.0, and libtree-sitter-foo.so.15.0.
> >> 
> >> This is indeed a welcome improvement.  Unless I'm reading it wrong, it looks like the ABI tests go 0.0 forward
> >> through 15 (modulo what's intrinsically supported).  Should the tests be reversed so the most recent ABI
> >> takes precedence?
> > 
> > Indeed, I think the loop should be in the opposite direction, from
> > the highest supported ABI version to the lowest.
> 
> We’re adding candidates using Fcons, so candidates added later are in the front of the list, no?

If it's used in the same order, then yes.  But please make sure that's
what happens.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78754; Package emacs. (Thu, 12 Jun 2025 17:06:01 GMT) Full text and rfc822 format available.

Message #31 received at 78754 <at> debbugs.gnu.org (full text, mbox):

From: Peter Oliver <p.d.oliver <at> mavit.org.uk>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 78754 <at> debbugs.gnu.org,
 Stéphane Marks <shipmints <at> gmail.com>
Subject: Re: bug#78754: Tree-sitter started versioning their shared library
 filenames
Date: Thu, 12 Jun 2025 18:05:12 +0100 (BST)
[Message part 1 (text/plain, inline)]
On Thu, 12 Jun 2025, Yuan Fu wrote:

>> On Jun 11, 2025, at 5:41 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>>
>> Indeed, I think the loop should be in the opposite direction, from
>> the highest supported ABI version to the lowest.
>
> We’re adding candidates using Fcons, so candidates added later are in the front of the list, no?

So we currently prefer the bare libtree-sitter-foo.so to any versioned files?  Shouldn’t that one be the last resort?

-- 
Peter Oliver

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78754; Package emacs. (Thu, 12 Jun 2025 18:22:02 GMT) Full text and rfc822 format available.

Message #34 received at 78754 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Peter Oliver <p.d.oliver <at> mavit.org.uk>
Cc: casouri <at> gmail.com, 78754 <at> debbugs.gnu.org, shipmints <at> gmail.com
Subject: Re: bug#78754: Tree-sitter started versioning their shared library
 filenames
Date: Thu, 12 Jun 2025 21:21:07 +0300
> Date: Thu, 12 Jun 2025 18:05:12 +0100 (BST)
> From: Peter Oliver <p.d.oliver <at> mavit.org.uk>
> cc: Eli Zaretskii <eliz <at> gnu.org>,
>         Stéphane Marks <shipmints <at> gmail.com>,
>         78754 <at> debbugs.gnu.org
> 
> On Thu, 12 Jun 2025, Yuan Fu wrote:
> 
> >> On Jun 11, 2025, at 5:41 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> >>
> >> Indeed, I think the loop should be in the opposite direction, from
> >> the highest supported ABI version to the lowest.
> >
> > We’re adding candidates using Fcons, so candidates added later are in the front of the list, no?
> 
> So we currently prefer the bare libtree-sitter-foo.so to any versioned files?  Shouldn’t that one be the last resort?

Why should it?  isn't it standard practice on Posix systems to make
foo.so a symlink to a versioned foo-N.M.so?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78754; Package emacs. (Fri, 13 Jun 2025 17:21:02 GMT) Full text and rfc822 format available.

Message #37 received at 78754 <at> debbugs.gnu.org (full text, mbox):

From: Peter Oliver <p.d.oliver <at> mavit.org.uk>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: casouri <at> gmail.com, 78754 <at> debbugs.gnu.org, shipmints <at> gmail.com
Subject: Re: bug#78754: Tree-sitter started versioning their shared library
 filenames
Date: Fri, 13 Jun 2025 18:20:36 +0100 (BST)
[Message part 1 (text/plain, inline)]
On Thu, 12 Jun 2025, Eli Zaretskii wrote:

>> Date: Thu, 12 Jun 2025 18:05:12 +0100 (BST)
>> From: Peter Oliver <p.d.oliver <at> mavit.org.uk>
>> cc: Eli Zaretskii <eliz <at> gnu.org>,
>>         Stéphane Marks <shipmints <at> gmail.com>,
>>         78754 <at> debbugs.gnu.org
>>
>> On Thu, 12 Jun 2025, Yuan Fu wrote:
>>
>>>> On Jun 11, 2025, at 5:41 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>>>>
>>>> Indeed, I think the loop should be in the opposite direction, from
>>>> the highest supported ABI version to the lowest.
>>>
>>> We’re adding candidates using Fcons, so candidates added later are in the front of the list, no?
>>
>> So we currently prefer the bare libtree-sitter-foo.so to any versioned files?  Shouldn’t that one be the last resort?
>
> Why should it?  isn't it standard practice on Posix systems to make
> foo.so a symlink to a versioned foo-N.M.so?

Yes, but the symlinks are typically not installed by default, since they’re not required for using the libraries, only for building against them.

But mainly, what happens if someone has multiple versions of the library installed?  Perhaps the symlink points to libtree-sitter-foo.so.16, but we’re linked against a version of Tree-sitter that support libtree-sitter-foo.so.15 at best.  It seems to me that, since we know what versions we support, we may as well start with libtree-sitter-foo.so.15, rather than loading libtree-sitter-foo.so and hoping for the best.

-- 
Peter Oliver

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78754; Package emacs. (Fri, 13 Jun 2025 17:54:02 GMT) Full text and rfc822 format available.

Message #40 received at 78754 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Peter Oliver <p.d.oliver <at> mavit.org.uk>
Cc: casouri <at> gmail.com, 78754 <at> debbugs.gnu.org, shipmints <at> gmail.com
Subject: Re: bug#78754: Tree-sitter started versioning their shared library
 filenames
Date: Fri, 13 Jun 2025 20:52:52 +0300
> Date: Fri, 13 Jun 2025 18:20:36 +0100 (BST)
> From: Peter Oliver <p.d.oliver <at> mavit.org.uk>
> cc: casouri <at> gmail.com, shipmints <at> gmail.com, 78754 <at> debbugs.gnu.org
> 
> On Thu, 12 Jun 2025, Eli Zaretskii wrote:
> 
> >> Date: Thu, 12 Jun 2025 18:05:12 +0100 (BST)
> >> From: Peter Oliver <p.d.oliver <at> mavit.org.uk>
> >> cc: Eli Zaretskii <eliz <at> gnu.org>,
> >>         Stéphane Marks <shipmints <at> gmail.com>,
> >>         78754 <at> debbugs.gnu.org
> >>
> >> On Thu, 12 Jun 2025, Yuan Fu wrote:
> >>
> >>>> On Jun 11, 2025, at 5:41 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> >>>>
> >>>> Indeed, I think the loop should be in the opposite direction, from
> >>>> the highest supported ABI version to the lowest.
> >>>
> >>> We’re adding candidates using Fcons, so candidates added later are in the front of the list, no?
> >>
> >> So we currently prefer the bare libtree-sitter-foo.so to any versioned files?  Shouldn’t that one be the last resort?
> >
> > Why should it?  isn't it standard practice on Posix systems to make
> > foo.so a symlink to a versioned foo-N.M.so?
> 
> Yes, but the symlinks are typically not installed by default, since they’re not required for using the libraries, only for building against them.
> 
> But mainly, what happens if someone has multiple versions of the library installed?  Perhaps the symlink points to libtree-sitter-foo.so.16, but we’re linked against a version of Tree-sitter that support libtree-sitter-foo.so.15 at best.  It seems to me that, since we know what versions we support, we may as well start with libtree-sitter-foo.so.15, rather than loading libtree-sitter-foo.so and hoping for the best.

AFAIU, the symlink, if it exists, is supposed to point to either the
latest version or the version that the system wants to use by default.
If that is correct, then trying the bare .so before the versioned
files is TRT.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78754; Package emacs. (Fri, 13 Jun 2025 18:32:03 GMT) Full text and rfc822 format available.

Message #43 received at 78754 <at> debbugs.gnu.org (full text, mbox):

From: Peter Oliver <p.d.oliver <at> mavit.org.uk>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: casouri <at> gmail.com, 78754 <at> debbugs.gnu.org, shipmints <at> gmail.com
Subject: Re: bug#78754: Tree-sitter started versioning their shared library
 filenames
Date: Fri, 13 Jun 2025 19:31:07 +0100 (BST)
[Message part 1 (text/plain, inline)]
On Fri, 13 Jun 2025, Eli Zaretskii wrote:

>> Date: Fri, 13 Jun 2025 18:20:36 +0100 (BST)
>> From: Peter Oliver <p.d.oliver <at> mavit.org.uk>
>>
>> On Thu, 12 Jun 2025, Eli Zaretskii wrote:
>>
>>>> Date: Thu, 12 Jun 2025 18:05:12 +0100 (BST)
>>>> From: Peter Oliver <p.d.oliver <at> mavit.org.uk>
>>>>
>>>> So we currently prefer the bare libtree-sitter-foo.so to any versioned files?  Shouldn’t that one be the last resort?
>>>
>>> Why should it?  isn't it standard practice on Posix systems to make
>>> foo.so a symlink to a versioned foo-N.M.so?
>>
>> Yes, but the symlinks are typically not installed by default, since they’re not required for using the libraries, only for building against them.
>>
>> But mainly, what happens if someone has multiple versions of the library installed?  Perhaps the symlink points to libtree-sitter-foo.so.16, but we’re linked against a version of Tree-sitter that support libtree-sitter-foo.so.15 at best.  It seems to me that, since we know what versions we support, we may as well start with libtree-sitter-foo.so.15, rather than loading libtree-sitter-foo.so and hoping for the best.
>
> AFAIU, the symlink, if it exists, is supposed to point to either the
> latest version or the version that the system wants to use by default.

As I say, the latest version may not be the right version for us, and that’s “wants to use by default” for linking programs during compilation, which is not what we are doing here.

Still, in practice I think this is mostly not going to matter, so I won’t try to argue it further.

-- 
Peter Oliver

This bug report was last modified 1 day ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.