Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate split compilation unit error with cdylib crate dependency #26

Open
srriddle opened this issue Jun 2, 2023 · 0 comments
Open

Comments

@srriddle
Copy link

srriddle commented Jun 2, 2023

I'm running into this issue when including a crate that is of crate_type cdylib, I get a duplicate split compilation unit error. Here is a minimal test case.

Cargo.toml

[package]
name = "dupcomp"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
tokio = { version = "1.12.0", features = ["full"] }
sysinfo = { version = "0.26.7" }

[profile.release]
lto = "thin"
opt-level = 2
debug-assertions = false
codegen-units = 16
incremental = true
split-debuginfo = "packed"
debug = true

main.rs

#[tokio::main]
async fn main() {
    println!("Hello, world!");
}

Split debug info on Mac and Windows are also fine for this case. When including the same crate that is of crate_type rlib it also builds fine on linux with split-debuginfo.

It seems the num_cpus crate included in sysinfo is being added by Thorin first and then the same compilation unit is being added again in tokio (verified this by using the Thorin CLI). Updating the sysinfo library to version 0.29 (where it is no longer a cdylib) resolves this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant