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

pkgconfig search path not defined for arm-unknown-linux-gnueabihf #1316

Closed
5 of 12 tasks
kingosticks opened this issue Aug 23, 2023 · 7 comments · Fixed by #1317
Closed
5 of 12 tasks

pkgconfig search path not defined for arm-unknown-linux-gnueabihf #1316

kingosticks opened this issue Aug 23, 2023 · 7 comments · Fixed by #1317

Comments

@kingosticks
Copy link
Contributor

kingosticks commented Aug 23, 2023

Checklist

Describe your issue

I'm trying to cross-compile with arm-unknown-linux-gnueabihf and hitting a pkgconfig search path issue.

error: failed to run custom build command for `glib-sys v0.19.0 (https://github.com/gtk-rs/gtk-rs-core#8986eb97)`

Caused by:
  process didn't exit successfully: `/target/debug/build/glib-sys-9eb477152870afcb/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=GLIB_2.0_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_arm-unknown-linux-gnueabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_arm_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_arm-unknown-linux-gnueabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_arm_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_PATH_arm-unknown-linux-gnueabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_arm_unknown_linux_gnueabihf
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_arm-unknown-linux-gnueabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_arm_unknown_linux_gnueabihf
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_arm-unknown-linux-gnueabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_arm_unknown_linux_gnueabihf
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:warning=`PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" "pkg-config" "--libs" "--cflags" "glib-2.0" "glib-2.0 >= 2.56"` did not exit successfully: exit status: 1
  error: could not find system library 'glib-2.0' required by the 'glib-sys' crate

  --- stderr
  Package glib-2.0 was not found in the pkg-config search path.
  Perhaps you should add the directory containing `glib-2.0.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'glib-2.0' found
  Package glib-2.0 was not found in the pkg-config search path.
  Perhaps you should add the directory containing `glib-2.0.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'glib-2.0' found

If I login to the container I can see the .pc files exist but PKG_CONFIG_PATH isn't set. If I manually set it to "/usr/lib/arm-linux-gnueabihf/pkgconfig", my cargo build completes successfully. Looking at the docker images at cross/docker, everything except Dockerfile.arm-unknown-linux-gnueabihf
is setting PKG_CONFIG_PATH. It was briefly added (strangely to to path /usr/lib/usr/arm-linux-gnueabihf/pkgconfig), only to be removed shortly afterwards.

Was setting PKG_CONFIG_PATH supposed to be reverted like this? If so, how is pkg-config supposed to work in arm-unknown-linux-gnueabihf ?

What target(s) are you cross-compiling for?

arm-unknown-linux-gnueabihf

Which operating system is the host (e.g computer cross is on) running?

  • macOS
  • Windows
  • Linux / BSD
  • other OS (specify in description)

What architecture is the host?

  • x86_64 / AMD64
  • arm32
  • arm64 (including Mac M1)

What container engine is cross using?

  • docker
  • podman
  • other container engine (specify in description)

cross version

cross 0.2.5 (37c681a 2023-07-17)

Example

Cross.toml

[build]
pre-build = [
    "rm /etc/apt/preferences.d/all-packages",
    "dpkg --add-architecture $CROSS_DEB_ARCH",
    "apt-get update",
    "DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes libglib2.0-dev:$CROSS_DEB_ARCH libgstreamer1.0-dev:$CROSS_DEB_ARCH libgstreamer-plugins-base1.0-dev:$CROSS_DEB_ARCH"
]
  1. git clone --depth 1 -b main https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
  2. cd gst-plugins-rs
  3. CROSS_CONFIG=/path/to/Cross.toml cross build --target arm-unknown-linux-gnueabihf --package gst-plugin-spotify

Additional information / notes

It builds with the other arm targets, for example armv7-unknown-linux-gnueabihf.

@Emilgardis
Copy link
Member

I dont see any harm adding it back in. The reasoning was that it wouldnt be needed anymore, but I suppose that is not true if you're certain the library you retrieved with apt is armv6.

@kingosticks
Copy link
Contributor Author

Ahh right yes of course, that does make sense. I forgot entirely that most don't install new packages on this platform. Would a PR be welcome for this? Otherwise I'm happy enough setting this in my own extra dockerfile.

bors bot added a commit that referenced this issue Aug 23, 2023
1317: Re-add PKG_CONFIG_PATH for armhf image r=Emilgardis a=kingosticks

It doesn't hurt to have this also defined for arm-unknown-linux-gnueabihf despite apt package installation being disabled by default for this platform. Fixes #1316

Co-authored-by: Nick Steel <[email protected]>
@bors bors bot closed this as completed in d441966 Aug 23, 2023
@kingosticks
Copy link
Contributor Author

Thanks! To now make use of this, is there a nightly image tag, or something ?

@Emilgardis
Copy link
Member

Ideally you'd be able to use it straight away, but thanks to #1208 I'm not able to merge prs where they build new main/edge images as they'd fail. But, we have a weekly CI job that does it, I've trigger it now https://github.com/cross-rs/cross/actions/runs/5954326633

@Emilgardis
Copy link
Member

And done!
https://github.com/cross-rs/cross/pkgs/container/arm-unknown-linux-gnueabihf/121385772?tag=main

@kingosticks
Copy link
Contributor Author

Thanks so much. Will take it for a spin.

@edgarriba
Copy link

hi, I'm having the same issue using the latest aarch64unknown-linux-gnu`. Is there any other solution for it ?

** https://github.com/cross-rs/cross/pkgs/container/aarch64-unknown-linux-gnu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants