riscv-rust / k210-example

Example project for K210 SoC to show usage of k210-hal project
30 stars 9 forks source link

Link failed because of different floating-point ABI #4

Closed smsxgli closed 3 years ago

smsxgli commented 3 years ago

Hi everybody, i am a new guy for both risc-v and rust. I have tried this example with newest stable rust 1.52.1. I just cloned this repo, and type cargo build, then it failed with some error such as "private mod" and so on. This is corrected by replacing k210-hal's version with git address, this change can be found in diff.txt, which is the output of git diff Cargo.toml. But then, I try cargo build, there is a link error:

error: linking with rust-lld failed: exit code: 1 ...// some long error about object file and link param

error: linking with rust-lld failed: exit code: 1

= note: rust-lld: error: /tmp/k210-example/target/riscv64gc-unknown-none-elf/debug/deps/libriscv-0cd34d7ac3269d39.rlib(riscv.o): cannot link object files with different floating-point ABI rust-lld: error: /tmp/k210-example/target/riscv64gc-unknown-none-elf/debug/deps/libriscv_rt-35242cf52d273fa0.rlib(riscv-rt.o): cannot link object files with different floating-point ABI

error: aborting due to previous error

error: could not compile k210-example

here is the full output output.txt

BTW, The components i have installed list below: cargo-x86_64-unknown-linux-gnu (installed) clippy-x86_64-unknown-linux-gnu (installed) llvm-tools-preview-x86_64-unknown-linux-gnu (installed) rust-docs-x86_64-unknown-linux-gnu (installed) rust-src (installed) rust-std-riscv64gc-unknown-none-elf (installed) rust-std-x86_64-unknown-linux-gnu (installed) rustc-x86_64-unknown-linux-gnu (installed) rustfmt-x86_64-unknown-linux-gnu (installed)

if there is any information is missed here, please let me know.

In my opinion, K210 use lp64f abi, which is unusual. For risc-v64, lp64d abi is more common.

Disasm commented 3 years ago

I believe it's a problem with riscv & riscv-rt crates: https://github.com/rust-embedded/riscv/issues/69

smsxgli commented 3 years ago

thanks for reply! so since this is a upstream problem, should i close this issue?

Disasm commented 3 years ago

We can leave it open until the problem is resolved.

smsxgli commented 3 years ago

i am sure latest riscv crate(version 0.7.0) solved this issue. thank you guys!