Message ID | 20230109204520.539080-1-ojeda@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2372296wrt; Mon, 9 Jan 2023 12:48:46 -0800 (PST) X-Google-Smtp-Source: AMrXdXtk6Kux98nkh9+7PluhT37BVn0olFrq4BfW4fkOuc4MlPoXTeG6Ryu2PFiyBj1VxbhzjS6O X-Received: by 2002:a17:907:7d8f:b0:7c1:f63:8f66 with SMTP id oz15-20020a1709077d8f00b007c10f638f66mr29048902ejc.51.1673297326279; Mon, 09 Jan 2023 12:48:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673297326; cv=none; d=google.com; s=arc-20160816; b=jPz1udn8YezVcHG1ysGjq5wqwlzQp49num2218kDAVJKXDV50iin79eI7bNOFOd2Mi 6h9P+BiDukJLet/55msS/e2XfG5NnEUFlD7vm3Hr/eWoOSZ48mFMek3icr6W5pkBCQ+w y2iyPeMXaDqXu348nigsKej5QSRrHVyD34apySyXfcV6pfMEgnV8Ro4yAPi9FihPXC+R ukfZN9hrQo1XDf5OKzeh+wdW05A1jWw/JEoUr/q2fE7b6G76MhH1nfVyunDvg3cIZc3O cqC5RE0oeIbUtgJ64SLrm5CYgO5XQBbsihNZhN9Aq3wrtC2lAUfEFUJl0+I1SV+ikPUK HyLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=NaSxqnXsRvl5Bhch3ZbBDYBWIfvwnRKqUqzNpWVIK1A=; b=vMSubReZxmS3AWPrsGgcZatCA9kUilEpTwBoDrbhwfJmyskPbqL9u/aBDYhN6k2KsX TFR7ahtgFXuD384H59gURZeOycNzjN8oNVWSZurqBvSkrkyS9kfji1LrhVktU1gq6p2/ X2KVuHF3SrxaA4hoBy+sd3i3IiSsCpOSAQwYf1B31F/qyz1PfgQF+GcKu63esnXAq0pm XYHKpVhPkYpfNDzWr0fpI2DfGZ5XCbxAU4m+dZ+53kOqd55SN+TjU5flAnN2XqteQce8 yGZ5Zi4xFYDNgCKaGPapv3hFhXu7bkOm/LtKAhcSnj0LMvGyLopfEzUoijCl6rRc470y n44g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="g6N3/ydS"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a20-20020a17090680d400b007a835c56b70si7674607ejx.267.2023.01.09.12.48.21; Mon, 09 Jan 2023 12:48:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="g6N3/ydS"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234961AbjAIUp5 (ORCPT <rfc822;syz17693488234@gmail.com> + 99 others); Mon, 9 Jan 2023 15:45:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231290AbjAIUpx (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 9 Jan 2023 15:45:53 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D988240; Mon, 9 Jan 2023 12:45:50 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E633E613EA; Mon, 9 Jan 2023 20:45:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9624C433EF; Mon, 9 Jan 2023 20:45:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673297149; bh=7uir+fpWvzx/j9KVXbIqIv40RM5gM3COk4tThC15780=; h=From:To:Cc:Subject:Date:From; b=g6N3/ydSgf1ekjlEVVfHIsbM86g99kyRUChoRdZg9dF1V/YnyOisYY37+GmhiitC0 Jdi2fKYCxTR6yF2oF3U/V0kkuRBNpAVyrGOiqqVN4JpG6eGFBVbNFBPsOHQSc17+Vh lNaZxi1Dt9tvPKNvDjwQJ/6lv0fPjQGtuA3lfiiPTgOB3RZLYuYpvrrMsjEILsl8qI QuDZ0h1vJ7mq97UjXtbliAoUDQc6j8sjYcuAkg/KbYgpKCbjPb1lBS2UTe6sN8SZZ+ 83WGp3wKWYw6yURHS1NMI9AG1KA78Jh38A6ktiB7Obi8hyEL74pZ22Jywp1NEdzJtS zQWuLBcrUi58A== From: Miguel Ojeda <ojeda@kernel.org> To: Masahiro Yamada <masahiroy@kernel.org> Cc: linux-kbuild@vger.kernel.org, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Nicolas Schier <nicolas@fjasle.eu>, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Miguel Ojeda <ojeda@kernel.org>, Alex Gaynor <alex.gaynor@gmail.com>, Wedson Almeida Filho <wedsonaf@gmail.com>, Boqun Feng <boqun.feng@gmail.com>, Gary Guo <gary@garyguo.net>, =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= <bjorn3_gh@protonmail.com>, Jonathan Corbet <corbet@lwn.net>, linux-doc@vger.kernel.org Subject: [PATCH 1/6] docs: rust: add paragraph about finding a suitable `libclang` Date: Mon, 9 Jan 2023 21:45:15 +0100 Message-Id: <20230109204520.539080-1-ojeda@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754579417521860287?= X-GMAIL-MSGID: =?utf-8?q?1754579417521860287?= |
Series |
[1/6] docs: rust: add paragraph about finding a suitable `libclang`
|
|
Commit Message
Miguel Ojeda
Jan. 9, 2023, 8:45 p.m. UTC
Sometimes users need to tweak the finding process of `libclang`
for `bindgen` via the `clang-sys`-provided environment variables.
Thus add a paragraph to the setting up guide, including a reference
to `clang-sys`'s relevant documentation.
Link: https://lore.kernel.org/rust-for-linux/CAKwvOdm5JT4wbdQQYuW+RT07rCi6whGBM2iUAyg8A1CmLXG6Nw@mail.gmail.com/
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
Documentation/rust/quick-start.rst | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
Comments
On Mon, Jan 9, 2023 at 12:45 PM Miguel Ojeda <ojeda@kernel.org> wrote: > > Sometimes users need to tweak the finding process of `libclang` > for `bindgen` via the `clang-sys`-provided environment variables. > > Thus add a paragraph to the setting up guide, including a reference > to `clang-sys`'s relevant documentation. > > Link: https://lore.kernel.org/rust-for-linux/CAKwvOdm5JT4wbdQQYuW+RT07rCi6whGBM2iUAyg8A1CmLXG6Nw@mail.gmail.com/ > Signed-off-by: Miguel Ojeda <ojeda@kernel.org> This is super helpful for me, since I build clang from source and would like to use my libclang.so! Thanks for this documentation Miguel! Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> > --- > Documentation/rust/quick-start.rst | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/Documentation/rust/quick-start.rst b/Documentation/rust/quick-start.rst > index 13b7744b1e27..cae21ea7de41 100644 > --- a/Documentation/rust/quick-start.rst > +++ b/Documentation/rust/quick-start.rst > @@ -100,6 +100,23 @@ Install it via (note that this will download and build the tool from source):: > > cargo install --locked --version $(scripts/min-tool-version.sh bindgen) bindgen > > +``bindgen`` needs to find a suitable ``libclang`` in order to work. If it is > +not found (or a different ``libclang`` than the one found should be used), > +the process can be tweaked using the environment variables understood by > +``clang-sys`` (the Rust bindings crate that ``bindgen`` uses to access > +``libclang``): > + > +* ``LLVM_CONFIG_PATH`` can be pointed to an ``llvm-config`` executable. > + > +* Or ``LIBCLANG_PATH`` can be pointed to a ``libclang`` shared library > + or to the directoy containing it. > + > +* Or ``CLANG_PATH`` can be pointed to a ``clang`` executable. > + > +For details, please see ``clang-sys``'s documentation at: > + > + https://github.com/KyleMayes/clang-sys#environment-variables > + > > Requirements: Developing > ------------------------ > -- > 2.39.0 >
On Mon, Jan 9, 2023 at 9:54 PM Nick Desaulniers <ndesaulniers@google.com> wrote: > > This is super helpful for me, since I build clang from source and > would like to use my libclang.so! Thanks for this documentation > Miguel! > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Thanks for the quick review Nick! By the way, I didn't add your Reported-by here because apparently it is only intended for bug fixes and not features. Cheers, Miguel
On Mon, Jan 9, 2023 at 9:45 PM Miguel Ojeda <ojeda@kernel.org> wrote: > > +* Or ``LIBCLANG_PATH`` can be pointed to a ``libclang`` shared library > + or to the directoy containing it. I just noticed the typo here, sorry: directoy -> directory Masahiro: if you take them, please feel free to correct it. Cheers, Miguel
On Tue, Jan 10, 2023 at 6:06 AM Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> wrote: > > On Mon, Jan 9, 2023 at 9:45 PM Miguel Ojeda <ojeda@kernel.org> wrote: > > > > +* Or ``LIBCLANG_PATH`` can be pointed to a ``libclang`` shared library > > + or to the directoy containing it. > > I just noticed the typo here, sorry: directoy -> directory > > Masahiro: if you take them, please feel free to correct it. Yes, I can take this, but the doc change is independent of the rest, and will not conflict with any Kbuild changes. So, you can apply this one to your tree. > > Cheers, > Miguel -- Best Regards Masahiro Yamada
On Thu, Jan 12, 2023 at 7:05 AM Masahiro Yamada <masahiroy@kernel.org> wrote: > > Yes, I can take this, but the doc change > is independent of the rest, and will not conflict with > any Kbuild changes. > > So, you can apply this one to your tree. The doc change is not fully independent: this patch is first because the next commit uses the fact that the documentation is written (to point the user to it), and the commit message mentions this. Not a big deal, but it would look better if all are in at once. Cheers, Miguel
On Sat, Jan 14, 2023 at 8:13 AM Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> wrote: > > On Thu, Jan 12, 2023 at 7:05 AM Masahiro Yamada <masahiroy@kernel.org> wrote: > > > > Yes, I can take this, but the doc change > > is independent of the rest, and will not conflict with > > any Kbuild changes. > > > > So, you can apply this one to your tree. > > The doc change is not fully independent: this patch is first because > the next commit uses the fact that the documentation is written (to > point the user to it), and the commit message mentions this. > > Not a big deal, but it would look better if all are in at once. > > Cheers, > Miguel Now I think it is better to ask you to pick up my patch [1] and apply all of this patch set in your tree since you are adding bigger changes. [1]: https://patchwork.kernel.org/project/linux-kbuild/patch/20230109061436.3146442-1-masahiroy@kernel.org/
diff --git a/Documentation/rust/quick-start.rst b/Documentation/rust/quick-start.rst index 13b7744b1e27..cae21ea7de41 100644 --- a/Documentation/rust/quick-start.rst +++ b/Documentation/rust/quick-start.rst @@ -100,6 +100,23 @@ Install it via (note that this will download and build the tool from source):: cargo install --locked --version $(scripts/min-tool-version.sh bindgen) bindgen +``bindgen`` needs to find a suitable ``libclang`` in order to work. If it is +not found (or a different ``libclang`` than the one found should be used), +the process can be tweaked using the environment variables understood by +``clang-sys`` (the Rust bindings crate that ``bindgen`` uses to access +``libclang``): + +* ``LLVM_CONFIG_PATH`` can be pointed to an ``llvm-config`` executable. + +* Or ``LIBCLANG_PATH`` can be pointed to a ``libclang`` shared library + or to the directoy containing it. + +* Or ``CLANG_PATH`` can be pointed to a ``clang`` executable. + +For details, please see ``clang-sys``'s documentation at: + + https://github.com/KyleMayes/clang-sys#environment-variables + Requirements: Developing ------------------------