Reputation: 57
I've been trying to get a C file to call a function from a Rust library for arm. To compile I tried:
cargo build --target=armv7-unknown-linux-gnueabihf
arm-linux-gnueabi-gcc main.c target/armv7-unknown-linux-gnueabihf/debug/libmyLib.a -o main
I'm getting this error:
error adding symbols: file in wrong format collect2: error: ld returned 1 exit status
For some reason compiling for x86 and with regular gcc it runs and compiles normally.
Upvotes: 1
Views: 533
Reputation: 57
The problem was that I was compiling the Rust with armv7-unknown-linux-gnueabihf
target (armv7) and the C with arm-linux-gnueabi-gcc
(armv6).
Use arm-linux-gnueabihf-gcc
.
Upvotes: 1