我可以仅为我的代码添加调试信息而没有软件包吗?

问题描述 投票:6回答:1

有了附带的调试信息,我的二进制文件大约变成了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
rust rust-cargo
1个回答
1
投票

如果您愿意在夜间使用工具链使用不稳定的货物功能,则可以通过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

© www.soinside.com 2019 - 2024. All rights reserved.