Skip to content

Fix CMake Support and Enhance Newlib Targets #1112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changes/1112.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"description": "fixed CMake support for Android and newlib targets.",
"type": "fixed",
"issues": [1110]
},
{
"description": "added C++ support for newlib targets.",
"type": "added"
}
]
61 changes: 53 additions & 8 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,10 @@ main() {
retry cargo fetch
# don't use xargo: should have native support just from rustc
rustup toolchain add nightly
"${CROSS[@]}" build --lib --target "${TARGET}" ${CROSS_FLAGS}
cross_build --lib --target "${TARGET}"
popd

rm -rf "${td}"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now want to run the CMake tests as well.

return
fi

# `cross build` test for the other targets
Expand All @@ -83,7 +81,7 @@ main() {
pushd "${td}"
cargo init --lib --name foo .
retry cargo fetch
"${CROSS[@]}" build --target "${TARGET}" ${CROSS_FLAGS}
cross_build --target "${TARGET}"
popd

rm -rf "${td}"
Expand All @@ -94,7 +92,7 @@ main() {
# test that linking works
cargo init --bin --name hello .
retry cargo fetch
"${CROSS[@]}" build --target "${TARGET}" ${CROSS_FLAGS}
cross_build --target "${TARGET}"
popd

rm -rf "${td}"
Expand Down Expand Up @@ -166,18 +164,32 @@ main() {

fi

# Test C++ support
# Test C++ support in a no_std context
if (( ${CPP:-0} )); then
td="$(mkcargotemp -d)"

git clone --depth 1 https://github.com/cross-rs/rust-cpp-accumulate "${td}"

pushd "${td}"
retry cargo fetch
cross_build --target "${TARGET}"
popd

rm -rf "${td}"
fi

# Test C++ support
if (( ${STD:-0} )) && (( ${CPP:-0} )); then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assumes we have C++ and std support, so we have to make that explicit.

td="$(mkcargotemp -d)"

git clone --depth 1 https://github.com/cross-rs/rust-cpp-hello-word "${td}"

pushd "${td}"
retry cargo fetch
if (( ${RUN:-0} )); then
cross_run --target "${TARGET}"
else
"${CROSS[@]}" build --target "${TARGET}" ${CROSS_FLAGS}
cross_build --target "${TARGET}"
fi
popd

Expand All @@ -193,11 +205,44 @@ main() {
cargo init --bin --name hello .
retry cargo fetch
RUSTFLAGS="-C target-feature=-crt-static" \
"${CROSS[@]}" build --target "${TARGET}" ${CROSS_FLAGS}
cross_build --target "${TARGET}"
popd

rm -rf "${td}"
fi

# test cmake support
td="$(mkcargotemp -d)"

git clone \
--recursive \
--depth 1 \
https://github.com/cross-rs/rust-cmake-hello-world "${td}"

pushd "${td}"
retry cargo fetch
if [[ "${TARGET}" == "arm-linux-androideabi" ]]; then
# ARMv5te isn't supported anymore by Android, which produces missing
# symbol errors with re2 like `__libcpp_signed_lock_free`.
cross_run --target "${TARGET}" --features=tryrun
elif (( ${STD:-0} )) && (( ${RUN:-0} )) && (( ${CPP:-0} )); then
cross_run --target "${TARGET}" --features=re2,tryrun
elif (( ${STD:-0} )) && (( ${CPP:-0} )); then
cross_build --target "${TARGET}" --features=re2
elif (( ${STD:-0} )) && (( ${RUN:-0} )); then
cross_run --target "${TARGET}" --features=tryrun
elif (( ${STD:-0} )); then
cross_build --target "${TARGET}" --features=tryrun
else
cross_build --lib --target "${TARGET}"
fi
popd

rm -rf "${td}"
}

cross_build() {
"${CROSS[@]}" build "$@" ${CROSS_FLAGS}
}

cross_run() {
Expand Down
12 changes: 10 additions & 2 deletions docker/Dockerfile.aarch64-linux-android
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,18 @@ RUN /android-system.sh arm64

ENV CROSS_TOOLCHAIN_PREFIX=aarch64-linux-android-
ENV CROSS_SYSROOT=/android-ndk/sysroot
ENV CROSS_ANDROID_SDK=$ANDROID_SDK
COPY android-symlink.sh /
RUN /android-symlink.sh aarch64 aarch64-linux-android

COPY android-runner /
COPY android.cmake /opt/toolchain.cmake

# Libz is distributed in the android ndk, but for some unknown reason it is not
# found in the build process of some crates, so we explicit set the DEP_Z_ROOT
ENV CROSS_TARGET_RUNNER="/android-runner aarch64"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows us to use it both for the cargo runner and for CMAKE_CROSSCOMPILING_EMULATOR, which is required when using try_run in some CMake build systems.

ENV CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \
CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER="/android-runner aarch64" \
CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER="$CROSS_TARGET_RUNNER" \
AR_aarch64_linux_android="$CROSS_TOOLCHAIN_PREFIX"ar \
AS_aarch64_linux_android="$CROSS_TOOLCHAIN_PREFIX"as \
CC_aarch64_linux_android="$CROSS_TOOLCHAIN_PREFIX"gcc \
Expand All @@ -56,11 +59,16 @@ ENV CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \
SIZE_aarch64_linux_android="$CROSS_TOOLCHAIN_PREFIX"size \
STRINGS_aarch64_linux_android="$CROSS_TOOLCHAIN_PREFIX"strings \
STRIP_aarch64_linux_android="$CROSS_TOOLCHAIN_PREFIX"strip \
CMAKE_TOOLCHAIN_FILE_aarch64_linux_android=/opt/toolchain.cmake \
BINDGEN_EXTRA_CLANG_ARGS_aarch64_linux_android="--sysroot=$CROSS_SYSROOT" \
DEP_Z_INCLUDE="$CROSS_SYSROOT/usr/include"/ \
RUST_TEST_THREADS=1 \
HOME=/tmp/ \
TMPDIR=/tmp/ \
ANDROID_DATA=/ \
ANDROID_DNS_MODE=local \
ANDROID_ROOT=/system
ANDROID_ROOT=/system \
CROSS_CMAKE_SYSTEM_NAME=Android \
CROSS_CMAKE_SYSTEM_PROCESSOR=aarch64 \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CROSS_CMAKE_SYSTEM_PROCESSOR is required for CMAKE_SYSTEM_PROCESSOR and CROSS_CMAKE_SYSTEM_NAME is just provided for consistency with every other toolchain.

CROSS_CMAKE_CRT=android \
CROSS_CMAKE_OBJECT_FLAGS="-DANDROID -ffunction-sections -fdata-sections -fPIC"
11 changes: 9 additions & 2 deletions docker/Dockerfile.aarch64-unknown-linux-gnu
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,22 @@ COPY linux-image.sh /
RUN /linux-image.sh aarch64

COPY linux-runner base-runner.sh /
COPY toolchain.cmake /opt/toolchain.cmake

ENV CROSS_TOOLCHAIN_PREFIX=aarch64-linux-gnu-
ENV CROSS_SYSROOT=/usr/aarch64-linux-gnu
ENV CROSS_TARGET_RUNNER="/linux-runner aarch64"
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="/linux-runner aarch64" \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="$CROSS_TARGET_RUNNER" \
AR_aarch64_unknown_linux_gnu="$CROSS_TOOLCHAIN_PREFIX"ar \
CC_aarch64_unknown_linux_gnu="$CROSS_TOOLCHAIN_PREFIX"gcc \
CXX_aarch64_unknown_linux_gnu="$CROSS_TOOLCHAIN_PREFIX"g++ \
CMAKE_TOOLCHAIN_FILE_aarch64_unknown_linux_gnu=/opt/toolchain.cmake \
BINDGEN_EXTRA_CLANG_ARGS_aarch64_unknown_linux_gnu="--sysroot=$CROSS_SYSROOT" \
QEMU_LD_PREFIX="$CROSS_SYSROOT" \
RUST_TEST_THREADS=1 \
PKG_CONFIG_PATH="/usr/lib/aarch64-linux-gnu/pkgconfig/:${PKG_CONFIG_PATH}"
PKG_CONFIG_PATH="/usr/lib/aarch64-linux-gnu/pkgconfig/:${PKG_CONFIG_PATH}" \
CROSS_CMAKE_SYSTEM_NAME=Linux \
CROSS_CMAKE_SYSTEM_PROCESSOR=aarch64 \
CROSS_CMAKE_CRT=gnu \
CROSS_CMAKE_OBJECT_FLAGS="-ffunction-sections -fdata-sections -fPIC"
12 changes: 10 additions & 2 deletions docker/Dockerfile.aarch64-unknown-linux-gnu.centos
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,21 @@ COPY linux-runner base-runner.sh /
COPY aarch64-linux-gnu-glibc.sh /
RUN /aarch64-linux-gnu-glibc.sh

COPY toolchain.cmake /opt/toolchain.cmake

ENV CROSS_TOOLCHAIN_PREFIX=aarch64-linux-gnu-
ENV CROSS_SYSROOT=/usr/aarch64-linux-gnu
ENV CROSS_TARGET_RUNNER="/linux-runner aarch64"
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="/linux-runner aarch64" \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="$CROSS_TARGET_RUNNER" \
AR_aarch64_unknown_linux_gnu="$CROSS_TOOLCHAIN_PREFIX"ar \
CC_aarch64_unknown_linux_gnu="$CROSS_TOOLCHAIN_PREFIX"gcc \
CXX_aarch64_unknown_linux_gnu="$CROSS_TOOLCHAIN_PREFIX"g++ \
CMAKE_TOOLCHAIN_FILE_aarch64_unknown_linux_gnu=/opt/toolchain.cmake \
BINDGEN_EXTRA_CLANG_ARGS_aarch64_unknown_linux_gnu="--sysroot=$CROSS_SYSROOT" \
QEMU_LD_PREFIX="$CROSS_SYSROOT" \
RUST_TEST_THREADS=1
RUST_TEST_THREADS=1 \
CROSS_CMAKE_SYSTEM_NAME=Linux \
CROSS_CMAKE_SYSTEM_PROCESSOR=aarch64 \
CROSS_CMAKE_CRT=gnu \
CROSS_CMAKE_OBJECT_FLAGS="-ffunction-sections -fdata-sections -fPIC"
9 changes: 8 additions & 1 deletion docker/Dockerfile.aarch64-unknown-linux-musl
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,20 @@ RUN /musl-symlink.sh $CROSS_SYSROOT aarch64

COPY musl-gcc.sh /usr/bin/"$CROSS_TOOLCHAIN_PREFIX"gcc.sh
COPY qemu-runner base-runner.sh /
COPY toolchain.cmake /opt/toolchain.cmake

ENV CROSS_TARGET_RUNNER="/qemu-runner aarch64"
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc.sh \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUNNER="/qemu-runner aarch64" \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUNNER="$CROSS_TARGET_RUNNER" \
AR_aarch64_unknown_linux_musl="$CROSS_TOOLCHAIN_PREFIX"ar \
CC_aarch64_unknown_linux_musl="$CROSS_TOOLCHAIN_PREFIX"gcc \
CXX_aarch64_unknown_linux_musl="$CROSS_TOOLCHAIN_PREFIX"g++ \
CMAKE_TOOLCHAIN_FILE_aarch64_unknown_linux_musl=/opt/toolchain.cmake \
BINDGEN_EXTRA_CLANG_ARGS_aarch64_unknown_linux_musl="--sysroot=$CROSS_SYSROOT" \
QEMU_LD_PREFIX="$CROSS_SYSROOT" \
RUST_TEST_THREADS=1 \
CROSS_CMAKE_SYSTEM_NAME=Linux \
CROSS_CMAKE_SYSTEM_PROCESSOR=aarch64 \
CROSS_CMAKE_CRT=musl \
CROSS_CMAKE_OBJECT_FLAGS="-ffunction-sections -fdata-sections -fPIC" \
CROSS_BUILTINS_PATCHED_MINOR_VERSION=48
12 changes: 10 additions & 2 deletions docker/Dockerfile.arm-linux-androideabi
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,18 @@ RUN /android-system.sh arm

ENV CROSS_TOOLCHAIN_PREFIX=arm-linux-androideabi-
ENV CROSS_SYSROOT=/android-ndk/sysroot
ENV CROSS_ANDROID_SDK=$ANDROID_SDK
COPY android-symlink.sh /
RUN /android-symlink.sh arm arm-linux-androideabi

COPY android-runner /
COPY android.cmake /opt/toolchain.cmake

# Libz is distributed in the android ndk, but for some unknown reason it is not
# found in the build process of some crates, so we explicit set the DEP_Z_ROOT
ENV CROSS_TARGET_RUNNER="/android-runner arm"
ENV CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER="/android-runner arm" \
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER="$CROSS_TARGET_RUNNER" \
AR_arm_linux_androideabi="$CROSS_TOOLCHAIN_PREFIX"ar \
AS_arm_linux_androideabi="$CROSS_TOOLCHAIN_PREFIX"as \
CC_arm_linux_androideabi="$CROSS_TOOLCHAIN_PREFIX"gcc \
Expand All @@ -56,11 +59,16 @@ ENV CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \
SIZE_arm_linux_androideabi="$CROSS_TOOLCHAIN_PREFIX"size \
STRINGS_arm_linux_androideabi="$CROSS_TOOLCHAIN_PREFIX"strings \
STRIP_arm_linux_androideabi="$CROSS_TOOLCHAIN_PREFIX"strip \
CMAKE_TOOLCHAIN_FILE_arm_linux_androideabi=/opt/toolchain.cmake \
BINDGEN_EXTRA_CLANG_ARGS_arm_linux_androideabi="--sysroot=$CROSS_SYSROOT" \
DEP_Z_INCLUDE="$CROSS_SYSROOT/usr/include/" \
RUST_TEST_THREADS=1 \
HOME=/tmp/ \
TMPDIR=/tmp/ \
ANDROID_DATA=/ \
ANDROID_DNS_MODE=local \
ANDROID_ROOT=/system
ANDROID_ROOT=/system \
CROSS_CMAKE_SYSTEM_NAME=Android \
CROSS_CMAKE_SYSTEM_PROCESSOR=armv5te \
CROSS_CMAKE_CRT=android \
CROSS_CMAKE_OBJECT_FLAGS="--target=arm-linux-androideabi -DANDROID -ffunction-sections -fdata-sections -fPIC --target=arm-linux-androideabi"
11 changes: 9 additions & 2 deletions docker/Dockerfile.arm-unknown-linux-gnueabi
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,22 @@ COPY qemu.sh /
RUN /qemu.sh arm

COPY qemu-runner base-runner.sh /
COPY toolchain.cmake /opt/toolchain.cmake

ENV CROSS_TOOLCHAIN_PREFIX=arm-linux-gnueabi-
ENV CROSS_SYSROOT=/usr/arm-linux-gnueabi
ENV CROSS_TARGET_RUNNER="/qemu-runner arm"
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_RUNNER="/qemu-runner arm" \
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_RUNNER="$CROSS_TARGET_RUNNER" \
AR_arm_unknown_linux_gnueabi="$CROSS_TOOLCHAIN_PREFIX"ar \
CC_arm_unknown_linux_gnueabi="$CROSS_TOOLCHAIN_PREFIX"gcc \
CXX_arm_unknown_linux_gnueabi="$CROSS_TOOLCHAIN_PREFIX"g++ \
CMAKE_TOOLCHAIN_FILE_arm_unknown_linux_gnueabi=/opt/toolchain.cmake \
BINDGEN_EXTRA_CLANG_ARGS_arm_unknown_linux_gnueabi="--sysroot=$CROSS_SYSROOT" \
QEMU_LD_PREFIX="$CROSS_SYSROOT" \
RUST_TEST_THREADS=1 \
PKG_CONFIG_PATH="/usr/lib/arm-linux-gnueabi/pkgconfig/:${PKG_CONFIG_PATH}"
PKG_CONFIG_PATH="/usr/lib/arm-linux-gnueabi/pkgconfig/:${PKG_CONFIG_PATH}" \
CROSS_CMAKE_SYSTEM_NAME=Linux \
CROSS_CMAKE_SYSTEM_PROCESSOR=arm \
CROSS_CMAKE_CRT=gnu \
CROSS_CMAKE_OBJECT_FLAGS="-ffunction-sections -fdata-sections -fPIC -march=armv6 -marm -mfloat-abi=soft"
11 changes: 9 additions & 2 deletions docker/Dockerfile.arm-unknown-linux-gnueabihf
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,21 @@ COPY qemu.sh /
RUN /qemu.sh arm

COPY qemu-runner base-runner.sh /
COPY toolchain.cmake /opt/toolchain.cmake

ENV CROSS_TOOLCHAIN_PREFIX=arm-unknown-linux-gnueabihf-
ENV CROSS_SYSROOT=/x-tools/arm-unknown-linux-gnueabihf/arm-unknown-linux-gnueabihf/sysroot/
ENV CROSS_TARGET_RUNNER="/qemu-runner armhf"
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER="/qemu-runner armhf" \
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER="$CROSS_TARGET_RUNNER" \
AR_arm_unknown_linux_gnueabihf="$CROSS_TOOLCHAIN_PREFIX"ar \
CC_arm_unknown_linux_gnueabihf="$CROSS_TOOLCHAIN_PREFIX"gcc \
CXX_arm_unknown_linux_gnueabihf="$CROSS_TOOLCHAIN_PREFIX"g++ \
CMAKE_TOOLCHAIN_FILE_arm_unknown_linux_gnueabihf=/opt/toolchain.cmake \
BINDGEN_EXTRA_CLANG_ARGS_arm_unknown_linux_gnueabihf="--sysroot=$CROSS_SYSROOT" \
QEMU_LD_PREFIX="$CROSS_SYSROOT" \
RUST_TEST_THREADS=1
RUST_TEST_THREADS=1 \
CROSS_CMAKE_SYSTEM_NAME=Linux \
CROSS_CMAKE_SYSTEM_PROCESSOR=arm \
CROSS_CMAKE_CRT=gnu \
CROSS_CMAKE_OBJECT_FLAGS="-ffunction-sections -fdata-sections -fPIC -march=armv6 -marm -mfpu=vfp"
11 changes: 9 additions & 2 deletions docker/Dockerfile.arm-unknown-linux-musleabi
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,19 @@ COPY musl-symlink.sh /
RUN /musl-symlink.sh $CROSS_SYSROOT arm

COPY qemu-runner base-runner.sh /
COPY toolchain.cmake /opt/toolchain.cmake

ENV CROSS_TARGET_RUNNER="/qemu-runner arm"
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_MUSLEABI_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \
CARGO_TARGET_ARM_UNKNOWN_LINUX_MUSLEABI_RUNNER="/qemu-runner arm" \
CARGO_TARGET_ARM_UNKNOWN_LINUX_MUSLEABI_RUNNER="$CROSS_TARGET_RUNNER" \
AR_arm_unknown_linux_musleabi="$CROSS_TOOLCHAIN_PREFIX"ar \
CC_arm_unknown_linux_musleabi="$CROSS_TOOLCHAIN_PREFIX"gcc \
CXX_arm_unknown_linux_musleabi="$CROSS_TOOLCHAIN_PREFIX"g++ \
CMAKE_TOOLCHAIN_FILE_arm_unknown_linux_musleabi=/opt/toolchain.cmake \
BINDGEN_EXTRA_CLANG_ARGS_arm_unknown_linux_musleabi="--sysroot=$CROSS_SYSROOT" \
QEMU_LD_PREFIX="$CROSS_SYSROOT" \
RUST_TEST_THREADS=1
RUST_TEST_THREADS=1 \
CROSS_CMAKE_SYSTEM_NAME=Linux \
CROSS_CMAKE_SYSTEM_PROCESSOR=arm \
CROSS_CMAKE_CRT=musl \
CROSS_CMAKE_OBJECT_FLAGS="-ffunction-sections -fdata-sections -fPIC -march=armv6 -marm -mfloat-abi=soft"
11 changes: 9 additions & 2 deletions docker/Dockerfile.arm-unknown-linux-musleabihf
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,19 @@ COPY musl-symlink.sh /
RUN /musl-symlink.sh $CROSS_SYSROOT armhf

COPY qemu-runner base-runner.sh /
COPY toolchain.cmake /opt/toolchain.cmake

ENV CROSS_TARGET_RUNNER="/qemu-runner armhf"
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_MUSLEABIHF_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \
CARGO_TARGET_ARM_UNKNOWN_LINUX_MUSLEABIHF_RUNNER="/qemu-runner armhf" \
CARGO_TARGET_ARM_UNKNOWN_LINUX_MUSLEABIHF_RUNNER="$CROSS_TARGET_RUNNER" \
AR_arm_unknown_linux_musleabihf="$CROSS_TOOLCHAIN_PREFIX"ar \
CC_arm_unknown_linux_musleabihf="$CROSS_TOOLCHAIN_PREFIX"gcc \
CXX_arm_unknown_linux_musleabihf="$CROSS_TOOLCHAIN_PREFIX"g++ \
CMAKE_TOOLCHAIN_FILE_arm_unknown_linux_musleabihf=/opt/toolchain.cmake \
BINDGEN_EXTRA_CLANG_ARGS_arm_unknown_linux_musleabihf="--sysroot=$CROSS_SYSROOT" \
QEMU_LD_PREFIX="$CROSS_SYSROOT" \
RUST_TEST_THREADS=1
RUST_TEST_THREADS=1 \
CROSS_CMAKE_SYSTEM_NAME=Linux \
CROSS_CMAKE_SYSTEM_PROCESSOR=arm \
CROSS_CMAKE_CRT=musl \
CROSS_CMAKE_OBJECT_FLAGS="-ffunction-sections -fdata-sections -fPIC -march=armv6 -marm -mfpu=vfp"
11 changes: 9 additions & 2 deletions docker/Dockerfile.armv5te-unknown-linux-gnueabi
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,22 @@ COPY qemu.sh /
RUN /qemu.sh arm

COPY qemu-runner base-runner.sh /
COPY toolchain.cmake /opt/toolchain.cmake

ENV CROSS_TOOLCHAIN_PREFIX=arm-linux-gnueabi-
ENV CROSS_SYSROOT=/usr/arm-linux-gnueabi
ENV CROSS_TARGET_RUNNER="/qemu-runner arm"
ENV CARGO_TARGET_ARMV5TE_UNKNOWN_LINUX_GNUEABI_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \
CARGO_TARGET_ARMV5TE_UNKNOWN_LINUX_GNUEABI_RUNNER="/qemu-runner arm" \
CARGO_TARGET_ARMV5TE_UNKNOWN_LINUX_GNUEABI_RUNNER="$CROSS_TARGET_RUNNER" \
AR_armv5te_unknown_linux_gnueabi="$CROSS_TOOLCHAIN_PREFIX"ar \
CC_armv5te_unknown_linux_gnueabi="$CROSS_TOOLCHAIN_PREFIX"gcc \
CXX_armv5te_unknown_linux_gnueabi="$CROSS_TOOLCHAIN_PREFIX"g++ \
CMAKE_TOOLCHAIN_FILE_armv5te_unknown_linux_gnueabi=/opt/toolchain.cmake \
BINDGEN_EXTRA_CLANG_ARGS_armv5te_unknown_linux_gnueabi="--sysroot=$CROSS_SYSROOT" \
QEMU_LD_PREFIX="$CROSS_SYSROOT" \
RUST_TEST_THREADS=1 \
PKG_CONFIG_PATH="/usr/lib/arm-linux-gnueabi/pkgconfig/:${PKG_CONFIG_PATH}"
PKG_CONFIG_PATH="/usr/lib/arm-linux-gnueabi/pkgconfig/:${PKG_CONFIG_PATH}" \
CROSS_CMAKE_SYSTEM_NAME=Linux \
CROSS_CMAKE_SYSTEM_PROCESSOR=arm \
CROSS_CMAKE_CRT=gnu \
CROSS_CMAKE_OBJECT_FLAGS="-ffunction-sections -fdata-sections -fPIC -march=armv5te -marm -mfloat-abi=soft"
Loading