Commit 7d748e5
committed
fix(docker): cross-compile BoringSSL for the arm64 image leg
The v0.35.0 multi-arch image build failed linking every binary for
aarch64:
ld: libbtls_sys.rlib(base64.cc.o): Relocations in generic ELF (EM: 62)
ld: libbtls_sys.rlib: error adding symbols: file in wrong format
EM 62 is x86-64: btls-sys compiled its vendored BoringSSL for the HOST
while the Rust half targeted aarch64. btls-sys does apply an aarch64
CMAKE_TOOLCHAIN_FILE, but that file sets only CMAKE_SYSTEM_NAME and
CMAKE_SYSTEM_PROCESSOR and then says "Rely on environment variables to
set the compiler and include paths". Because a toolchain file is present
the cmake crate does not inject CMAKE_C_COMPILER either, so CMake picked
the host cc.
Setting the per-target compiler variables the cc crate reads is what
reaches CMake through it. Verified in a bookworm container with the same
cross toolchain the image installs: all three binaries now link as
"ELF 64-bit LSB pie executable, ARM aarch64", and the objects inside
libbtls_sys.rlib are aarch64 rather than x86-64.
The names are target-suffixed, so the amd64 leg ignores them.
Note for anyone reading the image contents: the three packages are built
in one cargo invocation, so the impersonated feature enabled for
crw-server unifies onto the shared crw-renderer and the `crw` CLI in the
image links BoringSSL too. The published release binaries are built
separately with no features and are unaffected.1 parent 7ae6353 commit 7d748e5
1 file changed
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
87 | 97 | | |
| 98 | + | |
| 99 | + | |
88 | 100 | | |
89 | 101 | | |
90 | 102 | | |
| |||
0 commit comments