Skip to content
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

Cross compilation fails (for armv7-unknown-linux-gnueabihf) #7

Closed
eflukx opened this issue Mar 7, 2022 · 1 comment
Closed

Cross compilation fails (for armv7-unknown-linux-gnueabihf) #7

eflukx opened this issue Mar 7, 2022 · 1 comment

Comments

@eflukx
Copy link

eflukx commented Mar 7, 2022

When trying to compile the example on Ubuntu x64 (WSL2) for Raspberry Pi 3 (i.e. armv7-unknown-linux-gnueabihf), compilation fails. This (AFAICS) has to do with the failing cross compilation of some native libraries: pkg_config failed: pkg-config has not been configured to support cross-compilation.

Just wanted to add this issue for future reference for other users bumping into this same issue. Found this issue on the dbus-rs repo outlining the problem and offering a (rather complicated) solution. Haven't tried it yet, but seems promising.

Expected Behavior

Successful compilation of the example.

Actual Behavior

❯ cargo build --target armv7-unknown-linux-gnueabihf --example testing
   Compiling libdbus-sys v0.2.2
   Compiling quote v1.0.15
   Compiling num-traits v0.2.14
error: failed to run custom build command for `libdbus-sys v0.2.2`

Caused by:
  process didn't exit successfully: `/home/eflukx/code-native/networkmanager-rs/target/debug/build/libdbus-sys-3da2e4d0d9fbb5c1/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=DBUS_1_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
  pkg_config failed: pkg-config has not been configured to support cross-compilation.

  Install a sysroot for the target platform and configure it via
  PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a
  cross-compiling wrapper for pkg-config and set it via
  PKG_CONFIG environment variable.
  One possible solution is to check whether packages
  'libdbus-1-dev' and 'pkg-config' are installed:
  On Ubuntu:
  sudo apt install libdbus-1-dev pkg-config
  On Fedora:
  sudo dnf install dbus-devel pkgconf-pkg-config

  thread 'main' panicked at 'explicit panic', /home/eflukx/.cargo/registry/src/garden.eu.org-1ecc6299db9ec823/libdbus-sys-0.2.2/build.rs:16:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed

Steps to Reproduce the Problem

  1. sudo apt install libdbus-1-dev pkg-config
  2. cargo build --target armv7-unknown-linux-gnueabihf --example testing
  3. see it fail
@eflukx eflukx changed the title Cross compilation (for armv7-unknown-linux-gnueabihf) fails Cross compilation fails (for armv7-unknown-linux-gnueabihf) Mar 7, 2022
@IniterWorker
Copy link
Collaborator

Hi @eflukx,

You should check your env/sdk/rootfs.

One possible solution is to check whether packages
  'libdbus-1-dev' and 'pkg-config' are installed:

networkmanager-rs is building fine under Tier 2:

. /opt/poky/3.4.1/.../environment-setup-cortexa7t2hf-neon-poky-linux-gnueabi
[7:08:17] initerworker:networkmanager-rs git:(master) $ cargo build --target armv7-unknown-linux-gnueabihf --release
Finished release [optimized] target(s) in 8.22s

B.r,

@zibebe zibebe closed this as completed Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants