Failed to run custom build command for `libudev-sys v0.1.4` while doing cross compilation

I am doing cross compilation on my laptop for raspberry pi.
Target triplet on my laptop x86_64-linux-gnu
Target triplet on my raspberry pi is arm-linux-gnueabihf
I am using UBUNTU 20.04

.cargo/confi.toml has

[target.armv7-unknown-linux-musleabihf]
linker = "ld.lld"


[target.arm-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"

However, I am getting this error

Compiling regex-automata v0.1.10
   Compiling owned_ttf_parser v0.6.0
   Compiling futures-task v0.3.24
   Compiling crc32fast v1.3.2
   Compiling libudev-sys v0.1.4
   Compiling crossbeam-utils v0.8.12
   Compiling unicode-normalization v0.1.22
   Compiling maybe-uninit v2.0.0
   Compiling wide v0.7.4
   Compiling http-body v0.3.1
   Compiling headers-core v0.2.0
   Compiling matrixmultiply v0.1.15
   Compiling httparse v1.8.0
   Compiling num_cpus v1.13.1
**error: failed to run custom build command for `libudev-sys v0.1.4`**

Caused by:
  process didn't exit successfully: `/home/abc/csd/target/release/build/libudev-sys-0463db1d4d4cbd4d/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=LIBUDEV_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_armv7-unknown-linux-gnueabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_armv7_unknown_linux_gnueabihf
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
  cargo:rerun-if-env-changed=PKG_CONFIG_armv7-unknown-linux-gnueabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_armv7_unknown_linux_gnueabihf
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_armv7-unknown-linux-gnueabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_armv7_unknown_linux_gnueabihf
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "pkg-config has not been configured to support cross-compilation.\n\nInstall a sysroot for the target platform and configure it via\nPKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a\ncross-compiling wrapper for pkg-config and set it via\nPKG_CONFIG environment variable."', /home/akumar/.cargo/registry/src/github.com-1ecc6299db9ec823/libudev-sys-0.1.4/build.rs:38:41
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.