-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trouble cross compiling for a raspberry pi #7
Comments
Ok, after more googling and guess-and-check I think I figured it out. The missing piece was getting my laptop configured to install packages for other architectures, found on Ask Ubuntu: Cross-compile for armhf and install a static library. This is what worked for me:
#!/bin/sh
SYSROOT=/build/root
export PKG_CONFIG_DIR=
export PKG_CONFIG_LIBDIR=${SYSROOT}/usr/lib/pkgconfig:${SYSROOT}/usr/share/pkgconfig
export PKG_CONFIG_SYSROOT_DIR=${SYSROOT}
export PKG_CONFIG_ALLOW_CROSS=1
# tell pkg-config where to find libudev.pc
export PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig
# tell cargo to link with an armhf compatible linker
export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc
cargo build --release --target=armv7-unknown-linux-gnueabihf Do you think any of this should end up in the README here? I'd be happy to submit a PR, but unsure what level of detail would be useful. |
I got the similar error message in rust docker container:
|
I'm getting some novice cross-compiling errors that I'm not sure how to resolve. I think I don't have libudev-dev setup right, but I'm unsure how to get them in the right place.
libudev-sys
is a transitive dependency of a program I'm trying to compile on my ubuntu laptop and copy a binary over to the pi.My build script:
A sample run:
I'm getting some clear advice, but I don't know how to follow it:
I've run a
apt install libudev-dev
to get the package installed, and that provided/usr/lib/x86_64-linux-gnu/pkgconfig/libudev.pc
; I don't think that's suitable for aarmv7-unknown-linux-gnueabihf
binary. I tried adding that x86_64 path to myPKG_CONFIG_PATH
and was able to get through compilation, but failed at linking:Any pointers on how I could get a
libudev.pc
that's suitable?The text was updated successfully, but these errors were encountered: