<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>8.5 解决问题 on 编程那些事儿</title><link>https://before80.github.io/prgms/Rust/comprehensiveRust/chromium/adding-third-party-crates/resolving-problems/</link><description>Recent content in 8.5 解决问题 on 编程那些事儿</description><generator>Hugo</generator><language>zh-cn</language><lastBuildDate>Tue, 11 Aug 2026 23:57:44 +0800</lastBuildDate><atom:link href="https://before80.github.io/prgms/Rust/comprehensiveRust/chromium/adding-third-party-crates/resolving-problems/index.xml" rel="self" type="application/rss+xml"/><item><title>8.5.1 生成代码的构建脚本</title><link>https://before80.github.io/prgms/Rust/comprehensiveRust/chromium/adding-third-party-crates/resolving-problems/01-build-scripts-which-generate-code/</link><pubDate>Tue, 11 Aug 2026 11:30:00 +0800</pubDate><guid>https://before80.github.io/prgms/Rust/comprehensiveRust/chromium/adding-third-party-crates/resolving-problems/01-build-scripts-which-generate-code/</guid><description>&lt;blockquote&gt;
&lt;p&gt;译文 · 基于 &lt;a href="https://google.github.io/comprehensive-rust/"&gt;Comprehensive Rust&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://google.github.io/comprehensive-rust/chromium/adding-third-party-crates/resolving-problems/build-scripts-which-generate-code.html"&gt;https://google.github.io/comprehensive-rust/chromium/adding-third-party-crates/resolving-problems/build-scripts-which-generate-code.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="851-生成代码的构建脚本"&gt;8.5.1 生成代码的构建脚本&lt;/h1&gt;
&lt;p&gt;若 &lt;code&gt;ninja&lt;/code&gt; 抱怨缺少文件，检查 &lt;code&gt;build.rs&lt;/code&gt; 看它是否写入源码文件。&lt;/p&gt;
&lt;p&gt;如果是，修改 &lt;a href="../02-configuring-gnrt-config-toml/"&gt;&lt;code&gt;gnrt_config.toml&lt;/code&gt;&lt;/a&gt;，为该 crate 添加 &lt;code&gt;build-script-outputs&lt;/code&gt;。若这是传递依赖，即 Chromium 代码不应直接依赖的依赖，还要添加 &lt;code&gt;allow-first-party-usage=false&lt;/code&gt;。该文件中已有若干示例：&lt;/p&gt;</description></item><item><title>8.5.2 构建 C++ 或执行任意操作的构建脚本</title><link>https://before80.github.io/prgms/Rust/comprehensiveRust/chromium/adding-third-party-crates/resolving-problems/02-build-scripts-which-take-arbitrary-actions/</link><pubDate>Tue, 11 Aug 2026 11:30:00 +0800</pubDate><guid>https://before80.github.io/prgms/Rust/comprehensiveRust/chromium/adding-third-party-crates/resolving-problems/02-build-scripts-which-take-arbitrary-actions/</guid><description>&lt;blockquote&gt;
&lt;p&gt;译文 · 基于 &lt;a href="https://google.github.io/comprehensive-rust/"&gt;Comprehensive Rust&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;原文链接: &lt;a href="https://google.github.io/comprehensive-rust/chromium/adding-third-party-crates/resolving-problems/build-scripts-which-take-arbitrary-actions.html"&gt;https://google.github.io/comprehensive-rust/chromium/adding-third-party-crates/resolving-problems/build-scripts-which-take-arbitrary-actions.html&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h1 id="852-构建-c-或执行任意操作的构建脚本"&gt;8.5.2 构建 C++ 或执行任意操作的构建脚本&lt;/h1&gt;
&lt;p&gt;有些 crate 使用 &lt;a href="https://crates.io/crates/cc"&gt;&lt;code&gt;cc&lt;/code&gt;&lt;/a&gt; crate 来构建并链接 C/C++ 库。其他 crate 在其构建脚本中使用 &lt;a href="https://crates.io/crates/bindgen"&gt;&lt;code&gt;bindgen&lt;/code&gt;&lt;/a&gt; 解析 C/C++。这些行为在 Chromium 环境中无法得到支持——我们的 gn、ninja 与 LLVM 构建系统在表达构建动作之间的关系方面非常具体。&lt;/p&gt;</description></item></channel></rss>