From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter integration on feature/tree-sitter Date: Sat, 14 May 2022 22:09:59 +0300 Message-ID: <835ym8kk1k.fsf@gnu.org> References: <9E6D13F6-7E50-44EE-A357-C971A11A3636@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38146"; mail-complaints-to="usenet@ciao.gmane.io" Cc: casouri@gmail.com, emacs-devel@gnu.org To: Daniel =?utf-8?Q?Mart=C3=ADn?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat May 14 21:11:13 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1npxAX-0009nS-88 for ged-emacs-devel@m.gmane-mx.org; Sat, 14 May 2022 21:11:13 +0200 Original-Received: from localhost ([::1]:37664 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1npxAV-0001lH-T3 for ged-emacs-devel@m.gmane-mx.org; Sat, 14 May 2022 15:11:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npx9h-0000z8-01 for emacs-devel@gnu.org; Sat, 14 May 2022 15:10:21 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:58490) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npx9g-0005yD-Ik; Sat, 14 May 2022 15:10:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=KpmGlSQrmQG1U39kUrpj7cjd2x+09q7Ijzr64tnrOvI=; b=kLFeInBooNY3uJDPgmOx TCJzgpj8XPOPYsoBUABwOnf5SsEss5rZtl6e9lf+lOnwzCYHtGjqIal9dv30IS7wrrG5YSdvWtkqj ilo/ag233UFK+eszZESPs8qIvosgwkF3i9C5ZT8KDOGwa/1tNQ5pcpvd15Zo6Olovq/GLl/5Ahf6B URjqOiYJa+RyF0KzXoqDChojuUFR2KpyM49p0KZAxRgr/BGqJazvTDTAQZbaQ8AjhkbBqGI5XA6ff wUgu78XMKwv0HgAbijJxGfEupPZV+iTFFkJeqvS6DpinwYIQUFb2jueBnWPSm+r6Lw8Pgp19CQ5Br GWPZaR7F+YTztg==; Original-Received: from [87.69.77.57] (port=4933 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npx9d-0006Fp-Ae; Sat, 14 May 2022 15:10:20 -0400 In-Reply-To: (message from Daniel =?utf-8?Q?Mart?= =?utf-8?Q?=C3=ADn?= on Sat, 14 May 2022 20:50:39 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:289783 Archived-At: > From: Daniel Martín > Cc: Emacs Devel > Date: Sat, 14 May 2022 20:50:39 +0200 > > 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. The compiler and linker switches for linking against the library are supposed to come from pkg-config (which gets them from tree-sitter.pc file that is part of the tree-sitter library's installation). > 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. Don't worry about Windows, we will figure this out when there's a first Emacs user who wants to build that branch on Windows. And initially, there's nothing wrong with linking against the library statically even on Windows: the resulting binary will work.