From a14f940d3004a7d32d9ea267ae171d25bcd16fce Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Thu, 13 May 2021 00:33:30 -0400 Subject: [PATCH] Try working on cross compiling --- Cargo.toml | 12 ++++++++++++ build.earth | 7 +++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d5aec47..8c24899 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,6 +15,18 @@ termion = "1.5" serde = {version = "1.0", features = ["derive"]} confy = "0.4.0" +#[target.arm-linux-linux-muxl] +#linker = "arm-linux-unknown-gcc" + +[target.aarch64-linux-musl] +linker = "aarch64-linux-gnu-gcc" + +[target.aarch64-unknown-linux-musl] +linker = "aarch64-linux-gnu-gcc" + +[target.aarch64-unknown-linux-gcc] +linker = "aarch64-linux-gnu-gcc" + # TODO: cross compilation # [target.arm-unknown-linux-gnueabihf] # linker = "arm-linux-gnueabihf-gcc" diff --git a/build.earth b/build.earth index 0dee76d..65139eb 100644 --- a/build.earth +++ b/build.earth @@ -2,7 +2,7 @@ FROM rust:latest ENV CARGO_HOME=/deps WORKDIR /work RUN apt-get update -RUN apt-get install -y gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu +RUN apt-get install -y gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu gdb-mingw-w64 gcc-mingw-w64-x86-64 deps: COPY ./Cargo.toml ./Cargo.lock . @@ -20,11 +20,14 @@ build: COPY ./src/ ./src/ RUN cargo build --release --target "$TOOLCHAIN" RUN strip "target/$TOOLCHAIN/release/rpn_rs" - SAVE ARTIFACT target/$TOOLCHAIN/release/rpn_rs AS LOCAL target/$TOOLCHAIN/release/rpn_rs + RUN xz --keep "target/$TOOLCHAIN/release/rpn_rs" + SAVE ARTIFACT target/$TOOLCHAIN/release/rpn_rs AS LOCAL target/$TOOLCHAIN/release/rpn_rs-$TOOLCHAIN + SAVE ARTIFACT target/$TOOLCHAIN/release/rpn_rs.xz AS LOCAL target/$TOOLCHAIN/release/rpn_rs-$TOOLCHAIN.xz all: BUILD --build-arg TOOLCHAIN=x86_64-unknown-linux-musl +build BUILD --build-arg TOOLCHAIN=i686-unknown-linux-musl +build + # BUILD --build-arg TOOLCHAIN=x86_64-pc-windows-gnu +build # TODO: Cross compile # BUILD --build-arg TOOLCHAIN=aarch64-unknown-linux-musl +build # BUILD --build-arg TOOLCHAIN=arm-unknown-linux-musleabi +build