You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem
Both application and its sub-dependency depend on library: application has equality requirements "= X.Y.Z", while sub-dependency can work with range: ">= X.Y.Z, < F.V"`.
I expect Cargo to only pull "X.Y.Z" version of a dependency, while both are pulled. Since library defines unmangled symbols (or will use links feature in the near future), this is an error.
And [cortex-m-semihosting/(https://github.com/rust-embedded/cortex-m-semihosting) depends on cortex-m as well:
[dependencies]
cortex-m = ">= 0.5.8, < 0.7"
Application code (not important, but for completeness):
#![no_main]
#![no_std]
#![allow(unused)]
use cortex_m_rt::entry;
use panic_abort;
use stm32f30x;
use cortex_m_log::printer::semihosting::Semihosting;
use cortex_m_log::printer::Printer;
use cortex_m_log::modes::InterruptOk;
use core::fmt::Write;
#[entry]
fn main() -> ! {
let prphs = stm32f30x::Peripherals::take().unwrap();
let core = cortex_m::Peripherals::take().unwrap();
let mut d = Semihosting::<InterruptOk, _>::stdout().unwrap();
loop {
write!(d.destination(), ";");
cortex_m::asm::wfi()
}
}
Compilation error:
= note: rust-lld: error: duplicate symbol: CORE_PERIPHERALS
>>> defined at mod.rs:153 (/Users/r/.cargo/registry/src/github.jparrowsec.cn-1ecc6299db9ec823/cortex-m-0.6.0/src/peripheral/mod.rs:153)
>>> cortex_m-774979bd87405991.cortex_m.b30jt41x-cgu.0.rcgu.o:(CORE_PERIPHERALS) in archive /Users/r/stuff/coco-test/target/thumbv7m-none-eabi/debug/deps/libcortex_m-774979bd87405991.rlib
>>> defined at mod.rs:153 (/Users/r/.cargo/registry/src/github.jparrowsec.cn-1ecc6299db9ec823/cortex-m-0.5.8/src/peripheral/mod.rs:153)
>>> cortex_m-769a472e04c23d44.cortex_m.9qln9imh-cgu.0.rcgu.o:(.bss.CORE_PERIPHERALS+0x0) in archive /Users/r/stuff/coco-test/target/thumbv7m-none-eabi/debug/deps/libcortex_m-769a472e04c23d44.rlib
Excerpt from Cargo.lock:
[[package]]
name = "cortex-m-semihosting"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cortex-m 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
Am I missing something? It seems that in this scenario I should only have one cortex-m dependency, and it should be the one specified by equality, 0.5.8.
The text was updated successfully, but these errors were encountered:
cargo thinks cortex-m 0.7 is compatible with cortex-m 0.5, so it gives you the most recent one you can use for each part of the project. If there is only supposed to be one version of cortex-m in the dependency tree, for example as it links to a native dependency, then it should specify the links atribut in it cargo.toml.
@Eh2406 I don't think that's the case. Reading docs it seems semver compatibility will come into play only if caret dependencies are used. In this example both application and sub-dependency define (in)equality versions.
As for the links attribute, linked issue from cortex-m addresses that, I believe.
Hi,
Problem
Both application and its sub-dependency depend on library: application has equality requirements
"= X.Y.Z", while sub-dependency can work with range:
">= X.Y.Z, < F.V"`.I expect Cargo to only pull "X.Y.Z" version of a dependency, while both are pulled. Since library defines unmangled symbols (or will use
links
feature in the near future), this is an error.Steps
Application dependencies:
Dependency in question is cortex-m-log, which depends on
cortex-m-semihosting
:And [cortex-m-semihosting/(https://github.com/rust-embedded/cortex-m-semihosting) depends on
cortex-m
as well:Application code (not important, but for completeness):
Compilation error:
Excerpt from Cargo.lock:
Am I missing something? It seems that in this scenario I should only have one
cortex-m
dependency, and it should be the one specified by equality,0.5.8
.The text was updated successfully, but these errors were encountered: