From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter integration on feature/tree-sitter Date: Thu, 16 Jun 2022 12:10:37 -0700 Message-ID: References: <9E6D13F6-7E50-44EE-A357-C971A11A3636@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.100.31\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1970"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Emacs Devel To: =?utf-8?Q?Daniel_Mart=C3=ADn?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jun 16 21:12:03 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 1o1uuQ-0000E1-4Y for ged-emacs-devel@m.gmane-mx.org; Thu, 16 Jun 2022 21:12:02 +0200 Original-Received: from localhost ([::1]:45594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1uuO-00056r-LR for ged-emacs-devel@m.gmane-mx.org; Thu, 16 Jun 2022 15:12:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48484) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1utA-0003z0-Gi for emacs-devel@gnu.org; Thu, 16 Jun 2022 15:10:44 -0400 Original-Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:37624) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o1ut6-0008DQ-Er for emacs-devel@gnu.org; Thu, 16 Jun 2022 15:10:44 -0400 Original-Received: by mail-pj1-x102d.google.com with SMTP id 3-20020a17090a174300b001e426a02ac5so2645767pjm.2 for ; Thu, 16 Jun 2022 12:10:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=RwGhgPX3nfolLK8E4mbIc5CuYfX+TPz+Kf995yNmsdE=; b=FGU6mYT42V09jee5ET3JY7M/boyPVlwutzmN8CaONCtnClnPfiDGO7L9HP0BAT98NN yR2Cm6cCGtrXgrOZtXamYWoCooPM5cXBM0GehUu7EmHeAAT5cq2M5YnQZB4CmNDRpE/S Kq2f2Jq7mpQF7qR2ULU5KMya9F+E36qCGcxaa1hZIM9cIPvcfIrpWOS0xI8U2eBYI55e VzUkC/cybtkl7gh1ole7wJptacdQZH/3B2rkZyxOlwDSWNtvFsbluS9o1VTUoN6ZHMqW 9k/ua9LTZx9UChEc9afVL2lVWr7JzAE9aogeOybuueAQk3G/hulrBMvIZDqI0EUul4FT bguw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=RwGhgPX3nfolLK8E4mbIc5CuYfX+TPz+Kf995yNmsdE=; b=wLSgHEooa8o5vTK9xAph/b7sxui8KIA61E67aaoamR+NGQdBVXHExrhgeWAdC3epI5 +UVIVMoGKJeBTAIjI4b/MLTdO1nVyoSPoqApsPoa3IMuWEmYgrqOC685lYV5vGB29oBB QShamSj091dayKt/FaoUqViiZeWDksQR+tCMjpTAjYE15cYCdJR6okHOUlxz/la35+4o l97/H+lBkhS6vmbF0//kSOJ2jFwAN+UGYLSzHpL75W1eAttA/g+TE3MJdpEUFphx+Lyt MiNW1+/B2wxjQQsM5ptW5LQWgDbJWFy/FiaP9HL2V4FAMKhEGHoePKVcL22jaYde111Y lbTw== X-Gm-Message-State: AJIora86JJkit1aOJ5+N7l6+QB+MFc1dI9YTXb7nLeOkaP7ds0QcHBAF klJ1vonPk6i8Ywam5Sqic77cmW9c2NM= X-Google-Smtp-Source: AGRyM1uPCmX5dzP3GAB4OXHaxvgXVATrZiB06qLeSbn9PWCHTjNm+ovaQyKiPLDqo5MLbuuc3i854g== X-Received: by 2002:a17:902:9a8d:b0:167:77c3:4c86 with SMTP id w13-20020a1709029a8d00b0016777c34c86mr6047125plp.122.1655406638937; Thu, 16 Jun 2022 12:10:38 -0700 (PDT) Original-Received: from smtpclient.apple ([2600:1700:2ec7:8c90:c15:33ec:172b:f758]) by smtp.gmail.com with ESMTPSA id 19-20020a170902e9d300b00163f3e91ea0sm2013055plk.238.2022.06.16.12.10.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jun 2022 12:10:38 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3696.100.31) Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=casouri@gmail.com; helo=mail-pj1-x102d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:291253 Archived-At: > On May 14, 2022, at 11:50 AM, Daniel Mart=C3=ADn = wrote: >=20 > Yuan Fu writes: >>>=20 >>> Thanks for working on this. What is the best way to report >>> problems/contribute patches? =20 >>=20 >> Thanks, you can just send a patch to me or open a report on debbugs = and send a patch there. >>=20 >=20 > Thanks, I'll send patches to Debbugs from now on. >=20 >>=20 >>> I've tried to build the branch and got a >>> "file not found" error when including (I have >>> tree-sitter correctly installed via Homebrew on macOS). I've fixed = the >>> problem with the following patch: >>>=20 >>> 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=3Dyes], [HAVE_TREE_SITTER=3Dno]) >>> if test "${HAVE_TREE_SITTER}" =3D yes; then >>> AC_DEFINE(HAVE_TREE_SITTER, 1, [Define if using tree-sitter.]) >>> - TREE_SITTER_LIBS=3D-ltree-sitter >>> TREE_SITTER_OBJ=3D"treesit.o" >>> fi >>> fi >>=20 >> Could you explain a bit why removing this line works for you? And = what specific problem are you solving? I=E2=80=99m not so savvy in = autotools. >>=20 >=20 > The problem I tried to solve was this linker error: >=20 > ld: library not found for -ltree-sitter >=20 > 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. >=20 > With my change, I get the following in config.log: >=20 > TREE_SITTER_LIBS=3D'-L/opt/homebrew/Cellar/tree-sitter/0.20.6/lib = -ltree-sitter' >=20 > which is similar, for example, to how Jansson is linked: >=20 > JSON_LIBS=3D'-L/opt/homebrew/Cellar/jansson/2.14/lib -ljansson' >=20 > and all compiles and links successfully. >=20 > 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. Thanks, I=E2=80=99ve removed that line from configure.ac. Yuan