defmt: error LNK2019: unresolved external symbol _defmt_panic referenced in function
This is likely similar to #411
I have a reproducible case (only affects Windows).
- Nightly (cargo 1.63.0-nightly (a4c1cd0eb 2022-05-18))
- https://github.com/kiibohd/kiibohd-core/tree/main/kll-core (exact hash https://github.com/kiibohd/kiibohd-core/tree/528672a0f7f255eb95cda7fd5423cfc553fa959e)
- cargo run works
- cargo test
= note: libkll_hid-48b2e4c1faf634c7.rlib(kll_hid-48b2e4c1faf634c7.8ek79hmbmne36vd.rcgu.o) : error LNK2019: unresolved external symbol _defmt_panic referenced in function _ZN57_$LT$kll_hid..Locale$u20$as$u20$defmt..traits..Format$GT$6format17h16cbf08301323530E
libkll_hid-48b2e4c1faf634c7.rlib(kll_hid-48b2e4c1faf634c7.8ek79hmbmne36vd.rcgu.o) : error LNK2019: unresolved external symbol _defmt_acquire referenced in function _ZN57_$LT$kll_hid..Locale$u20$as$u20$defmt..traits..Format$GT$6format17h16cbf08301323530E
libdefmt-84a1edf1a654ad5f.rlib(defmt-84a1edf1a654ad5f.defmt.6fd46b78-cgu.8.rcgu.o) : error LNK2001: unresolved external symbol _defmt_acquire
libkll_hid-48b2e4c1faf634c7.rlib(kll_hid-48b2e4c1faf634c7.8ek79hmbmne36vd.rcgu.o) : error LNK2019: unresolved external symbol _defmt_release referenced in function _ZN57_$LT$kll_hid..Locale$u20$as$u20$defmt..traits..Format$GT$6format17h16cbf08301323530E
libdefmt-84a1edf1a654ad5f.rlib(defmt-84a1edf1a654ad5f.defmt.6fd46b78-cgu.8.rcgu.o) : error LNK2001: unresolved external symbol _defmt_release
libdefmt-84a1edf1a654ad5f.rlib(defmt-84a1edf1a654ad5f.defmt.6fd46b78-cgu.8.rcgu.o) : error LNK2019: unresolved external symbol _defmt_flush referenced in function _ZN5defmt5flush17h7ba29d74f1244836E
libdefmt-84a1edf1a654ad5f.rlib(defmt-84a1edf1a654ad5f.defmt.6fd46b78-cgu.3.rcgu.o) : error LNK2019: unresolved external symbol _defmt_write referenced in function _ZN5defmt6export3f3217hed4f57cccfafeed4E
libdefmt-84a1edf1a654ad5f.rlib(defmt-84a1edf1a654ad5f.defmt.6fd46b78-cgu.6.rcgu.o) : error LNK2001: unresolved external symbol _defmt_write
libdefmt-84a1edf1a654ad5f.rlib(defmt-84a1edf1a654ad5f.defmt.6fd46b78-cgu.3.rcgu.o) : error LNK2019: unresolved external symbol _defmt_timestamp referenced in function _ZN5defmt6export6header17h47dc426ec968adf6E
C:\Users\tripl\source\repos\kiibohd\kiibohd-core\target\debug\deps\kll_core-bd87741b11f4a13f.exe : fatal error LNK1120: 6 unresolved externals
I likely can resolve this if I make defmt an optional opt-in dependency.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 18 (4 by maintainers)
Commits related to this issue
- Fixed a linker issue related to https://github.com/knurling-rs/defmt/issues/673#issuecomment-1142150012 — committed to fxweidinger/rp-hal-boards by fxweidinger 5 months ago
@Urhengulas My project has no chance of building on stable. I’m doing no_std no-OS on RP2040 microcontroller, project will not build without nightly.
I just fell over this issue. I have a library where I derive
defmt::Formatfor a type, but also want to run unit tests.I am running into link errors for a shared library that uses
derive(Format), and no logging statements. The library contains structs that are used by my MCU, Linux, and Windows. It builds fine on Linux, but on Windows I get:I’m not finding enough information online to know if this is an error on my part, or similar to reports above.