可执行文件实际上需要目标目录中的哪些文件?
Which files from the target directory are actually required by the executable?
我的程序编译后'zagir',release文件夹有200MiB多的大小,这对于我写的程序来说是可笑的。因此,我尝试检查是否只有 'zagir' 可执行文件在隔离运行并且确实如此。
但令人困惑的是,release 文件夹还包括 libzagir.rlib 文件以及 .d 文件和一堆其他文件夹。
- 它们到底是什么?
- 他们真的需要吗?
- 当这些文件被忽略时,我会在执行过程中出错吗?
- 我应该为完整的可执行文件捆绑哪些文件?
Cargo.toml
[package]
authors = ["Sharad Chand"]
name = "zagir"
version = "0.1.0"
[dependencies]
bcrypt = "0.1.3"
dotenv = "0.10.1"
image = "0.17.0"
log = "0.3.8"
r2d2 = "0.7.3"
r2d2-diesel = "0.16.0"
rand = "0.3.16"
rocket = "0.3.2"
rocket_codegen = "0.3.2"
serde = "1.0.11"
serde_derive = "1.0.11"
serde_json = "1.0.2"
validator = "0.6.0"
validator_derive = "0.6.0"
[dependencies.bigdecimal]
features = ["serde"]
version = "0.0.10"
[dependencies.chrono]
features = ["serde"]
version = "0.4.0"
[dependencies.diesel]
features = [
"mysql",
"chrono",
"unstable",
"numeric",
"huge-tables",
]
version = "0.16.0"
[dependencies.diesel_codegen]
features = ["mysql"]
version = "0.16.0"
[dependencies.rocket_contrib]
features = ["handlebars_templates"]
version = "0.3.2"
[dependencies.uuid]
features = ["v4"]
version = "0.4"
Which files from the target directory are actually required by the executable
None 个,除了可执行文件本身。默认情况下,Rust 生成 静态链接的二进制文件 。
其他文件只是由 Cargo 维护的构建工件,以便更有效地重建代码。它们包括诸如您的依赖项之类的东西。
您可能会找到的一些文件的非详尽示例:
*.d
— Makefile 兼容依赖列表
*.rlib
— Rust 库文件。包含依赖的编译代码
build
— 用作临时文件的构建脚本目录 space
deps
— 你编译的依赖项
examples
— 来自 examples
目录的二进制文件
incremental
— 增量编译缓存目录
*-{hash}
— 来自 cargo test
的二进制文件
- 可执行文件——你的目标二进制文件
其中一些已记录在案 in the Cargo source code。
我的程序编译后'zagir',release文件夹有200MiB多的大小,这对于我写的程序来说是可笑的。因此,我尝试检查是否只有 'zagir' 可执行文件在隔离运行并且确实如此。
但令人困惑的是,release 文件夹还包括 libzagir.rlib 文件以及 .d 文件和一堆其他文件夹。
- 它们到底是什么?
- 他们真的需要吗?
- 当这些文件被忽略时,我会在执行过程中出错吗?
- 我应该为完整的可执行文件捆绑哪些文件?
Cargo.toml
[package]
authors = ["Sharad Chand"]
name = "zagir"
version = "0.1.0"
[dependencies]
bcrypt = "0.1.3"
dotenv = "0.10.1"
image = "0.17.0"
log = "0.3.8"
r2d2 = "0.7.3"
r2d2-diesel = "0.16.0"
rand = "0.3.16"
rocket = "0.3.2"
rocket_codegen = "0.3.2"
serde = "1.0.11"
serde_derive = "1.0.11"
serde_json = "1.0.2"
validator = "0.6.0"
validator_derive = "0.6.0"
[dependencies.bigdecimal]
features = ["serde"]
version = "0.0.10"
[dependencies.chrono]
features = ["serde"]
version = "0.4.0"
[dependencies.diesel]
features = [
"mysql",
"chrono",
"unstable",
"numeric",
"huge-tables",
]
version = "0.16.0"
[dependencies.diesel_codegen]
features = ["mysql"]
version = "0.16.0"
[dependencies.rocket_contrib]
features = ["handlebars_templates"]
version = "0.3.2"
[dependencies.uuid]
features = ["v4"]
version = "0.4"
Which files from the target directory are actually required by the executable
None 个,除了可执行文件本身。默认情况下,Rust 生成 静态链接的二进制文件 。
其他文件只是由 Cargo 维护的构建工件,以便更有效地重建代码。它们包括诸如您的依赖项之类的东西。
您可能会找到的一些文件的非详尽示例:
*.d
— Makefile 兼容依赖列表*.rlib
— Rust 库文件。包含依赖的编译代码build
— 用作临时文件的构建脚本目录 spacedeps
— 你编译的依赖项examples
— 来自examples
目录的二进制文件incremental
— 增量编译缓存目录*-{hash}
— 来自cargo test
的二进制文件
- 可执行文件——你的目标二进制文件
其中一些已记录在案 in the Cargo source code。