1

I am new to rust and trying to do cross compilation. However while doing that I am getting an error error: failed to run custom build command for libudev-sys v0.1.4 . I tried following the solution at

https://github.com/dcuddeback/libudev-sys/issues/7

However, I was not able to resolve the issue. I am using Ubuntu 20.04 and want to cross compile for raspberry pi.

It would be great if someone can provide me an insight to what should I include in the build script.

#!/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

Any help would be much appreciated

Ankit Kumar
  • 403
  • 3
  • 8

1 Answers1

0

just install in the package (this command is for ubuntu)

 sudo apt-get install -y  libudev-dev

Brian Horakh
  • 329
  • 4
  • 12