All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Yanteng Si <siyanteng@loongson.cn>
To: ojeda@kernel.org, corbet@lwn.net, alex.gaynor@gmail.com,
	wedsonaf@gmail.com, boqun.feng@gmail.com, gary@garyguo.net,
	bjorn3_gh@protonmail.com, benno.lossin@proton.me,
	a.hindborg@samsung.com, aliceryhl@google.com, nathan@kernel.org,
	ndesaulniers@google.com, morbo@google.com,
	justinstitt@google.com, alexs@kernel.org, dzm91@hust.edu.cn
Cc: Yanteng Si <siyanteng@loongson.cn>,
	linux-doc@vger.kernel.org, rust-for-linux@vger.kernel.org,
	llvm@lists.linux.dev
Subject: [PATCH v2 4/4] docs/zh_CN/rust: Update the translation of quick-start to 6.9-rc4
Date: Fri, 26 Apr 2024 15:02:35 +0800	[thread overview]
Message-ID: <aff560c262f255e873c07cc66891cf8140ad433d.1714113680.git.siyanteng@loongson.cn> (raw)
In-Reply-To: <cover.1714113680.git.siyanteng@loongson.cn>

Update to commit 711cbfc71765 ("docs: rust: Clarify that 'rustup
override' applies to build directory")
commit 7583ce66ddf7 ("docs: rust: remove `CC=clang` mentions")
commit 2285eb2f2429 ("docs: rust: clarify what 'rustup override' does")
commit 8cb40124cf92 ("docs: rust: update instructions for obtaining
'core' source")
commit b603c6cc405a ("docs: rust: add command line to rust-analyzer
section")
commit 08ab786556ff ("rust: bindgen: upgrade to 0.65.1")
commit eae90172c5b8 ("docs: rust: add paragraph about finding a
suitable `libclang`")
commit 6883b29c6cae ("docs: rust: point directly to the standalone
installers")

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
---
 .../translations/zh_CN/rust/quick-start.rst   | 50 +++++++++++++------
 1 file changed, 34 insertions(+), 16 deletions(-)

diff --git a/Documentation/translations/zh_CN/rust/quick-start.rst b/Documentation/translations/zh_CN/rust/quick-start.rst
index a4b8e8a50a89..8616556ae4d7 100644
--- a/Documentation/translations/zh_CN/rust/quick-start.rst
+++ b/Documentation/translations/zh_CN/rust/quick-start.rst
@@ -37,13 +37,18 @@ rustc
 需要一个特定版本的Rust编译器。较新的版本可能会也可能不会工作,因为就目前而言,内核依赖
 于一些不稳定的Rust特性。
 
-如果使用的是 ``rustup`` ,请进入检出的源代码目录并运行::
+如果使用的是 ``rustup`` ,请进入内核编译目录(或者用 ``--path=<build-dir>`` 参数
+来 ``设置`` sub-command)并运行::
 
 	rustup override set $(scripts/min-tool-version.sh rustc)
 
-或者从以下网址获取一个独立的安装程序或安装 ``rustup`` :
++这将配置你的工作目录使用正确版本的 ``rustc``,而不影响你的默认工具链。
 
-	https://www.rust-lang.org
+请注意覆盖应用当前的工作目录(和它的子目录)。
+
+如果你使用 ``rustup``, 可以从下面的链接拉取一个单独的安装程序:
+
+	https://forge.rust-lang.org/infra/other-installation-methods.html#standalone
 
 
 Rust标准库源代码
@@ -57,21 +62,23 @@ Rust标准库的源代码是必需的,因为构建系统会交叉编译 ``core
 
 这些组件是按工具链安装的,因此以后升级Rust编译器版本需要重新添加组件。
 
-否则,如果使用独立的安装程序,可以将Rust仓库克隆到工具链的安装文件夹中::
+否则,如果使用独立的安装程序,可以将Rust源码树下载到安装工具链的文件夹中::
 
-	git clone --recurse-submodules \
-		--branch $(scripts/min-tool-version.sh rustc) \
-		https://github.com/rust-lang/rust \
-		$(rustc --print sysroot)/lib/rustlib/src/rust
+       curl -L "https://static.rust-lang.org/dist/rust-src-$(scripts/min-tool-version.sh rustc).tar.gz" |
+               tar -xzf - -C "$(rustc --print sysroot)/lib" \
+               "rust-src-$(scripts/min-tool-version.sh rustc)/rust-src/lib/" \
+               --strip-components=3
 
-在这种情况下,以后升级Rust编译器版本需要手动更新这个克隆的仓库。
+在这种情况下,以后升级Rust编译器版本需要手动更新这个源代码树(这可以通过移除
+``$(rustc --print sysroot)/lib/rustlib/src/rust`` ,然后重新执行上
+面的命令做到)。
 
 
 libclang
 ********
 
 ``bindgen`` 使用 ``libclang`` (LLVM的一部分)来理解内核中的C代码,这意味着需要安
-装LLVM;同在开启 ``CC=clang`` 或 ``LLVM=1`` 时编译内核一样。
+装LLVM;同在开启``LLVM=1`` 时编译内核一样。
 
 Linux发行版中可能会有合适的包,所以最好先检查一下。
 
@@ -94,7 +101,20 @@ bindgen
 
 通过以下方式安装它(注意,这将从源码下载并构建该工具)::
 
-	cargo install --locked --version $(scripts/min-tool-version.sh bindgen) bindgen
+	cargo install --locked --version $(scripts/min-tool-version.sh bindgen) bindgen-cli
+
+``bindgen`` 需要找到合适的 ``libclang`` 才能工作。如果没有找到(或者找到的
+``libclang`` 与应该使用的 ``libclang`` 不同),则可以使用 ``clang-sys``
+理解的环境变量(Rust绑定创建的 ``bindgen`` 用来访问 ``libclang``):
+
+
+* ``LLVM_CONFIG_PATH`` 可以指向一个 ``llvm-config`` 可执行文件。
+
+* 或者 ``LIBCLANG_PATH`` 可以指向 ``libclang`` 共享库或包含它的目录。
+
+* 或者 ``CLANG_PATH`` 可以指向 ``clang`` 可执行文件。
+
+详情请参阅 ``clang-sys`` 的文档:
 
 
 开发依赖
@@ -163,7 +183,9 @@ rust-analyzer
 一起使用,以实现语法高亮、补全、转到定义和其他功能。
 
 ``rust-analyzer`` 需要一个配置文件, ``rust-project.json``, 它可以由 ``rust-analyzer``
-Make 目标生成。
+Make 目标生成::
+
+       make LLVM=1 rust-analyzer
 
 
 配置
@@ -189,10 +211,6 @@ Rust支持(CONFIG_RUST)需要在 ``General setup`` 菜单中启用。在其
 
 	make LLVM=1
 
-对于不支持完整LLVM工具链的架构,使用::
-
-	make CC=clang
-
 使用GCC对某些配置也是可行的,但目前它是非常试验性的。
 
 
-- 
2.31.4


  parent reply	other threads:[~2024-04-26  7:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26  6:59 [PATCH v2 0/4] rust: docs: Update the translation of rust to 6.9-rc4 Yanteng Si
2024-04-26  6:59 ` [PATCH v2 1/4] docs/zh_CN/rust: Update the translation of arch-support " Yanteng Si
2024-04-27  5:29   ` Dongliang Mu
2024-04-26  6:59 ` [PATCH v2 2/4] docs/zh_CN/rust: Update the translation of coding-guidelines " Yanteng Si
2024-04-27  5:29   ` Dongliang Mu
2024-04-26  7:02 ` [PATCH v2 3/4] docs/zh_CN/rust: Update the translation of general-information " Yanteng Si
2024-04-27  5:30   ` Dongliang Mu
2024-04-26  7:02 ` Yanteng Si [this message]
2024-04-27  5:30   ` [PATCH v2 4/4] docs/zh_CN/rust: Update the translation of quick-start " Dongliang Mu
2024-04-26  7:37 ` [PATCH v2 0/4] rust: docs: Update the translation of rust " Miguel Ojeda
2024-04-26 10:35   ` Yanteng Si
2024-04-26 10:35     ` Yanteng Si
2024-04-26 12:20     ` Miguel Ojeda
2024-04-26 12:20       ` Miguel Ojeda
2024-04-26 13:42   ` Jonathan Corbet
2024-04-26 16:47     ` Miguel Ojeda
2024-04-27  4:38       ` Yanteng Si
2024-04-27  7:06         ` Miguel Ojeda
2024-04-27 11:00           ` Yanteng Si
2024-04-27  4:25     ` Yanteng Si
2024-04-27  4:53 ` Dongliang Mu
2024-04-27  4:57 ` Dongliang Mu
2024-05-02 16:28 ` Jonathan Corbet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aff560c262f255e873c07cc66891cf8140ad433d.1714113680.git.siyanteng@loongson.cn \
    --to=siyanteng@loongson.cn \
    --cc=a.hindborg@samsung.com \
    --cc=alex.gaynor@gmail.com \
    --cc=alexs@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=corbet@lwn.net \
    --cc=dzm91@hust.edu.cn \
    --cc=gary@garyguo.net \
    --cc=justinstitt@google.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=wedsonaf@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.