admin管理员组

文章数量:1123779

I am having issues cross compiling for armv7 target. The main issue is with that it can't find libudev however my pkg-config says i have it.


> pkg-config --list-all | grep libudev
libudev                        libudev - Library to access udev device information

and when I compile the program to x86_64 it successfully compiles but when i compile to armv7 it fails

> cargo build --target armv7-unknown-linux-musleabihf
   Compiling libudev-sys v0.1.4
   Compiling error-chain v0.10.0
error: failed to run custom build command for `libudev-sys v0.1.4`

Caused by:
  process didn't exit successfully: `/project/target/debug/build/libudev-sys-8ce792348ab024e9/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-musleabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_armv7_unknown_linux_musleabihf
  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-musleabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_armv7_unknown_linux_musleabihf
  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-musleabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_armv7_unknown_linux_musleabihf
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

  --- stderr
  thread 'main' panicked at /usr/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libudev-sys-0.1.4/build.rs:38:41:
  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."
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...


I have followed other SO posts like error: failed to run custom build command for `libudev-sys v0.1.4` but nothing has helped. Do I have to install a spesific libudev or have I miss configured somthing?

本文标签: linuxIssue cross compiling libudev for armv7 with rustStack Overflow