Skip to content

Duplicate split compilation unit error with cdylib crate dependency #26

@srriddle

Description

@srriddle

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions