Skip to content

Commit b732a7b

Browse files
explicitly pass Zlib locations into the aarch64 cross build
1 parent ca644c2 commit b732a7b

File tree

2 files changed

+37
-25
lines changed

2 files changed

+37
-25
lines changed

.github/workflows/build.yaml

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
name: Ensure parseable builds on all release targets
2+
23
on:
34
pull_request:
45
paths-ignore:
56
- docs/**
67
- helm/**
78
- assets/**
89
- "**.md"
10+
911
jobs:
1012
# Default build without Kafka
1113
build-default:
@@ -22,35 +24,38 @@ jobs:
2224
- os: ubuntu-latest
2325
target: aarch64-unknown-linux-gnu
2426
use_cross: true
27+
2528
# macOS builds - both native on macos-latest (M1)
2629
- os: macos-latest
2730
target: x86_64-apple-darwin
2831
use_cross: false
2932
- os: macos-latest
3033
target: aarch64-apple-darwin
3134
use_cross: false
35+
3236
# Windows build
3337
- os: windows-latest
3438
target: x86_64-pc-windows-msvc
3539
use_cross: false
40+
3641
steps:
3742
- uses: actions/checkout@v4
38-
43+
3944
- name: Setup Rust toolchain
4045
uses: dtolnay/rust-toolchain@nightly
4146
with:
4247
targets: ${{ matrix.target }}
43-
48+
4449
- name: Install GCC 11 on Linux
4550
if: runner.os == 'Linux'
4651
run: |
4752
sudo apt-get update
4853
sudo apt-get install -y gcc-11 g++-11
49-
54+
5055
- name: Install cross
5156
if: matrix.use_cross
5257
run: cargo install cross --git https://github.com/cross-rs/cross
53-
58+
5459
- name: Cache dependencies
5560
uses: actions/cache@v4
5661
with:
@@ -59,13 +64,13 @@ jobs:
5964
~/.cargo/git
6065
target
6166
key: ${{ runner.os }}-cargo-${{ matrix.target }}-default-${{ hashFiles('**/Cargo.lock') }}
62-
67+
6368
- name: Build with cross
6469
if: matrix.use_cross
6570
env:
6671
CROSS_NO_WARNINGS: "0"
6772
run: cross build --target ${{ matrix.target }} --release
68-
73+
6974
- name: Build native
7075
if: ${{ !matrix.use_cross }}
7176
env:
@@ -85,25 +90,28 @@ jobs:
8590
- os: ubuntu-latest
8691
target: x86_64-unknown-linux-gnu
8792
use_cross: false
93+
8894
# Linux aarch64 - cross-compile
8995
- os: ubuntu-latest
9096
target: aarch64-unknown-linux-gnu
9197
use_cross: true
98+
9299
# macOS aarch64 - native on M1
93100
- os: macos-latest
94101
target: aarch64-apple-darwin
95102
use_cross: false
103+
96104
steps:
97105
- uses: actions/checkout@v4
98-
106+
99107
- name: Set up Docker Buildx
100108
if: matrix.use_cross
101109
uses: docker/setup-buildx-action@v3
102-
110+
103111
- name: Set up QEMU for cross-arch builds
104112
if: matrix.use_cross
105113
uses: docker/setup-qemu-action@v3
106-
114+
107115
# Linux-specific dependencies for native x86_64 build
108116
- name: Install Linux dependencies (x86_64)
109117
if: runner.os == 'Linux' && matrix.target == 'x86_64-unknown-linux-gnu'
@@ -122,7 +130,7 @@ jobs:
122130
libssl-dev \
123131
libsasl2-dev \
124132
python3
125-
133+
126134
# macOS-specific dependencies
127135
- name: Install macOS dependencies
128136
if: runner.os == 'macOS'
@@ -135,16 +143,16 @@ jobs:
135143
openssl@3.0 \
136144
cyrus-sasl \
137145
python3
138-
146+
139147
- name: Setup Rust toolchain
140148
uses: dtolnay/rust-toolchain@nightly
141149
with:
142150
targets: ${{ matrix.target }}
143-
151+
144152
- name: Install cross for aarch64
145153
if: matrix.use_cross
146154
run: cargo install cross --git https://github.com/cross-rs/cross
147-
155+
148156
- name: Cache dependencies
149157
uses: actions/cache@v4
150158
with:
@@ -153,7 +161,7 @@ jobs:
153161
~/.cargo/git
154162
target
155163
key: ${{ runner.os }}-cargo-${{ matrix.target }}-kafka-${{ hashFiles('**/Cargo.lock') }}
156-
164+
157165
- name: Find and fix librdkafka CMakeLists.txt for Linux
158166
if: runner.os == 'Linux' && !matrix.use_cross
159167
run: |
@@ -175,7 +183,7 @@ jobs:
175183
echo "Could not find librdkafka CMakeLists.txt file!"
176184
exit 1
177185
fi
178-
186+
179187
- name: Find and fix librdkafka CMakeLists.txt for macOS
180188
if: runner.os == 'macOS'
181189
run: |
@@ -197,7 +205,7 @@ jobs:
197205
echo "Could not find librdkafka CMakeLists.txt file!"
198206
exit 1
199207
fi
200-
208+
201209
- name: Build with Kafka (cross)
202210
if: matrix.use_cross
203211
env:
@@ -206,8 +214,7 @@ jobs:
206214
CROSS_NO_WARNINGS: "0"
207215
RUST_BACKTRACE: "1"
208216

209-
# Zlib hints for CMake
210-
ZLIB_ROOT: "/usr"
217+
# Zlib hints for CMake (explicit include/lib, no ZLIB_ROOT)
211218
ZLIB_INCLUDE_DIR: "/usr/include/aarch64-linux-gnu"
212219
ZLIB_LIBRARY: "/usr/lib/aarch64-linux-gnu/libz.so"
213220

@@ -216,13 +223,19 @@ jobs:
216223
OPENSSL_INCLUDE_DIR: "/usr/include/aarch64-linux-gnu"
217224
OPENSSL_CRYPTO_LIBRARY: "/usr/lib/aarch64-linux-gnu/libcrypto.so"
218225
OPENSSL_SSL_LIBRARY: "/usr/lib/aarch64-linux-gnu/libssl.so"
226+
219227
PKG_CONFIG_PATH: "/usr/lib/aarch64-linux-gnu/pkgconfig"
220-
run: cross build --target ${{ matrix.target }} --features kafka --release --verbose
221-
228+
run: |
229+
echo "ZLIB_INCLUDE_DIR=$ZLIB_INCLUDE_DIR"
230+
echo "ZLIB_LIBRARY=$ZLIB_LIBRARY"
231+
ls -l /usr/include/aarch64-linux-gnu || true
232+
ls -l /usr/lib/aarch64-linux-gnu/libz* || true
233+
cross build --target ${{ matrix.target }} --features kafka --release --verbose
234+
222235
- name: Build with Kafka (native)
223236
if: ${{ !matrix.use_cross }}
224237
env:
225238
CC: ${{ runner.os == 'Linux' && 'gcc-11' || '' }}
226239
CXX: ${{ runner.os == 'Linux' && 'g++-11' || '' }}
227240
LIBRDKAFKA_SSL_VENDORED: "1"
228-
run: cargo build --target ${{ matrix.target }} --features kafka --release
241+
run: cargo build --target ${{ matrix.target }} --features kafka --release

Cross.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pre-build = [
44
"dpkg --add-architecture arm64",
55
"apt-get update || true",
66
"apt-get install -y pkg-config:arm64 zlib1g-dev:arm64 libssl-dev:arm64 libsasl2-dev:arm64 libzstd-dev:arm64 liblz4-dev:arm64 || true",
7-
# debug: confirm zlib and headers exist
7+
# debug to confirm libs/headers are present
88
"ls -R /usr/lib/aarch64-linux-gnu || true",
99
"ls -R /usr/include/aarch64-linux-gnu || true",
1010
]
@@ -15,8 +15,7 @@ passthrough = [
1515
"PKG_CONFIG_ALLOW_CROSS",
1616
"CROSS_NO_WARNINGS",
1717
"RUST_BACKTRACE",
18-
# Zlib hints for CMake
19-
"ZLIB_ROOT",
18+
# Explicit Zlib hints (used by CMake FindZLIB)
2019
"ZLIB_INCLUDE_DIR",
2120
"ZLIB_LIBRARY",
2221
# OpenSSL hints
@@ -32,4 +31,4 @@ volumes = [
3231
]
3332

3433
[target.x86_64-unknown-linux-gnu]
35-
image = "ghcr.io/cross-rs/x86_64-unknown-linux-gnu@sha256:bf05360bb9d6d4947eed60532ac7a0d7e8fae8f214e9abb801d5941c8fe4918d"
34+
image = "ghcr.io/cross-rs/x86_64-unknown-linux-gnu@sha256:bf05360bb9d6d4947eed60532ac7a0d7e8fae8f214e9abb801d5941c8fe491

0 commit comments

Comments
 (0)