-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathCross.toml
More file actions
50 lines (49 loc) · 2.65 KB
/
Copy pathCross.toml
File metadata and controls
50 lines (49 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Local cross-compile config for dec-bench harness tests.
# CI uses manylinux_2_28 directly; this is the convenience path for
# `cross build --target aarch64-unknown-linux-gnu -p moose-cli`.
[build.env]
# Tell openssl-sys to skip the vendored build (it strips deprecated symbols
# like SSL_get_peer_certificate that librdkafka still calls) and link the
# system OpenSSL 1.1 inside the container instead. OPENSSL_NO_VENDOR is the
# documented opt-out for the `vendored` feature — it keeps moose-cli's
# Cargo.toml unchanged so regular native builds keep vendoring.
#
# CC / CXX / AR are passthrough because rdkafka-sys runs librdkafka's
# autoconf `./configure` as a subprocess, which reads bare `$CC` from env
# rather than cargo's target-qualified `CC_aarch64_unknown_linux_gnu`.
# Without them configure defaults to the host `gcc` (x86_64) and ld fails
# with `cannot find -lcrypto` because only arm64 libs are in the sysroot.
# Invoke like:
# CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ AR=aarch64-linux-gnu-ar \
# OPENSSL_NO_VENDOR=1 cross build --target aarch64-unknown-linux-gnu -p moose-cli
passthrough = [
"OPENSSL_NO_VENDOR",
"OPENSSL_LIB_DIR",
"OPENSSL_INCLUDE_DIR",
"OPENSSL_STATIC",
"CC",
"CXX",
"AR",
]
[target.aarch64-unknown-linux-gnu]
# The pinned 0.2.5 image ships libssl 1.0.0, which lacks SSL_get_peer_certificate
# as an exported symbol and fails librdkafka's final link. `:main` is Ubuntu
# 20.04 with libssl 1.1.1, which has the symbol.
image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main"
# cross's /opt/toolchain.cmake pins CMAKE_FIND_ROOT_PATH to /usr/aarch64-linux-gnu
# (sysroot layout), but apt multiarch installs arm64 libs to
# /usr/lib/aarch64-linux-gnu (Debian layout). rdkafka-sys's cmake build of
# librdkafka does FIND_PACKAGE(ZLIB) / FIND_PACKAGE(OpenSSL) and can't see
# across that gap — so we symlink the multiarch lib/headers into the sysroot.
pre-build = [
"dpkg --add-architecture arm64",
"apt-get update",
"apt-get install -y --no-install-recommends protobuf-compiler libprotobuf-dev cmake pkg-config zlib1g-dev:arm64 libssl-dev:arm64",
"mkdir -p /usr/aarch64-linux-gnu/lib /usr/aarch64-linux-gnu/include",
"ln -sf /usr/lib/aarch64-linux-gnu/libz.so /usr/aarch64-linux-gnu/lib/libz.so",
"ln -sf /usr/lib/aarch64-linux-gnu/libz.a /usr/aarch64-linux-gnu/lib/libz.a",
"ln -sf /usr/include/zlib.h /usr/aarch64-linux-gnu/include/zlib.h",
"ln -sf /usr/include/zconf.h /usr/aarch64-linux-gnu/include/zconf.h",
"for f in libssl.so libssl.a libcrypto.so libcrypto.a; do ln -sf /usr/lib/aarch64-linux-gnu/$f /usr/aarch64-linux-gnu/lib/$f; done",
"ln -sfn /usr/include/openssl /usr/aarch64-linux-gnu/include/openssl",
]