Skip to content

globally disabled logs still require symbols on x86 = linker error #411

@japaric

Description

@japaric

This program:

fn main() {
    defmt::info!("hello");
    println!("hello");
}

fails to link if you use defmt v0.2.0

$ cargo r
(..)
  = note: /usr/bin/ld: (..)/target/debug/deps/libdefmt-00ba9b2b47686b1f.rlib(defmt-00ba9b2b47686b1f.defmt.bhjss6u8-cgu.12.rcgu.o): in function `defmt::export::acquire':
          (..)/defmt-0.2.0/src/export.rs:36: undefined reference to `_defmt_acquire'
          /usr/bin/ld: (..)/target/debug/deps/libdefmt-00ba9b2b47686b1f.rlib(defmt-00ba9b2b47686b1f.defmt.bhjss6u8-cgu.12.rcgu.o): in function `defmt::export::release':
          (..)/defmt-0.2.0/src/export.rs:48: undefined reference to `_defmt_release'
          /usr/bin/ld: (..)/target/debug/deps/libdefmt-00ba9b2b47686b1f.rlib(defmt-00ba9b2b47686b1f.defmt.bhjss6u8-cgu.12.rcgu.o): in function `defmt::export::timestamp':
          (..)/defmt-0.2.0/src/export.rs:60: undefined reference to `_defmt_timestamp'
          collect2: error: ld returned 1 exit status

but links and runs fine if you use defmt v0.1.3

$ cargo r
(..)
     Running `target/debug/hello`
hello

note that all logs are disabled in both cases (no Cargo features were added to the crate's Cargo.toml)

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty: mediumSomewhat difficult to solvepriority: highHigh priority for the Knurling teamstatus: needs designThis feature needs design work to move forwardtype: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions