Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Cross Compiling with Rust
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
jesse_m
n00b
n00b


Joined: 14 Mar 2018
Posts: 31
Location: Grand Rapids, MI

PostPosted: Tue Jan 01, 2019 1:42 am    Post subject: [Solved] Cross Compiling with Rust Reply with quote

I am trying to follow along with the cross compiling guide in the Embedded Rust Book: https://docs.rust-embedded.org/book/start/qemu.html#cross-compiling

I am getting the following error when trying to run
Code:

cargo build --target thumbv7m-none-eabi


I get this error
Code:

error[E0463]: can't find crate for `core`                                       
  |                                                                             
  = note: the `thumbv7m-none-eabi` target may not be installed                 
                                                                               
error: aborting due to previous error


I'm using rust and cargo installed from portage, not from rust up.

I thought that I had those platforms installed with llvm and rust with the following use flags:
LLVM:
Code:
sys-devel/llvm ncurses xml libffi LLVM_TARGETS: AArch64 AMDGPU ARM BPF NVPTX RISCV

Rust:
Code:
dev-lang/rust clippy doc rustfmt rls system-llvm LLVM_TARGETS: X86 AArch64 ARM RISCV


I can see the targets from llvm-config:
Code:
llvm-config --targets-built
X86 AArch64 ARM AMDGPU NVPTX BPF

And the print targets from rustc shows the thumb architecture:
Code:
 rustc --print target-list | grep thumb
thumbv6m-none-eabi
thumbv7a-pc-windows-msvc
thumbv7em-none-eabi
thumbv7em-none-eabihf
thumbv7m-none-eabi


I don't know if there is anything else people have been able to do to use the Gentoo rust/cargo to build a cross compiled executable.


Last edited by jesse_m on Thu Jan 17, 2019 1:39 pm; edited 1 time in total
Back to top
View user's profile Send private message
jesse_m
n00b
n00b


Joined: 14 Mar 2018
Posts: 31
Location: Grand Rapids, MI

PostPosted: Thu Jan 17, 2019 1:38 pm    Post subject: Reply with quote

I found out that you can actually install rustup along side the distribution install.

Code:

curl https://sh.rustup.rs -sSf > rustup.sh​
chmod +x rustup.sh
./rustup.sh​ -y --no-modify-path
# Add ~/.cargo/bin to your path
rustup toolchain link system /usr


Running "rustup default system" will make the system your default. Now you have best of both worlds and can add the cross compiled toolchains like normal.


[1] https://github.com/rust-lang/rustup.rs#working-with-distribution-rust-packages
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum