Skip to content

Commit ad7f099

Browse files
fix for aarch64 kafka build
1 parent 7acfd2e commit ad7f099

File tree

1 file changed

+35
-17
lines changed

1 file changed

+35
-17
lines changed

.github/workflows/build.yaml

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -113,21 +113,6 @@ jobs:
113113
libsasl2-dev \
114114
python3
115115
116-
# Linux dependencies for aarch64 cross-compilation
117-
- name: Install Linux dependencies (aarch64 cross)
118-
if: runner.os == 'Linux' && matrix.target == 'aarch64-unknown-linux-gnu'
119-
run: |
120-
sudo apt-get update
121-
sudo apt-get install -y \
122-
gcc-11 \
123-
g++-11 \
124-
build-essential \
125-
pkg-config \
126-
cmake \
127-
clang \
128-
gcc-aarch64-linux-gnu \
129-
g++-aarch64-linux-gnu
130-
131116
# macOS-specific dependencies
132117
- name: Install macOS dependencies
133118
if: runner.os == 'macOS'
@@ -146,10 +131,40 @@ jobs:
146131
with:
147132
targets: ${{ matrix.target }}
148133

149-
- name: Install cross
134+
- name: Install cross for aarch64
150135
if: matrix.use_cross
151136
run: cargo install cross --git https://github.com/cross-rs/cross
152137

138+
- name: Create Cross.toml for aarch64 Kafka build
139+
if: matrix.use_cross && matrix.target == 'aarch64-unknown-linux-gnu'
140+
run: |
141+
cat > Cross.toml << 'EOF'
142+
[target.aarch64-unknown-linux-gnu]
143+
pre-build = [
144+
"dpkg --add-architecture arm64",
145+
"sed -i 's/deb http/deb [arch=amd64] http/g' /etc/apt/sources.list",
146+
"echo 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe multiverse' >> /etc/apt/sources.list",
147+
"echo 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe multiverse' >> /etc/apt/sources.list",
148+
"apt-get update || true",
149+
"apt-get install -y pkg-config:arm64 || true",
150+
"apt-get install -y zlib1g-dev:arm64 || true",
151+
"apt-get install -y libssl-dev:arm64 || true",
152+
"apt-get install -y libsasl2-dev:arm64 || true",
153+
"apt-get install -y libzstd-dev:arm64 || true",
154+
"apt-get install -y liblz4-dev:arm64 || true",
155+
]
156+
157+
[build.env]
158+
passthrough = [
159+
"LIBRDKAFKA_SSL_VENDORED",
160+
"PKG_CONFIG_ALLOW_CROSS",
161+
]
162+
volumes = [
163+
"/usr/lib/aarch64-linux-gnu:/usr/lib/aarch64-linux-gnu",
164+
]
165+
EOF
166+
cat Cross.toml
167+
153168
- name: Cache dependencies
154169
uses: actions/cache@v4
155170
with:
@@ -205,12 +220,15 @@ jobs:
205220
206221
- name: Build with Kafka (cross)
207222
if: matrix.use_cross
223+
env:
224+
LIBRDKAFKA_SSL_VENDORED: "1"
225+
PKG_CONFIG_ALLOW_CROSS: "1"
208226
run: cross build --target ${{ matrix.target }} --features kafka --release
209227

210228
- name: Build with Kafka (native)
211229
if: ${{ !matrix.use_cross }}
212230
env:
213231
CC: ${{ runner.os == 'Linux' && 'gcc-11' || '' }}
214232
CXX: ${{ runner.os == 'Linux' && 'g++-11' || '' }}
215-
LIBRDKAFKA_SSL_VENDORED: 1
233+
LIBRDKAFKA_SSL_VENDORED: "1"
216234
run: cargo build --target ${{ matrix.target }} --features kafka --release

0 commit comments

Comments
 (0)