From cd173cfff50e1f0f89bcd686cdab15e25ecaf04e Mon Sep 17 00:00:00 2001 From: Adrian Calinescu Date: Mon, 26 Mar 2018 09:51:37 +0300 Subject: [PATCH 1/3] Fix switch to musl target for ARM static binaries --- Dockerfile | 2 +- cargo-config.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 32450d0..1ba2150 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,7 +52,7 @@ ENV PATH=/home/rust/.cargo/bin:/usr/local/musl/bin:/usr/local/sbin:/usr/local/bi RUN curl https://sh.rustup.rs -sSf | \ sh -s -- -y --default-toolchain $TOOLCHAIN && \ rustup target add x86_64-unknown-linux-musl && \ - rustup target add armv7-unknown-linux-gnueabihf + rustup target add armv7-unknown-linux-musleabihf ADD cargo-config.toml /home/rust/.cargo/config # Set up a `git credentials` helper for using GH_USER and GH_TOKEN to access diff --git a/cargo-config.toml b/cargo-config.toml index 6b7d5ca..6208b7b 100644 --- a/cargo-config.toml +++ b/cargo-config.toml @@ -2,5 +2,5 @@ # Target musl-libc by default when running Cargo. target = "x86_64-unknown-linux-musl" -[target.armv7-unknown-linux-gnueabihf] +[target.armv7-unknown-linux-musleabihf] linker = "arm-linux-gnueabihf-gcc-4.7" From a770dbe45ed4be488cca504c7cecd14f554f1328 Mon Sep 17 00:00:00 2001 From: snobu Date: Mon, 26 Mar 2018 12:52:56 +0300 Subject: [PATCH 2/3] Fix README for musl ARM target --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c10a111..5b9524c 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ rust-musl-builder cargo build --release To target ARM hard float (Raspberry Pi): ```sh -rust-musl-builder cargo build --target=armv7-unknown-linux-gnueabihf --release +rust-musl-builder cargo build --target=armv7-unknown-linux-musleabihf --release ``` This command assumes that `$(pwd)` is readable and writable by uid 1000, gid 1000. It will output binaries in `target/x86_64-unknown-linux-musl/release`. At the moment, it doesn't attempt to cache libraries between builds, so this is best reserved for making final release builds. From 70ba887f667ba9d528cded2f5200a627ae48c6c6 Mon Sep 17 00:00:00 2001 From: snobu Date: Mon, 26 Mar 2018 13:01:57 +0300 Subject: [PATCH 3/3] Reworded README for multi target --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5b9524c..0057cad 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,14 @@ alias rust-musl-builder='docker run --rm -it -v "$(pwd)":/home/rust/src ekidd/ru rust-musl-builder cargo build --release ``` +This command assumes that `$(pwd)` is readable and writable by uid 1000, gid 1000. At the moment, it doesn't attempt to cache libraries between builds, so this is best reserved for making final release builds. + To target ARM hard float (Raspberry Pi): ```sh -rust-musl-builder cargo build --target=armv7-unknown-linux-musleabihf --release +rust-musl-builder cargo build --target=armv7-unknown-linux-musleabihf --release ``` -This command assumes that `$(pwd)` is readable and writable by uid 1000, gid 1000. It will output binaries in `target/x86_64-unknown-linux-musl/release`. At the moment, it doesn't attempt to cache libraries between builds, so this is best reserved for making final release builds. +Binaries will be written to `target/$TARGET_ARCHITECTURE/release`. By default it targets `x86_64-unknown-linux-musl` unless specified with `--target`. ## Deploying your Rust application