Skip to content

Commit 50c4cbc

Browse files
committed
OpenWrt musl target uses musl headers not glibc
aarch64 musl target used glibc headers which are not compatible with musl. Since glibc 2.38 the headers redirect strtol/sscanf to __isoc23_strtol/__isoc23_sscanf which are not present in musl. AWS_LC_SYS_INCLUDE* are used for building only with cmake. Special includes are not needed for armv7_musl - include paths are read from linker in config.toml.
1 parent b0878e6 commit 50c4cbc

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎builders/build-openwrt-rust/Dockerfile‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ RUN set -eux; \
2424
else \
2525
apt-get install -y python3-pip; \
2626
fi; \
27+
dpkg --add-architecture arm64; \
28+
apt-get update; \
29+
# for aarch64 musl headers, should not use glibc headers
30+
apt-get install -y musl-dev:arm64; \
2731
rm -rf /var/lib/apt/lists/*
2832

2933
# protoc
@@ -69,8 +73,8 @@ RUN rustup component add clippy rustfmt
6973
# Cargo linker config for cross-compilation
7074
COPY builders/build-openwrt-rust/cargo-config.toml ${CARGO_HOME}/config.toml
7175

72-
# AWS LC includes for cross-compilation
73-
ENV AWS_LC_SYS_INCLUDES_aarch64_unknown_linux_musl="/usr/aarch64-linux-gnu/include"
74-
ENV AWS_LC_SYS_INCLUDES_armv7_unknown_linux_musleabihf="/opt/arm-linux-musleabihf-cross/arm-linux-musleabihf/include"
76+
# musl include for cross-compilation (needed for AWS_LC)
77+
# rustup doesn't bundle musl includes and includes are picked from linker aarch64-linux-gnu-gcc
78+
ENV CFLAGS_aarch64_unknown_linux_musl="-isystem /usr/include/aarch64-linux-musl"
7579

7680
ENV BYPASS_LLT_SECRETS=1

0 commit comments

Comments
 (0)