Skip to content

Commit

Permalink
Fix CMake Support and Enhance Newlib Targets
Browse files Browse the repository at this point in the history
Fixes CMake support for all targets, ensuring support for C11, C++11, `try_run`, and more features. To do so, we've included tests with a CMake test suite that compiles for a bare-metal target, one that compiles against [re2](https://github.com/google/re2), and one using CMake's `try_run` (checking [CMAKE_CROSSCOMPILING_EMULATOR](https://cmake.org/cmake/help/latest/variable/CMAKE_CROSSCOMPILING_EMULATOR.html) is set for any cross-compiled targets).

CMake support for Android targets was fixed by providing a toolchain file that specifies the API level and the standalone toolchain path, and ensuring that compiler detection is forcibly disabled. For other targets, a default toolchain file is provided that ensures the correct system name, processor, cross-compiling emulator, binutils, and cross-compilers are used. For bare-metal (newlib) targets, this ensures that `try_compile` uses a static library rather than an executable to avoid requiring a linker script to detect if the compiler works.

This also adds a few minor changes for newlib targets:
- Adds C++ support to bare-metal newlib targets by installing `libstdc++-arm-none-eabi-newlib`.
- Updates `targets.toml` to specify that newlib targets do not have `std` support.
- Use the Cortex-M1 CPU for `thumbv6m-none-eabi` rather than the Cortex-M3 (an ARMv7-M CPU) for the Qemu runner.
  • Loading branch information
Alexhuszagh committed Dec 4, 2022
1 parent 80a49b3 commit cfbf581
Show file tree
Hide file tree
Showing 65 changed files with 755 additions and 141 deletions.
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}"

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
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"
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 \
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

0 comments on commit cfbf581

Please sign in to comment.