Skip to content

Commit e8d7a77

Browse files
committed
configure pkg-config for cross-compilation on the 0.2.5 image
1 parent 3b99bf6 commit e8d7a77

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

.github/workflows/package.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
build:
1212
runs-on: ${{ matrix.os }}-latest
1313
strategy:
14-
fail-fast: true
14+
fail-fast: false
1515
matrix:
1616
include:
1717
- os: ubuntu
@@ -103,7 +103,18 @@ jobs:
103103

104104
- name: Build binary (Linux)
105105
if: matrix.os == 'ubuntu'
106-
run: cross build --release --target ${{ matrix.target }}
106+
# alsa-sys and fontconfig-sys use pkg-config to locate their C libs, but the 0.2.5
107+
# cross image doesn't pre-configure pkg-config for cross-compilation: point it at the
108+
# target arch's .pc files (installed by the Cross.toml pre-build) and allow cross lookups
109+
env:
110+
PKG_CONFIG_ALLOW_CROSS: "1"
111+
run: |
112+
case "${{ matrix.arch }}" in
113+
i386) export PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig ;;
114+
armhf) export PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig ;;
115+
arm64) export PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig ;;
116+
esac
117+
cross build --release --target ${{ matrix.target }}
107118
108119
- name: Build binary (macOS/Windows)
109120
if: matrix.os == 'macos' || matrix.os == 'windows'

Cross.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# forward the pkg-config cross settings (set in the Package workflow) into the containers
2+
[build.env]
3+
passthrough = ["PKG_CONFIG_ALLOW_CROSS", "PKG_CONFIG_PATH"]
4+
15
[target.x86_64-unknown-linux-gnu]
26
# pin the 0.2.5 image (glibc 2.23) to keep releases running on older distros (fixes #1256):
37
# cross's `main` images moved to Ubuntu 24.04 (glibc 2.39)

0 commit comments

Comments
 (0)