有了附带的调试信息,我的二进制文件大约变成了400 MB。发生这种情况是因为Rust包含所有依赖项的调试信息。有什么方法可以只为我的代码包含调试信息吗?
[package]
name = "app"
version = "0.7.1"
edition = "2018"
[dependencies]
actix = "*"
actix-web = {version = "1.0", features = ["ssl"]}
...
tokio-core = "*"
tokio = "*"
[profile.release]
debug = true
如果您愿意在夜间使用工具链使用不稳定的货物功能,则可以通过cargo profile dependencies功能来实现,就像这样:
cargo-features = ["profile-overrides"]
[package]
name = "app"
version = "0.7.1"
edition = "2018"
[dependencies]
actix = "*"
actix-web = {version = "1.0", features = ["ssl"]}
...
tokio-core = "*"
tokio = "*"
[profile.release]
debug = true
// disable debug symbols for all packages except this one
[profile.release.package."*"]
debug = false