From patchwork Fri Jun 16 00:16:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Ojeda X-Patchwork-Id: 108775 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1014725vqr; Thu, 15 Jun 2023 18:06:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ71K8ZxTH+hAVfDEzk/8sIB09f/0fJztzK3pbeNxpyp9iwVrebSKwQTH3/9ivqPT07i5Mqu X-Received: by 2002:a92:d7d2:0:b0:335:542b:aa48 with SMTP id g18-20020a92d7d2000000b00335542baa48mr1131487ilq.19.1686877590488; Thu, 15 Jun 2023 18:06:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686877590; cv=none; d=google.com; s=arc-20160816; b=L+vfe8fq+palnFrf7bpwbEYLIBJ/yPjdAw78p2KdpXiWrJPe+YIWrXgS1eT4zjEv9d WWIKM+B4iAfMQuSWqfVoIhntkDoBXtg2nH4LpJf090SmgU5mMS6bq43FLs6GNhTU0sy1 nm04YdIYwqJ8lwnYNFCbzSWatJQeMua7sYlwkJB23Y/0/UgcqaufdzKCnUov/cPvLuea ahvqVwfeGjaEOjiieY16asIsuHqLxXw9eAKWlaRJbc2BESwaQG4Tt6qN9c5r0DuJGxoy iDe3G3A0pXjYWP4OleFZMlqoSpBTRSLZcUjFhVK0ZyRk/pSE8+aX3GjKkaDgTCqmKYKV SONA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=M+5v9diAp8b0yNGRLW7Tlt4A1WqNagR0koI16JPqzvU=; b=VUTn0rfsNpZsCPbips8jTU1K6JUlILs5kEswFesRMLrP6k3ebtLgFWOX3mGtKSG+34 g34uIQpEdqetPJUQcAxgdAAh17a0pOHTfrmZSReARJNfy8KNJiuJTc1OrshxC+YU9ZVC yjRSPyXfKOP9UBsXCccNqbiOl4By8wCjruouBJ9d0FK1+QsnS2Yn+tvjMP5fO58tzjn3 DqodXkn8s/O5mbrEy1cn9I+RUzgOmTw1pul7mr0/Kq99FjjBPO+6Ys61YqtqCdBEmOCx aRjn0pdnnRvpYka9KfqAY1V41ERD8iG1V8BSp8N80FbdotkyZl8wduSTeE5cjBJjRGp2 SRSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sAANV7Aa; 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 v10-20020a63610a000000b0053eedcc504esi4242288pgb.373.2023.06.15.18.06.12; Thu, 15 Jun 2023 18:06:30 -0700 (PDT) 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=sAANV7Aa; 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 S239840AbjFPARP (ORCPT + 99 others); Thu, 15 Jun 2023 20:17:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240648AbjFPARN (ORCPT ); Thu, 15 Jun 2023 20:17:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08129295B; Thu, 15 Jun 2023 17:17:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5422C61C11; Fri, 16 Jun 2023 00:17:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BE0AC433CD; Fri, 16 Jun 2023 00:17:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686874626; bh=i3yIt3pkJh1+yUPFZ2G1YGSS4ROB0KkdEUSk4yxp0Ss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sAANV7AatCJDD5oIOQhzC31TL4IJzbcwCNNtTfHTXGsc3Voolri0GhPM7HWCvwQry GQP8dhHnA592zxKc/Mw4DxvACL9NdTytHbD24ZCRu3HAXOvucHC2fFpW7xyPC8e7M7 iksHH4m0blCrS0TicmOHejS6oghpsFXYr6DIWtuw6nu6BLqvkiyOAT7n+VHRMO21Ei TqqM1BRaYTvx9a13Lh57duNLrOOeuIkNbCSpWMyQbaRGWCuNLRVG0vRLdpPcVPv+QF qzYPXGfSoWL9l96/1MXpVS9f+PaW18l/tpp4EJnu0/sO25exf/ALSGcOM45pA4juWK 9yHEVMxa8Ujhg== From: Miguel Ojeda To: Masahiro Yamada , Miguel Ojeda , Wedson Almeida Filho , Alex Gaynor Cc: Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Alice Ryhl , Andreas Hindborg , linux-kbuild@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev Subject: [PATCH v2 03/11] docs: rust: add paragraph about finding a suitable `libclang` Date: Fri, 16 Jun 2023 02:16:23 +0200 Message-ID: <20230616001631.463536-4-ojeda@kernel.org> In-Reply-To: <20230616001631.463536-1-ojeda@kernel.org> References: <20230616001631.463536-1-ojeda@kernel.org> MIME-Version: 1.0 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,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768819356246527190?= X-GMAIL-MSGID: =?utf-8?q?1768819356246527190?= 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/ Reviewed-by: Nick Desaulniers Signed-off-by: Miguel Ojeda Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: Nathan Chancellor --- 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..a635be69e062 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 directory 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 ------------------------