I try to crosscompile a project using the midiralsa crate. My build command is PKG_CONFIG_ALLOW_CROSS=1 cargo build --target=armv7-unknown-linux-gnueabihf. Unfortunately i get this error just by adding the crate to my cargo.toml file:
error: linking with `arm-linux-gnueabihf-gcc` failed: exit code: 1
|
= note: "arm-linux-gnueabihf-gcc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-L"
[...]
"-Wl,-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
= note: /usr/lib/libdl.so: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
Im on an archlinux with latest arm-linux-gnueabihf-gcc installed. I installed the armv7-unknown-linux-gnueabihf via rustup. I put a config file in the .cargo folder with the following content:
All dependencies compile without a problem (except the alsa-sys crate needs PKG_CONFIG_ALLOW_CROSS=1 to crosscompile) but in the end my project fails compiling. Has someone an idea what the problem is?
I figured out that i have to set more environment variables as described here. But im not sure what the difference between those vars (PKG_CONFIG_PATH, PKG_CONFIG_LIBDIR and PKG_CONFIG_SYSROOT_DIR) is and how to set them.
When i understand it right there are arm libraries in the /usr/arm-linux-gnueabihf/lib/ folder on my system.
This whole cross compiling topic is fairly new to me so i would appriciate any further help