Merge pull request #43 from snobu/master

Fix switch to musl target for ARM static binaries
This commit is contained in:
Eric Kidd 2018-03-26 14:14:33 -04:00 committed by GitHub
commit 0406cae896
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View File

@ -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

View File

@ -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-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.
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

View File

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