Reputation: 496
I am trying to achieve cross compilation in rust to the raspberry pi. However there was a linkage error while compiler:
error: linking with `cc` failed: exit status: 1
However for resolving that I have to download new linker and not use the default. While doing so I checked the information of my raspberry system by using:
rustup show
Got the following result:
Default host: x86_64-unknown-linux-gnu
rustup home: /home/akumar/.rustup
installed targets for active toolchain
--------------------------------------
arm-unknown-linux-gnueabihf
armv7-unknown-linux-gnueabihf
x86_64-unknown-linux-gnu
active toolchain
----------------
stable-x86_64-unknown-linux-gnu (default)
rustc 1.64.0 (a55dd71d5 2022-09-19)
Now for resolving the issue I have to download the package using the following command:
sudo apt install gcc-armv7-unknown-linux-gnueabihf
but after running the command, I am getting the following error:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package gcc-armv7-unknown-linux-gnueabihf
Upvotes: 3
Views: 1509
Reputation: 323
Please try this:
sudo apt install gcc-arm-linux-gnueabihf
for build your rust project:
cargo build --target=armv7-unknown-linux-gnueabihf
Please check tool - cross: https://github.com/cross-rs/cross Cross uses docker for build and makes libraries isolation.
Upvotes: 1