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

chapter 9,11,14,15,16 cannot be compiled correctly #340

Closed
dzvon opened this issue May 26, 2021 · 1 comment
Closed

chapter 9,11,14,15,16 cannot be compiled correctly #340

dzvon opened this issue May 26, 2021 · 1 comment

Comments

@dzvon
Copy link
Contributor

dzvon commented May 26, 2021

error: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "gnu" "--eh-frame-hdr" "-L" "/home/pvon/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/thumbv7em-none-eabihf/lib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/clocks_and_timers-1121a5ca4a3c2593.clocks_and_timers.448dir38-cgu.0.rcgu.o" "-o" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/clocks_and_timers-1121a5ca4a3c2593" "--gc-sections" "-L" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps" "-L" "/home/pvon/Documents/discovery/target/debug/deps" "-L" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/build/cortex-m-2685fd7348c709d5/out" "-L" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/build/cortex-m-rt-18318916c9b831ae/out" "-L" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/build/f3-061cc1108775d06a/out" "-L" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/build/cortex-m-6bff013c271c4fb5/out" "-L" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/build/stm32f30x-133bbb046c041364/out" "-L" "/home/pvon/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/thumbv7em-none-eabihf/lib" "-Bstatic" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libaux9-de0f72fde62340d5.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libf3-e80dbc69d304f49f.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libstm32f30x_hal-e74b08f7d9159ab1.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libstm32f30x-19fa58bcffd8e506.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libcortex_m-8a0eeeef47ef2b03.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libaligned-3498b40e1e6158a7.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/liblsm303dlhc-af4fa6f96c87cbdb.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libcast-2083d49f052f8bdc.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libl3gd20-6c805ace4c340d48.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libgeneric_array-8b97ffd4d9f11f5f.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libembedded_hal-5794cebbcd395a33.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libvoid-f9d35b0f5364350b.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libnb-89b7a3e8b65d37c9.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libcortex_m_rt-25edd8d4c7e160c0.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libr0-b137ae16d26754d1.rlib" "--start-group" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libpanic_itm-a6cafa09ed3109df.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libcortex_m-409b4eaf415df603.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libvolatile_register-a22d838dbbaa0abb.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libvcell-5ed5ecd6e52ab138.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libbare_metal-88645896f07f1d7e.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libaligned-9e8afd46aee11448.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libas_slice-6b612d4b18b5297d.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libstable_deref_trait-bb767e6a52526756.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libgeneric_array-16b5890004baf964.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libgeneric_array-ff24070a3702f789.rlib" "/home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libtypenum-3ad79d42916ed008.rlib" "/home/pvon/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/thumbv7em-none-eabihf/lib/librustc_std_workspace_core-9ca364d4aa02448e.rlib" "/home/pvon/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/thumbv7em-none-eabihf/lib/libcore-1a35e887f5bb56ae.rlib" "--end-group" "/home/pvon/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/thumbv7em-none-eabihf/lib/libcompiler_builtins-c59ab3ccf598084c.rlib" "-Tlink.x" "-Bdynamic"
  = note: rust-lld: error: duplicate symbol: CORE_PERIPHERALS
          >>> defined at mod.rs:154 (/home/pvon/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-0.5.6/src/peripheral/mod.rs:154)
          >>>            cortex_m-8a0eeeef47ef2b03.cortex_m.8yozqmpe-cgu.1.rcgu.o:(CORE_PERIPHERALS) in archive /home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libcortex_m-8a0eeeef47ef2b03.rlib
          >>> defined at mod.rs:146 (/home/pvon/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-0.6.4/src/peripheral/mod.rs:146)
          >>>            cortex_m-409b4eaf415df603.cortex_m.7f87q6eb-cgu.15.rcgu.o:(.rodata.CORE_PERIPHERALS+0x0) in archive /home/pvon/Documents/discovery/target/thumbv7em-none-eabihf/debug/deps/libcortex_m-409b4eaf415df603.rlib

This is the output when I run cargo run in chapter 9, I also checked chapter 11,14,15,16, they all failed to compile, and the error output is almost the same.

❯ cargo version
cargo 1.52.0 (69767412a 2021-04-21)

❯ rustc --version
rustc 1.52.1 (9bc8c42bb 2021-05-09)
bors bot added a commit that referenced this issue May 29, 2021
341: Fix compile error r=eldruin a=dzvon

Fix #338 #340 

It looks like these problems are caused by multiple versions. I have no idea of the underlying reasons, but I think the simplest workaround is to keep one version. So I remove f3 crate which depends on `cortex-m v0.5.6` to fix it.

There are also the same problems in chapter 11,14,15. But it seems more complex, as I'm a newbie in this field, and I'm still learning :-). So I only submit this to fix chapter 9. Thanks a lot.

Co-authored-by: Persevere Von <wu543065657@163.com>
@eldruin
Copy link
Member

eldruin commented May 29, 2021

This was fixed in #341

@eldruin eldruin closed this as completed May 29, 2021
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

2 participants