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

xx-cargo fails with crates using pkg-config in build scripts #107

Open
jprendes opened this issue May 26, 2023 · 1 comment · May be fixed by #108
Open

xx-cargo fails with crates using pkg-config in build scripts #107

jprendes opened this issue May 26, 2023 · 1 comment · May be fixed by #108

Comments

@jprendes
Copy link

The following Dockerfile fails to build when target platform != build platform:

# syntax=docker/dockerfile:1
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.2.1 AS xx
FROM --platform=$BUILDPLATFORM rust:1.69.0 AS base
COPY --from=xx / /
RUN apt-get update -y && apt-get install --no-install-recommends -y clang pkg-config dpkg-dev
WORKDIR /work
ARG TARGETPLATFORM
RUN xx-apt-get install -y gcc libdbus-1-dev
RUN xx-cargo install dbus --example client --root /usr/local
RUN xx-verify /usr/local/bin/client

Building on an amd64 machine with

docker buildx build --platform=linux/arm64 .

results in the following error

#0 70.24   --- stderr
#0 70.24   pkg_config failed: pkg-config has not been configured to support cross-compilation.
#0 70.24 
#0 70.24   Install a sysroot for the target platform and configure it via
#0 70.24   PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a
#0 70.24   cross-compiling wrapper for pkg-config and set it via
#0 70.24   PKG_CONFIG environment variable.
#0 70.24   One possible solution is to check whether packages
#0 70.24   'libdbus-1-dev' and 'pkg-config' are installed:
#0 70.24   On Ubuntu:
#0 70.24   sudo apt install libdbus-1-dev pkg-config
#0 70.24   On Fedora:
#0 70.24   sudo dnf install dbus-devel pkgconf-pkg-config
#0 70.24 
#0 70.24   thread 'main' panicked at 'explicit panic', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/libdbus-sys-0.2.5/build.rs:25:9
#0 70.24   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@jprendes
Copy link
Author

IIUC PKG_CONFIG is never set since xx-cargo is probing for aarch64-unknown-linux-gnu-pkg-config instead of aarch64-linux-gnu-pkg-config

@jprendes jprendes linked a pull request May 26, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant