Code Monkey home page Code Monkey logo

muslrust's Introduction

muslrust

nightly stable docker pulls

A docker environment for building static rust binaries for x86_64 and arm64 linux environments using musl. Built daily via github actions.

Binaries compiled with muslrust are light-weight, call straight into the kernel without other dynamic system library dependencies, can be shipped to most linux distributions without compatibility issues, and can be inserted as-is into lightweight docker images such as static distroless, scratch, or alpine.

The goal is to simplify the creation of small and efficient cloud containers, or stand-alone linux binary releases.

This image includes popular C libraries compiled with musl-gcc, enabling static builds even when these libraries are used.

Usage

Pull and run from a rust project root:

docker pull clux/muslrust:stable
docker run -v $PWD:/volume --rm -t clux/muslrust:stable cargo build --release

You should have a static executable in the target folder:

ldd target/x86_64-unknown-linux-musl/release/EXECUTABLE
        not a dynamic executable

Examples

The binaries and images for small apps generally end up <10MB compressed or ~20MB uncompressed without stripping.

The recommended production image is distroless static or chainguard static as these contain a non-root users + SSL certs (unlike scratch), and disallows shell access (use kubectl debug if you want this). See also kube.rs security doc on base image recommendations.

Available Tags

The standard tags are :stable or a dated :nightly-{YYYY-mm-dd}.

For pinned, or historical builds, see the available tags on dockerhub.

C Libraries

The following system libraries are compiled against musl-gcc:

We try to keep these up to date.

Developing

Clone, tweak, build, and run tests:

git clone [email protected]:clux/muslrust.git && cd muslrust
just build
just test

Tests

Before we push a new version of muslrust we test to ensure that we can use and statically link:

Caching

Local Volume Caches

Repeat builds locally are always from scratch (thus slow) without a cached cargo directory. You can set up a docker volume by just adding -v cargo-cache:/root/.cargo/registry to the docker run command.

You'll have an extra volume that you can inspect with docker volume inspect cargo-cache.

Suggested developer usage is to add the following function to your ~/.bashrc:

musl-build() {
  docker run \
    -v cargo-cache:/root/.cargo/registry \
    -v "$PWD:/volume" \
    --rm -it clux/muslrust cargo build --release
}

Then use in your project:

$ cd myproject
$ musl-build
    Finished release [optimized] target(s) in 0.0 secs

Caching on CI

On CI, you need to find a way to either store the cargo-cache referenced above, or rely on docker layer caches with layers (see cargo-chef).

Github Actions

Github actions supports both methods:

CircleCI

CircleCI supports both methods:

Troubleshooting

SSL Verification

You might need to point openssl at the location of your certificates explicitly to avoid certificate errors on https requests.

export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
export SSL_CERT_DIR=/etc/ssl/certs

These can be hardcoded in your Dockerfile, or you can rely on the openssl-probe crate to detect the cert location. You should not have to do this if you are using the static variants of distroless or chainguard.

Diesel and PQ builds

Works with the older version of libpq we bundle (see #81). See the test/dieselpgcrate for specifics.

For stuff like infer_schema! to work you need to explicitly pass on -e DATABASE_URL=$DATABASE_URL to the docker run. It's probably easier to just make diesel print-schema > src/schema.rs part of your migration setup though.

Note that diesel compiles with openssl statically since 1.34.0, so you need to include the openssl crate before diesel due to pq-sys#25:

extern crate openssl;
#[macro_use] extern crate diesel;

This is true even if you connect without sslmode=require.

Filesystem permissions on local builds

When building locally, the permissions of the musl parts of the ./target artifacts dir will be owned by root and requires sudo rm -rf target/ to clear. This is an intended complexity tradeoff with user builds.

Debugging in blank containers

If you are running a plain alpine/scratch container with your musl binary in there, then you might need to compile with debug symbols, and set the RUST_BACKTRACE=full evar to see crashes.

In alpine, if this doesn't work (or fails to give you line numbers), try installing the rust package (via apk). This should not be necessary anymore though!

For easily grabbing backtraces from rust docker apps; try adding sentry. It seems to be able to grab backtraces regardless of compile options/evars.

SELinux

On SELinux enabled systems like Fedora, you will need to configure selinux labels. E.g. adding the :Z or :z flags where appropriate: -v $PWD:/volume:Z.

Extending

Extra C libraries

If you need extra C libraries, you can follow the builder pattern approach via e.g. rfcbot-rs's Dockerfile and add extra curl -> make instructions. We are unlikely to include other C libraries herein unless they are very popular.

Extra Rustup components

You can install extra components distributed via Rustup like normal:

rustup component add clippy

Binaries distributed via Cargo

If you need to install a binary crate such as ripgrep on a CI build image, you need to build it against the GNU toolchain (see #37):

CARGO_BUILD_TARGET=x86_64-unknown-linux-gnu cargo install ripgrep

Alternatives

muslrust's People

Contributors

ajungren avatar azuremarker avatar bencord0 avatar bodymindarts avatar cbeck88 avatar clux avatar dependabot[bot] avatar eranrund avatar ja573 avatar josealban avatar runiq avatar sevagh avatar sherlock-holo avatar skuzins avatar suryapandian avatar yetanotherminion avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

muslrust's Issues

upgrade openssl to 1.1.X ?

Currently not been able to do it due to how it attempts to pull in linux headers, and the ones that musl supply appear to be insufficient. But maybe there's something we can do.

Note that this may not be necessary if hyper is successfully migrating to a native rust tls stack because we can then probably start dropping it from the images altogether as people stop using it.

People are forced to make a choice with hyper 0.10 anyway as it was pulled out of the hyper crate.

Pinning rust-nightly

Hello,

I'm using this container as a base for a Rust build container within my org. I added a little feature to support pinned/fixed nightly versions:

In my build.sh to build the container:

docker build --no-cache --build-arg NIGHTLY_SNAPSHOT="2017-06-13" -t "${name}" -f ./Dockerfile.muslrust_improved .

In the Dockerfile:

ARG NIGHTLY_SNAPSHOT=""

RUN if test "${NIGHTLY_SNAPSHOT}"; then DATEARG="--date=${NIGHTLY_SNAPSHOT}"; fi &&\
  curl https://static.rust-lang.org/rustup.sh | sh -s -- \
  --with-target=x86_64-unknown-linux-musl \
  --yes \
  --disable-sudo \
  ${DATEARG}\
  --channel=nightly &&\
  mkdir /.cargo && \
  echo "[build]\ntarget = \"x86_64-unknown-linux-musl\"" > /.cargo/config

In short, if you add the appropriate build-arg, it'll pin that nightly version with the --date flag to rustup.sh. If not, it'll proceed like normal with the latest nightly.

Is this something interesting to push upstream? If it is, let me know and I'll make a pull request.

rocket codegen stuff broken atm

Saw this briefly a few days ago, but it was fixed by bumping the version. Might have to track latest in the Cargo.toml. Will have to test later.

Log: https://travis-ci.org/clux/muslrust/builds/318013140?utm_source=email&utm_medium=notification

excerpt:

error[E0599]: no method named `unwrap` found for type `syntax::ptr::P<syntax::ast::Item>` in the current scope

  --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/pear_codegen-0.0.10/src/lib.rs:72:45

   |

72 |             let mut new_item = item.clone().unwrap();

   |                                             ^^^^^^

SSL support is not compiled (libpq)

I'm getting an error from the application with Diesel dependency that should have compiled statically with SSL

[2019-01-22T06:11:14Z ERROR r2d2] sslmode value "require" invalid when SSL support is not compiled in

I've compiled application with the following command

OPENSSL_STATIC=yes OPENSSL_LIB_DIR=/musl/lib/ OPENSSL_INCLUDE_DIR=/musl/include cargo build --release

Entire Dockerfile

## -----------------------------------------------------------------------------
## Build
## -----------------------------------------------------------------------------
FROM clux/muslrust as build-stage

WORKDIR "/build"
COPY . .
RUN OPENSSL_STATIC=yes OPENSSL_LIB_DIR=/musl/lib/ OPENSSL_INCLUDE_DIR=/musl/include cargo build --release

## -----------------------------------------------------------------------------
## Package
## -----------------------------------------------------------------------------
FROM alpine

COPY --from=build-stage "/build/target/x86_64-unknown-linux-musl/release/example" "/app/example"

WORKDIR "/app"
ENTRYPOINT ["/app/example"]

App's Cargo.toml

[dependencies]
diesel = { version = "1.3.3", features = ["postgres", "uuid", "serde_json", "r2d2"] }
openssl = "*"

[patch.crates-io]
diesel = { git = "https://github.com/diesel-rs/diesel", rev = "59aa49b" }
diesel_derives = { git = "https://github.com/diesel-rs/diesel", rev = "59aa49b" }

Embrace multi-stage?

First of all, thanks for making this project!

I took a look at the blog's Dockerfile you cite in the README file: https://github.com/clux/blog/blob/rust/Dockerfile (indeed very impressive in terms of size!).

However, if I clone your repo, I'm still relying on my local tooling to be able to build it. You're only using Dockerfile as a way to handle the last mile of the deployment story, but it still falls short in its ability to make the build process itself universal and reproducible.

What do you think about instead leveraging multi-stage builds ?

Your blog then would look something like:

FROM muslrust as build

FROM scratch
COPY --from=build /target/x86_64-unknown-linux-musl/release/blog /blog
COPY ./Rocket.toml /Rocket.toml
COPY ./posts /posts
COPY ./resources /resources
COPY ./templates /templates
ENV ROCKET_ENV production
ENTRYPOINT ["/blog"]

and then, if I clone your repo all I have to run is docker build. No reliance on the local environment's cargo, make, etc.

Great stuff!

This isn't an issue. I just wanted to say this worked very well and it saved me a ton of time with regards to messing with static openssl.

On Fedora, the user running in the container will not have access to the homedir or anything in it.

I did have to do some mucking around with users and permissions to be able to use my build dir within the container. I can post my bash script I used to wrap that if needed.

Mysql support?

Is there any intent for this image to support static mysql builds (or some branch / version)?

It seems Postgres support is more standard (or at least fleshed out) after looking into diesel static linking.
I've tried modifying golddranks to build mysql from scratch with musl but its been proving incredibly difficult.

automate the manual switchover for stable

Currently, I make a few git actions to get travis to release a new stable image, but would like to be able to step away and not miss the patch releases.

We could automate this pretty easily if there is an API to get the latest stable rust release (just the version), I just haven't found it. If anyone know it would be very helpful!

cargo:warning=couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))

Related issues: softprops/lambda-rust#53 rust-lang/backtrace-rs#86

I'm trying to cross-compile this crate for musl but so far I'm finding compile issues with all muslrust, lambdaci and lamda-rust docker images, but it does compile locally on OSX:

$ cargo build --release --target x86_64-unknown-linux-musl
    Finished dev [unoptimized + debuginfo] target(s) in 1.76s

On the other hand, here's the (failing) output with muslrust:

$ docker run -v $PWD:/volume --rm -t clux/muslrust cargo build
Unable to find image 'clux/muslrust:latest' locally
latest: Pulling from clux/muslrust
0a01a72a686c: Pull complete
cc899a5544da: Pull complete
19197c550755: Pull complete
716d454e56b6: Pull complete
cc2fa4ce2fea: Pull complete
069a6b39f1e3: Pull complete
f1ba2b4885a9: Pull complete
b54a539413d1: Pull complete
b8be703dae0a: Pull complete
1156374be0e9: Pull complete
b59035b32a9d: Pull complete
40e6f54354c2: Pull complete
48f82dcf98bc: Pull complete
Digest: sha256:97f4f4780639288dc10afabf16c3a115abb4663f3df328ae32f335081119c17c
Status: Downloaded newer image for clux/muslrust:latest
    Updating crates.io index
  Downloaded serde_json v1.0.45
  Downloaded lambda_runtime v0.2.1
  Downloaded tokio v0.1.22
  Downloaded itoa v0.4.5
(...)
  Downloaded maybe-uninit v2.0.0
  Downloaded smallvec v1.2.0
  Downloaded unicode-xid v0.1.0
   Compiling libc v0.2.66
   Compiling cfg-if v0.1.10
   Compiling semver-parser v0.7.0
(...)
   Compiling tokio-fs v0.1.6
   Compiling tokio v0.1.22
   Compiling lambda_runtime_client v0.2.2
error: failed to run custom build command for `rust-htslib v0.26.1`

Caused by:
  process didn't exit successfully: `/volume/target/debug/build/rust-htslib-def38763f3f129c9/build-script-build` (exit code: 101)
--- stdout
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-unknown-linux-musl")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-musl = None
CC_x86_64_unknown_linux_musl = None
TARGET_CC = None
CC = Some("musl-gcc")
CFLAGS_x86_64-unknown-linux-musl = None
CFLAGS_x86_64_unknown_linux_musl = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
echo '/* Default config.h generated by Makefile */' > config.h
echo '#define HAVE_LIBBZ2 1' >> config.h
echo '#define HAVE_LIBLZMA 1' >> config.h
echo '#define HAVE_LZMA_H 1' >> config.h
echo '#define HAVE_FSEEKO 1' >> config.h
echo '#define HAVE_DRAND48 1' >> config.h
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o kfunc.o kfunc.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o knetfile.o knetfile.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o kstring.o kstring.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o bcf_sr_sort.o bcf_sr_sort.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o bgzf.o bgzf.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o errmod.o errmod.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o faidx.o faidx.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o hfile.o hfile.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o hfile_net.o hfile_net.c
echo '#define HTS_VERSION "1.9"' > version.h
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o hts.o hts.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o hts_os.o hts_os.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o md5.o md5.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o multipart.o multipart.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o probaln.o probaln.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o realn.o realn.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o regidx.o regidx.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o sam.o sam.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o synced_bcf_reader.o synced_bcf_reader.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o vcf_sweep.o vcf_sweep.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o tbx.o tbx.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o textutils.o textutils.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o thread_pool.o thread_pool.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o vcf.o vcf.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o vcfutils.o vcfutils.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o cram/cram_codecs.o cram/cram_codecs.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o cram/cram_decode.o cram/cram_decode.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o cram/cram_encode.o cram/cram_encode.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o cram/cram_external.o cram/cram_external.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o cram/cram_index.o cram/cram_index.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o cram/cram_io.o cram/cram_io.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o cram/cram_samtools.o cram/cram_samtools.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o cram/cram_stats.o cram/cram_stats.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o cram/files.o cram/files.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o cram/mFILE.o cram/mFILE.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o cram/open_trace_file.o cram/open_trace_file.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o cram/pooled_alloc.o cram/pooled_alloc.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o cram/rANS_static.o cram/rANS_static.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o cram/sam_header.o cram/sam_header.c
musl-gcc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include -I /volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include -I /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api -I.  -c -o cram/string_alloc.o cram/string_alloc.c
ar -rc libhts.a kfunc.o knetfile.o kstring.o bcf_sr_sort.o bgzf.o errmod.o faidx.o hfile.o hfile_net.o hts.o hts_os.o md5.o multipart.o probaln.o realn.o regidx.o sam.o synced_bcf_reader.o vcf_sweep.o tbx.o textutils.o thread_pool.o vcf.o vcfutils.o cram/cram_codecs.o cram/cram_decode.o cram/cram_encode.o cram/cram_external.o cram/cram_index.o cram/cram_io.o cram/cram_samtools.o cram/cram_stats.o cram/files.o cram/mFILE.o cram/open_trace_file.o cram/pooled_alloc.o cram/rANS_static.o cram/sam_header.o cram/string_alloc.o
ranlib libhts.a
running: "musl-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-static" "-I" "/volume/target/x86_64-unknown-linux-musl/debug/build/libz-sys-87df8d74632487e5/out/include" "-I" "/volume/target/x86_64-unknown-linux-musl/debug/build/bzip2-sys-51abd0a51f271b1c/out/include" "-I" "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/lzma-sys-0.1.15/xz-5.2/src/liblzma/api" "-o" "/volume/target/x86_64-unknown-linux-musl/debug/build/rust-htslib-4d52c3f3da17113f/out/wrapper.o" "-c" "wrapper.c"
exit code: 0
AR_x86_64-unknown-linux-musl = None
AR_x86_64_unknown_linux_musl = None
TARGET_AR = None
AR = None
running: "ar" "crs" "/volume/target/x86_64-unknown-linux-musl/debug/build/rust-htslib-4d52c3f3da17113f/out/libwrapper.a" "/volume/target/x86_64-unknown-linux-musl/debug/build/rust-htslib-4d52c3f3da17113f/out/wrapper.o"
exit code: 0
cargo:rustc-link-lib=static=wrapper
cargo:rustc-link-search=native=/volume/target/x86_64-unknown-linux-musl/debug/build/rust-htslib-4d52c3f3da17113f/out
cargo:warning=couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
cargo:warning=set the LLVM_CONFIG_PATH environment variable to a valid `llvm-config` executable

--- stderr
thread 'main' panicked at 'Unable to find libclang: "couldn\'t find any valid shared libraries matching: [\'libclang.so\', \'libclang-*.so\', \'libclang.so.*\'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"', src/libcore/result.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed
(base) brainstorm:htslib romanvg$ pwd
/Users/romanvg/dev/umccr/htsget/serverless-aws-rust-multi-fail-native-crate/htslib

/bin/sh: apt-get: command not found

I'm seeing some weird behavior trying to execute apt-get commands against the image:

	docker run \
		-v cargo-cache:/root/.cargo/registry \
		-v "$PWD:/volume" \
		--rm \
		-it clux/muslrust \
		apt-get update && apt-get upgrade

yields:

docker run \
                -v cargo-cache:/root/.cargo/registry \
                -v "$PWD:/volume" \
                --rm \
                -it clux/muslrust \
                apt-get update && apt-get upgrade
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Get:3 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [924 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]        
Get:5 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]                
Get:6 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1558 kB]               
Get:7 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [12.7 kB]
Get:8 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [579 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [14.1 kB]        
Get:10 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [9827 kB]
Get:11 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [6119 B]
Get:12 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [176 kB]        
Get:13 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [1304 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [13.1 kB]
Get:15 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [983 kB]
Get:16 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [19.1 kB]
Get:17 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [7942 B]
Get:18 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [8807 B]
Fetched 16.0 MB in 2s (5797 kB/s)                           
Reading package lists... Done
/bin/sh: apt-get: command not found

In other words, the apt-get update command works but apt-get upgrade doesn't. Is this just a usage issue or is there something about that image that doesn't allow multiple commands?

find a better solution to caching on CI

Problem

Currently it's annoying to clean up build caches on CI systems because:

  • cargo build just keeps adding stuff to your cache directory without cleaning up unused artefacts
  • cargo clean just cleans out everything

Thus any cache that follows the approach of:

  1. Load cache
  2. Cargo build
  3. Save cache

Will cause you to maintain a technically unbounded cache, and thus, step 1 and 3 will start taking more time than 2. (Have personally seen this happen after ~100 builds of not resetting a cache on shipcat).

Thus finding out a way to ensure the cache doesn't grow and require manual purging is useful.

There's a relevant cargo meta tracking issue for cargo cache improvements.

CI Suggestions

CircleCI recommends adding dynamic suffixes to your cache keys to force cache expiry. E.g.:

  • target-{{ checksum "Cargo.lock" } (every time you make a version or add new dep)
  • target.release-{{ .Environment.CACHE_VERSION }} (whenever you want to manually bump)

But neither are really that satisfactory. Fast release cadence makes the first basically useless (blank cache constantly), and the second requires manual intervention every now and then (cache too big constantly).

TravisCI has a only a manual option to clear your cache, and normally caches last for 28 days.

Related Tools

One alternative is: cargo-sweep, but this only cleans based on date AFAIKT, which feels like just kicking the can down the road because it'll cause you to rebuild more than you need if you just haven't bumped that dependency in a while..

Another alternative is cargo-cache, but this seems to be more for general gc-ing and probably won't solve the unbounded cache problem.

Tools that would solve this could potentially be bundled inside the build image if it doesn't bloat it too much.

reduce image size by removing build dependencies

E.g. use specific install scripts rather than having everything inlined in docker images, and have them keep track of build deps and remove them after compiling in one layer.

See how cross does its musl install. Their images are about half our size, so could save space here. That said, they are also not including rust properly because they are mounting toolchains, so how much remains to be seen.

If we do want to support other targets then this kind of thing would be instrumental for reducing duplication anyway though.

Build fails

When building a project using muslrust I get:

error[E0432]: unresolved import core::ffi::c_void
--> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.44/src/unix/mod.rs:1151:17
|
1151 | pub use core::ffi::c_void;
| ^^^^^^^^^^^^^^^^^ no c_void in ffi

error: aborting due to previous error

For more information about this error, try rustc --explain E0432.
error: Could not compile libc.

I ran: sudo docker run -v cargo-cache:/home/manfred/.cargo:Z -v "$PWD:/volume:Z" --rm -it clux/muslrust cargo build --release

I have a toy project https://gitlab.com/Lotz/beginning_nom where the error happens as well.

Compilation fails with recent docker image (nightly-2019-05-06)

Docker Image: clux/nightly-2019-05-06

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-Wl,--eh-frame-hdr" "-m64" "-nostdlib" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/crt1.o" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/crti.o" "-L" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib" "/build/target/x86_64-unknown-linux-musl/release/deps/conference-ff19068a3cd34f57.conference.4kl3f4e4-cgu.0.rcgu.o" "/build/target/x86_64-unknown-linux-musl/release/deps/conference-ff19068a3cd34f57.conference.4kl3f4e4-cgu.1.rcgu.o" "/build/target/x86_64-unknown-linux-musl/release/deps/conference-ff19068a3cd34f57.conference.4kl3f4e4-cgu.10.rcgu.o" "/build/target/x86_64-unknown-linux-musl/release/deps/conference-ff19068a3cd34f57.conference.4kl3f4e4-cgu.11.rcgu.o" "/build/target/x86_64-unknown-linux-musl/release/deps/conference-ff19068a3cd34f57.conference.4kl3f4e4-cgu.12.rcgu.o" "/build/target/x86_64-unknown-linux-musl/release/deps/conference-ff19068a3cd34f57.conference.4kl3f4e4-cgu.13.rcgu.o" "/build/target/x86_64-unknown-linux-musl/release/deps/conference-ff19068a3cd34f57.conference.4kl3f4e4-cgu.14.rcgu.o" "/build/target/x86_64-unknown-linux-musl/release/deps/conference-ff19068a3cd34f57.conference.4kl3f4e4-cgu.15.rcgu.o" "/build/target/x86_64-unknown-linux-musl/release/deps/conference-ff19068a3cd34f57.conference.4kl3f4e4-cgu.2.rcgu.o" "/build/target/x86_64-unknown-linux-musl/release/deps/conference-ff19068a3cd34f57.conference.4kl3f4e4-cgu.3.rcgu.o" "/build/target/x86_64-unknown-linux-musl/release/deps/conference-ff19068a3cd34f57.conference.4kl3f4e4-cgu.4.rcgu.o" "/build/target/x86_64-unknown-linux-musl/release/deps/conference-ff19068a3cd34f57.conference.4kl3f4e4-cgu.5.rcgu.o" "/build/target/x86_64-unknown-linux-musl/release/deps/conference-ff19068a3cd34f57.conference.4kl3f4e4-cgu.6.rcgu.o" "/build/target/x86_64-unknown-linux-musl/release/deps/conference-ff19068a3cd34f57.conference.4kl3f4e4-cgu.7.rcgu.o" "/build/target/x86_64-unknown-linux-musl/release/deps/conference-ff19068a3cd34f57.conference.4kl3f4e4-cgu.8.rcgu.o" "/build/target/x86_64-unknown-linux-musl/release/deps/conference-ff19068a3cd34f57.conference.4kl3f4e4-cgu.9.rcgu.o" "-o" "/build/target/x86_64-unknown-linux-musl/release/deps/conference-ff19068a3cd34f57" "/build/target/x86_64-unknown-linux-musl/release/deps/conference-ff19068a3cd34f57.3mdsc1vl0hq45ykf.rcgu.o" "-Wl,--gc-sections" "-no-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/build/target/x86_64-unknown-linux-musl/release/deps" "-L" "/build/target/release/deps" "-L" "/musl/lib" "-L" "/build/target/x86_64-unknown-linux-musl/release/build/backtrace-sys-0186c4d2d3ace2d9/out" "-L" "/musl/lib" "-L" "/build/target/x86_64-unknown-linux-musl/release/build/ring-bb4570cc1c3145c3/out" "-L" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib" "-Wl,-Bstatic" "/build/target/x86_64-unknown-linux-musl/release/deps/libenv_logger-117245f3820705d8.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libatty-996b63d4aa86a808.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libhumantime-20d5abc57f50fc92.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libquick_error-4afb041d2b74d70f.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libtermcolor-ed096278446ab63d.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libwebrtc_sdp-533c52d5915e87b8.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libsvc_error-90f3b03ea2b6f08f.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libsvc_authz-5acfd89abfaa2bf4.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libreqwest-dcf807ca8ef656e0.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libserde_urlencoded-512c81d653faa64b.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libdtoa-93c923569db63450.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libmime_guess-ee98aee15b4e7cc5.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libphf-c3837b5587eacb7e.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libphf_shared-b8bb245f248888e5.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libunicase-6e0408565225fb12.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libsiphasher-aeb533dc9634c968.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libmime-cb42be87abbf0af7.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libunicase-d33824294a811ff9.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libflate2-875112a0b542a84d.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libminiz_oxide_c_api-ab83356a2f6a7b20.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libminiz_oxide-234b46811b6410f6.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libadler32-182e555502186904.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libcrc-36d55bab8bbdbf8b.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libcrc32fast-88154a6958426839.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libhyper_tls-70c0e58d568ad3f9.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libnative_tls-ea7a96b5be5fe0ef.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libopenssl_probe-51b1700a271baa1b.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libopenssl-4664273369b14105.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libopenssl_sys-e4f48a62c4ff3305.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libforeign_types-f600d4c7901d6537.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libforeign_types_shared-b789c5308507e334.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libhyper-e25a56b5c467dfc4.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libwant-b01cce0b74b1323e.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libtry_lock-51464a1ef6ffe784.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libhttparse-ea189e793b273754.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libh2-7b9397d5752b0cff.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libindexmap-8b9e2a213da75db9.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libstring-7acd2a26cb0a11d3.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libfutures_cpupool-a55049d6be0738ac.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libencoding_rs-4fec0f24bee3d1a5.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libcookie_store-fb3a496507a7e5c9.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libpublicsuffix-f2882306622b85fe.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/liberror_chain-d576a0c0b85f2ae8.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libtry_from-172f211b2aab763f.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libcookie-cecccf2bcfcf484b.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/liburl-09a7f32f9c8b75f4.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libpercent_encoding-9eda4f8b5d78a59d.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libidna-f75a3936c344f41f.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libunicode_normalization-5325269089d373b4.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libunicode_bidi-ad94ce9eb1986e7a.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libmatches-5f84395e8e5f93b7.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libconfig-b88c5d5b49e030cb.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libini-be4a2b45bab41dab.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libserde_hjson-e578c605b9ae8b16.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libregex-0b7cd299548f9b61.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libutf8_ranges-ebf9071beb27faf5.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libregex_syntax-828c1c2be4bdb933.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libucd_util-d15ba9b0bb68ae9e.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libthread_local-294801186a7947d3.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libaho_corasick-87ff801f7d5b2552.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libnum_traits-ce54002a5d5526c7.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/liblinked_hash_map-bd7bf3e8caa7e616.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libserde-473ca9ff6471fafa.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/liblazy_static-4957258a692f1b08.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libyaml_rust-59b995a9726e2177.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/liblinked_hash_map-5930837dd22a2fda.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libtoml-b0ce04b0709f77ea.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libnom-75eb74ee924a5eda.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libsvc_agent-f06d0dccc51d6da6.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/librumqtt-454b78e5412b3765.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libbase64-562bda6a5c1518e0.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libuuid-500ffbf947b21fe4.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libtokio_rustls-d73a326d03d069e0.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/librustls-358539d4fea5b842.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libsct-30de9172c0c29f69.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libwebpki-748df3fb761be26e.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libtokio-01f99cb1be8dd455.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libtokio_trace_core-704935d24d0384f2.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libtokio_uds-a7aa83ddfbdc1feb.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libmio_uds-3c87aad5e81f7ad2.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libtokio_udp-6852696cb8098e4a.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libtokio_timer-3c1e3a840ecdd7cf.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libtokio_tcp-dd9529e35d9e951b.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libtokio_reactor-d6dd30470d5d5bdf.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libtokio_sync-bfde0325bef61e95.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libtokio_fs-c60d3dcb7bb041da.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libtokio_threadpool-fbc4bb2a37f8c22f.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libcrossbeam_queue-cbfc8560dd4dd872.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libcrossbeam_deque-24aef21575267cef.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libcrossbeam_epoch-3a177f50fdc1a46f.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libmemoffset-9f97cc4523281fdc.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libarrayvec-9204c621ab9a3de2.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libtokio_current_thread-deb736ea6bfc7a1a.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libtokio_executor-6a10715d342ff6a9.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libtokio_codec-c63cfee7707bfdbf.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libtokio_io-2bd279d1582eb27a.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libmio-fe4ac0452708f2de.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libnet2-1f566293e7c748b6.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/liblazycell-da8812c8a384c9ef.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libmqtt311-569d3989e696e672.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libfutures-61aadfbcbae33ce7.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libcrossbeam_channel-51192660cc77545f.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libcrossbeam_utils-8ae2375fde5cfa1d.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libsvc_authn-8b0d7d31c7e6d39b.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libhttp-2450b9305456a331.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libfnv-42000f99799228ab.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libbytes-377f0649682c36f0.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libjsonwebtoken-e7196af282aa627d.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libring-06fd2ac71802654c.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libuntrusted-93e20080df587087.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/liblazy_static-d7c830b40db12854.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libbase64-508fe2d7d704ff4a.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libsafemem-79f4ac838f852392.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libfailure-468e6944d846764f.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libbacktrace-fea4d334dcd87ce9.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libbacktrace_sys-b2489fb214885107.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/librustc_demangle-6063b689a0f9c615.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libfutures-9794f17504c9a904.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libfutures_executor-9e6e43a1f3b1c846.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libnum_cpus-dfc0ad869a120d87.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libfutures_util-9ee378d647c9d233.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libmemchr-a54698db0b5c668f.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libfutures_io-3871e2a53333a22a.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libiovec-ce1e1d9619cf63d4.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libslab-ebd60baaddb7ab5e.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libfutures_sink-c1aeb7067505ccc5.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libfutures_channel-6cdd86ebbb95411b.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libpin_utils-340004d3bc5e5afb.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libfutures_core-36eaabf0583682bd.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libdiesel-39d6d36cf6f75c5c.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-0c436c4be130eae8.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libuuid-41735ea7f4025b8c.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/librand-341b5ba753127e09.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libserde_json-742020d66d420081.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libryu-8dcbe203ef48ee0f.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libitoa-5e2e7f38b731ccc6.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libchrono-56bf675fe9c42223.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libserde-6e0b02640253ddbc.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libnum_integer-20f39202861f58af.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libnum_traits-c1026c315d095bfb.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libtime-2d8ee532e68dbe24.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libr2d2-19d4dd910761a940.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libscheduled_thread_pool-38f12d48f6f84feb.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libantidote-1467a88f9d6643d1.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libparking_lot-809d5a558f1ed35a.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libparking_lot_core-66e3572c39fdab4a.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libsmallvec-a03eb7af1993c866.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/librand-f39fb6f34681cdd6.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/librand_xorshift-f745a259718e4bf5.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/librand_pcg-b41a54590da5d342.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/librand_hc-b12ab7e3b389b85a.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/librand_chacha-c7d0005b98074bd7.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/librand_isaac-3db1f49f773d06fb.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/librand_core-0852f07888bf2b76.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/librand_os-f730e6070493dadf.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/liblibc-38d7dbcad489e350.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/librand_jitter-d7b8959b3b6aeb7e.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/librand_core-7a1cc33db165682d.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/liblock_api-5b352118dd11e253.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libowning_ref-57abed8185f386d0.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libstable_deref_trait-cf47fa3f3ad97930.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libscopeguard-1a32dde66f04fddc.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/liblog-c1f2e38ace4b48ef.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libcfg_if-99e46cf59aeceb96.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libbyteorder-adcc436a2d446002.rlib" "/build/target/x86_64-unknown-linux-musl/release/deps/libbitflags-bce31f8b9493fe54.rlib" "-Wl,--start-group" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b97f041663db9ba0.rlib" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libpanic_unwind-3bbd36ec226789ed.rlib" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libbacktrace_sys-58b6d1bb7208a7da.rlib" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_demangle-c0e82ab8aacc85c1.rlib" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libhashbrown-b23d5c962c8b71fe.rlib" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_alloc-1bca9b5db66260f8.rlib" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libunwind-3cca172e9cbe1134.rlib" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/liblibc-f2c5674138fdeee9.rlib" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc-9cfec2445a524697.rlib" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_core-468a98a866109deb.rlib" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libcore-c44bf46c58d2b7ae.rlib" "-Wl,--end-group" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libcompiler_builtins-4bce2943dc61177e.rlib" "-static" "-Wl,-Bdynamic" "/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/crtn.o"
  = note: /build/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-0c436c4be130eae8.rlib(fe-secure-openssl.o): In function `pgtls_init':
          fe-secure-openssl.c:(.text+0xf48): undefined reference to `OPENSSL_config'
          collect2: error: ld returned 1 exit status

not released in a while due to hyper 0.10

because i have been ambitious and tried to keep latest hyper working, and the new openssl strategy was causing some headaches for me.

technically the newly built images does work for hyper < 0.10, but due to api changes I haven't managed to update the tests successfully yet, hopefully I'll get that fixed soon.

error: could not find `Cargo.toml` in `/volume` or any parent directory

I'm not sure if the problem is between keyboard and chair.

Here is what I did:

cargo new --bin statictest
cd statictest
docker pull clux/muslrust
docker run -v $PWD:/volume -t clux/muslrust cargo build

The last command gives me:
error: could not find Cargo.toml in /volume or any parent directory

What did I miss? Thank you.

Not an issue but a question

For my command line app I need a static libmagic in order to be able to build a static binary.

Do you add additional libraries upon request? That would be great. On the other hand I understand if you think libmagic is too exotic.

Support for armv7-unknown-linux-musleabihf

Any interest in supporting more architectures than x86_64-unknown-linux-musl? I'm working on a project where I want to run a Rust program via Docker on a Raspberry Pi 3, and was looking into ways of doing that. I've been using this project for several images for a while nowโ€”it's fantastic. I figured before I fork it and badly maintain an ARM equivalent, I'd ask whether it was worth trying to support in this project proper. Thanks for your time and the wonderful project!

Release a new image for libsyntax (syntex 0.31.0) changes

There were some changes to libsyntax in nightly Rust since the last build of the muslrust image on the Docker Hub. Code generation crates (e.g. dependencies of Serde) have been updated for these changes and no longer build on the version of Rust in the latest image. Can you trigger another build for the latest nightly? Thanks!

error-chain segfault when using causes via libunwind

Program received signal SIGSEGV, Segmentation fault.
0x0000000000bff9d3 in libunwind::LocalAddressSpace::get32(unsigned long) ()
(gdb) bt
#0  0x0000000000bff9d3 in libunwind::LocalAddressSpace::get32(unsigned long) ()
#1  0x0000000000c02c80 in libunwind::CFI_Parser<libunwind::LocalAddressSpace>::findFDE(libunwind::LocalAddressSpace&, unsigned long, unsigned long, unsigned int, unsigned long, libunwind::CFI_Parser<libunwind::LocalAddressSpace>::FDE_Info*, libunwind::CFI_Parser<libunwind::LocalAddressSpace>::CIE_Info*) ()
#2  0x0000000000c02417 in libunwind::UnwindCursor<libunwind::LocalAddressSpace, libunwind::Registers_x86_64>::getInfoFromDwarfSection(unsigned long, libunwind::UnwindInfoSections const&, unsigned int) ()
#3  0x0000000000c01e17 in libunwind::UnwindCursor<libunwind::LocalAddressSpace, libunwind::Registers_x86_64>::setInfoBasedOnIPRegister(bool) ()
#4  0x0000000000c01bd9 in libunwind::UnwindCursor<libunwind::LocalAddressSpace, libunwind::Registers_x86_64>::step() ()
#5  0x0000000000c00d6d in unw_step ()
#6  0x0000000000bfefff in _Unwind_Backtrace ()
#7  0x0000000000b5684d in backtrace::backtrace::libunwind::trace::hd633fbf58699793f (cb=...)
    at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.9/src/backtrace/libunwind.rs:53
#8  backtrace::backtrace::trace::hf547bd4c20bd8958 (cb=...) at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.9/src/backtrace/mod.rs:42
#9  0x0000000000b55803 in backtrace::capture::Backtrace::new_unresolved::hb79408d21b35173a () at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.9/src/capture.rs:88
#10 backtrace::capture::Backtrace::new::ha127780e86ae8348 () at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.9/src/capture.rs:63
#11 _$LT$backtrace..capture..Backtrace$u20$as$u20$core..default..Default$GT$::default::hc59e5c652a626061 ()
    at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.9/src/capture.rs:235
#12 0x0000000000b55879 in backtrace::capture::Backtrace::new::ha127780e86ae8348 ()
#13 0x000000000070bf1d in error_chain::make_backtrace::h3de17587d40dd8d9 () at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/error-chain-0.11.0/src/lib.rs:616
#14 0x000000000070bfa5 in _$LT$error_chain..State$u20$as$u20$core..default..Default$GT$::default::h83acd38a3fbdd55d ()
    at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/error-chain-0.11.0/src/lib.rs:710
#15 0x000000000053842f in myapp::Error::from_kind::hf7853880c89cea62 (kind=...) at <impl_error_chain_processed macros>:53
#16 _$LT$myapp..Error$u20$as$u20$core..convert..From$LT$alloc..string..String$GT$$GT$::from::h4fbf2a56c4646783 (s=...) at <impl_error_chain_processed macros>:102
#17 _$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$::into::h583c99ca38db9c0f (self=...) at /checkout/src/libcore/convert.rs:396
#21 0x000000000040860b in myapp::main::hf2459d8155fbc2b7 () at src/main.rs:256
#22 0x0000000000401043 in std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::h8404db9011a8df06 () at /checkout/src/libstd/rt.rs:74
#23 0x0000000000bee4d3 in std::rt::lang_start_internal::_$u7b$$u7b$closure$u7d$$u7d$::hb94c47f3eedfaa55 () at libstd/rt.rs:59
#24 std::panicking::try::do_call::h9a1cf6ef7a2bbed3 () at libstd/panicking.rs:310
#25 0x0000000000bfd3fa in __rust_maybe_catch_panic () at libpanic_unwind/lib.rs:105
#26 0x0000000000be0e2e in std::panicking::try::hb22e57d7731fdf53 () at libstd/panicking.rs:289
#27 std::panic::catch_unwind::h813102482f9fd064 () at libstd/panic.rs:392
#28 std::rt::lang_start_internal::h45c8433e0c8ada66 () at libstd/rt.rs:58

Noticed on old kernels (CircleCI host) only, works fine on local machine using the musl compiled executable, but on ubuntu 14.04 in circle, non-trivial chain_err iteration cause segfaults.

Upstream issue: rust-lang/rust#47551

Push 1.43 stable image tag on dockerhub

Heyo, thank you for the awesome dockerimage! I use it for all of my hosted rust applications.

Could you please build and push the stable 1.43.0 image when you get a chance?

Thanks!

make[1]: execvp: musl-ar: Permission denied

Great project @clux!

I'm getting the following with :latest on dockerhub:

(...)
musl-ar r apps/libapps.a apps/app_rand.o apps/apps.o apps/bf_prefix.o apps/opt.o apps/s_cb.o apps/s_socket.o
Makefile:677: recipe for target 'apps/libapps.a' failed
make[1]: Leaving directory '/target/debug/build/openssl-sys-c075376a27079383/out/openssl-build/build/src'
Makefile:177: recipe for target 'build_libs' failed

--- stderr
make[1]: execvp: musl-ar: Permission denied
make[1]: *** [apps/libapps.a] Error 127
make[1]: *** Waiting for unfinished jobs....
make: *** [build_libs] Error 2
thread 'main' panicked at '


Error building OpenSSL:
    Command: "make" "build_libs"
    Exit status: exit code: 2


    ', /cargo/registry/src/github.com-1ecc6299db9ec823/openssl-src-111.6.1+1.1.1d/src/lib.rs:365:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

warning: build failed, waiting for other jobs to finish...

rocket failures

Tailing "*" for a nightly module may be a bad idea. Source breakage here; rwf2/Rocket#513

Not sure if I should take out rocket or not or just wait a bit and see. Rocket is one of the key things I like to build with this, nice to have a guarantee if it's feasible.

Beta Image

I was surprised to find you aren't publishing images for beta. I understand it is probably less used but it would have been useful in my particular case.

remove curl?

This can be removed as it is bundled and compiled inline (in a very similar way to how we compile curl) in the curl-rust crate and usage of cross also suggests that we don't need it. That may be better than maintaining it here and bumping deps ourselves?

On the other hand, curl-rust does not really upgrade their deps very fast, as the source of their curl is a 6month old fork used as a submodule so I am tempted to not mess with it.

That said, everyone's pretty much using the hyper client instead of curl anyway.

linking now fails with unwind failures

Latest cron build failed with a missing -lunwind

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-nostdlib" "-Wl,--eh-frame-hdr" "-Wl,-(" "-m64" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/crt1.o" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/crti.o" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib" "/volume/target/x86_64-unknown-linux-musl/debug/deps/plaincrate-54d1030939d14f9b.0.o" "-o" "/volume/target/x86_64-unknown-linux-musl/debug/deps/plaincrate-54d1030939d14f9b" "/volume/target/x86_64-unknown-linux-musl/debug/deps/plaincrate-54d1030939d14f9b.crate.allocator.o" "-Wl,--gc-sections" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "-L" "/volume/target/x86_64-unknown-linux-musl/debug/deps" "-L" "/volume/target/debug/deps" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib" "-Wl,-Bstatic" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc_jemalloc-ab5831f4fba53ade.rlib" "/volume/target/x86_64-unknown-linux-musl/debug/deps/librand-caa253f168104b0f.rlib" "/volume/target/x86_64-unknown-linux-musl/debug/deps/liblibc-2322a01ee5fd0496.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-1873b4d191d228e8.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libpanic_unwind-fa52c59d2108c1f8.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libunwind-45a286e82269a40e.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc_system-1c88582d9022c1cc.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/liblibc-d9d4ae8ab67a6001.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc-d1d3fb714ff1a835.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd_unicode-10859fb08aa219d9.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/librand-655f47aee8a3420b.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libcore-da02dfafc4660314.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libcompiler_builtins-126bb39b1b53af10.rlib" "-l" "unwind" "-static" "-Wl,-Bdynamic" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/crtn.o" "-Wl,-)"
  = note: /usr/bin/ld: cannot find -lunwind
          collect2: error: ld returned 1 exit status

Apparently that's needed now. Tried making a new image and add an apt-get install libunwind-dev, but that shifts the error to the more confusing:

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-nostdlib" "-Wl,--eh-frame-hdr" "-Wl,-(" "-m64" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/crt1.o" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/crti.o" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib" "/volume/target/x86_64-unknown-linux-musl/debug/deps/plaincrate-54d1030939d14f9b.0.o" "-o" "/volume/target/x86_64-unknown-linux-musl/debug/deps/plaincrate-54d1030939d14f9b" "/volume/target/x86_64-unknown-linux-musl/debug/deps/plaincrate-54d1030939d14f9b.crate.allocator.o" "-Wl,--gc-sections" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "-L" "/volume/target/x86_64-unknown-linux-musl/debug/deps" "-L" "/volume/target/debug/deps" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib" "-Wl,-Bstatic" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc_jemalloc-ab5831f4fba53ade.rlib" "/volume/target/x86_64-unknown-linux-musl/debug/deps/librand-caa253f168104b0f.rlib" "/volume/target/x86_64-unknown-linux-musl/debug/deps/liblibc-2322a01ee5fd0496.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-1873b4d191d228e8.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libpanic_unwind-fa52c59d2108c1f8.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libunwind-45a286e82269a40e.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc_system-1c88582d9022c1cc.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/liblibc-d9d4ae8ab67a6001.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc-d1d3fb714ff1a835.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd_unicode-10859fb08aa219d9.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/librand-655f47aee8a3420b.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libcore-da02dfafc4660314.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libcompiler_builtins-126bb39b1b53af10.rlib" "-l" "unwind" "-static" "-Wl,-Bdynamic" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/crtn.o" "-Wl,-)"
  = note: /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libunwind.a(elf64.o): In function `xz_uncompressed_size':
          /build/libunwind-VOtC4T/libunwind-1.1/src/elfxx.c:194: undefined reference to `lzma_stream_footer_decode'
          /build/libunwind-VOtC4T/libunwind-1.1/src/elfxx.c:201: undefined reference to `lzma_index_buffer_decode'
          /build/libunwind-VOtC4T/libunwind-1.1/src/elfxx.c:205: undefined reference to `lzma_index_size'
          /build/libunwind-VOtC4T/libunwind-1.1/src/elfxx.c:210: undefined reference to `lzma_index_end'
          /build/libunwind-VOtC4T/libunwind-1.1/src/elfxx.c:207: undefined reference to `lzma_index_uncompressed_size'
          /build/libunwind-VOtC4T/libunwind-1.1/src/elfxx.c:210: undefined reference to `lzma_index_end'
          /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libunwind.a(elf64.o): In function `_Uelf64_extract_minidebuginfo':
          /build/libunwind-VOtC4T/libunwind-1.1/src/elfxx.c:278: undefined reference to `lzma_stream_buffer_decode'
          collect2: error: ld returned 1 exit status
          

error: aborting due to previous error

This is also on the plain crate which doesn't use lzma. Probably need to compile libunwind with musl?

'none' tag for project with 'rust-toolchain' file

There are some project put rust-toolchain file in root directory, for example: nightly-2019-05-22.

With those project, no matter which tag I choose, I have to info: syncing channel updates for 'nightly-2019-05-22-x86_64-unknown-linux-gnu' when I build the docker image, even I chosed clux/muslrust:nightly-2019-05-22(because this image installed nightly channel toolchain rather than nightly-2019-05-22).

If I have to download toolchain, maybe image without pre-installed toolchain is better?

The way to install rustup without pre-installed toolchain is:

curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none

unrecognized relocation cargo build failures with latest nightlies

from the travis logs:

docker run -v /home/travis/build/clux/muslrust/test/plaincrate:/volume -w /volume -t clux/muslrust cargo build --verbose
    Updating registry `https://github.com/rust-lang/crates.io-index`
 Downloading rand v0.3.14
 Downloading libc v0.2.14
   Compiling libc v0.2.14
     Running `rustc /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.14/src/lib.rs --crate-name libc --crate-type lib -g --cfg feature=\"default\" --cfg feature=\"use_std\" -C metadata=1f3392fe1afd1313 -C extra-filename=-1f3392fe1afd1313 --out-dir /volume/target/x86_64-unknown-linux-musl/debug/deps --emit=dep-info,link --target x86_64-unknown-linux-musl -L dependency=/volume/target/x86_64-unknown-linux-musl/debug/deps --cap-lints allow`
   Compiling rand v0.3.14
     Running `rustc /root/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.3.14/src/lib.rs --crate-name rand --crate-type lib -g -C metadata=49a08859d086fffe -C extra-filename=-49a08859d086fffe --out-dir /volume/target/x86_64-unknown-linux-musl/debug/deps --emit=dep-info,link --target x86_64-unknown-linux-musl -L dependency=/volume/target/x86_64-unknown-linux-musl/debug/deps --extern libc=/volume/target/x86_64-unknown-linux-musl/debug/deps/liblibc-1f3392fe1afd1313.rlib --cap-lints allow`
   Compiling plaincrate v0.1.0 (file:///volume)
     Running `rustc src/main.rs --crate-name plaincrate --crate-type bin -g -C metadata=0ac13fd092ed66e9 --out-dir /volume/target/x86_64-unknown-linux-musl/debug --emit=dep-info,link --target x86_64-unknown-linux-musl -L dependency=/volume/target/x86_64-unknown-linux-musl/debug/deps --extern rand=/volume/target/x86_64-unknown-linux-musl/debug/deps/librand-49a08859d086fffe.rlib`
error: linking with `cc` failed: exit code: 1 
note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-nostdlib" "-static" "-Wl,--eh-frame-hdr" "-Wl,-(" "-m64" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/crt1.o" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/crti.o" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib" "/volume/target/x86_64-unknown-linux-musl/debug/plaincrate.0.o" "-o" "/volume/target/x86_64-unknown-linux-musl/debug/plaincrate" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "/volume/target/x86_64-unknown-linux-musl/debug/deps" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/volume/target/x86_64-unknown-linux-musl/debug/deps/librand-49a08859d086fffe.rlib" "/volume/target/x86_64-unknown-linux-musl/debug/deps/liblibc-1f3392fe1afd1313.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-c8005792.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libpanic_unwind-c8005792.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libunwind-c8005792.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/librand-c8005792.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libcollections-c8005792.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_unicode-c8005792.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc-c8005792.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc_jemalloc-c8005792.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/liblibc-c8005792.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libcore-c8005792.rlib" "-l" "compiler-rt" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/crtn.o" "-Wl,-)" 
note: /usr/bin/ld: /usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc_jemalloc-c8005792.rlib(jemalloc.pic.o): unrecognized relocation (0x2a) in section `.text.malloc_conf_init'
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status

and

docker run -v /home/travis/build/clux/muslrust/test/plaincrate:/volume -w /volume -t clux/muslrust cargo build --verbose
    Updating registry `https://github.com/rust-lang/crates.io-index`
 Downloading rand v0.3.14
 Downloading libc v0.2.15
   Compiling libc v0.2.15
     Running `rustc /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.15/src/lib.rs --crate-name libc --crate-type lib -g --cfg feature=\"use_std\" --cfg feature=\"default\" -C metadata=1bd8847afb79f283 -C extra-filename=-1bd8847afb79f283 --out-dir /volume/target/x86_64-unknown-linux-musl/debug/deps --emit=dep-info,link --target x86_64-unknown-linux-musl -L dependency=/volume/target/x86_64-unknown-linux-musl/debug/deps --cap-lints allow`
   Compiling rand v0.3.14
     Running `rustc /root/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.3.14/src/lib.rs --crate-name rand --crate-type lib -g -C metadata=49a08859d086fffe -C extra-filename=-49a08859d086fffe --out-dir /volume/target/x86_64-unknown-linux-musl/debug/deps --emit=dep-info,link --target x86_64-unknown-linux-musl -L dependency=/volume/target/x86_64-unknown-linux-musl/debug/deps --extern libc=/volume/target/x86_64-unknown-linux-musl/debug/deps/liblibc-1bd8847afb79f283.rlib --cap-lints allow`
   Compiling plaincrate v0.1.0 (file:///volume)
     Running `rustc src/main.rs --crate-name plaincrate --crate-type bin -g -C metadata=0ac13fd092ed66e9 --out-dir /volume/target/x86_64-unknown-linux-musl/debug --emit=dep-info,link --target x86_64-unknown-linux-musl -L dependency=/volume/target/x86_64-unknown-linux-musl/debug/deps --extern rand=/volume/target/x86_64-unknown-linux-musl/debug/deps/librand-49a08859d086fffe.rlib`
error: linking with `cc` failed: exit code: 1 
note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-nostdlib" "-static" "-Wl,--eh-frame-hdr" "-Wl,-(" "-m64" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/crt1.o" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/crti.o" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib" "/volume/target/x86_64-unknown-linux-musl/debug/plaincrate.0.o" "-o" "/volume/target/x86_64-unknown-linux-musl/debug/plaincrate" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "/volume/target/x86_64-unknown-linux-musl/debug/deps" "-L" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/volume/target/x86_64-unknown-linux-musl/debug/deps/librand-49a08859d086fffe.rlib" "/volume/target/x86_64-unknown-linux-musl/debug/deps/liblibc-1bd8847afb79f283.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-c8005792.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libpanic_unwind-c8005792.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libunwind-c8005792.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/librand-c8005792.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libcollections-c8005792.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_unicode-c8005792.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc-c8005792.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc_jemalloc-c8005792.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/liblibc-c8005792.rlib" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libcore-c8005792.rlib" "-l" "compiler-rt" "/usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/crtn.o" "-Wl,-)" 
note: /usr/bin/ld: /usr/local/lib/rustlib/x86_64-unknown-linux-musl/lib/libunwind-c8005792.rlib(libunwind.cpp.o): unrecognized relocation (0x2a) in section `.text._ZL10assert_rtnPKcS0_iS0_'
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status

not sure what's going on here - nothing's changed on this end.

get hyper client ssl verification working by default

Currently a bit iffy because we now require certificate validation is now enabled by default and it requires a folder with certificates set when compiling curl. See issue in hyper.

I have gotten this to work locally using CURL_VER=7.50.1 and SSL_VER=1.0.2h by compiling curl with the following modification:

RUN curl https://curl.haxx.se/download/curl-$CURL_VER.tar.gz | tar xz && \
    cd curl-$CURL_VER && \
    ./configure --enable-shared=no --enable-static=ssl --enable-optimize --prefix=$PREFIX \
      --with-ca-path=/etc/ssl/certs/ --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt --without-ca-fallback && \
    make -j$(nproc) && make install && \
    cd .. && rm -rf curl-$CURL_VER && \
   rm $PREFIX/ssl/certs -rf && ln -s /etc/ssl/certs/ $PREFIX/ssl/certs

And this totally works, but with the one massive downside that $PREFIX/ssl/certs must exist on the machine using the musl-built executable.. (i.e. /dist/ssl/certs)

There should be a way to wrangle this path so that we look in the same location on the build-machine and the running host. In general /etc/ssl/certs seems the safest bet I've come across, but even though curl gets the right ca-paths, ssl still looks inside the ssl lib dir.

undefined OPENSSL_config

Dockerfile

FROM clux/muslrust:1.41.1-stable
ADD sources.list /etc/apt/
RUN  apt purge cmake* &&  apt-get update && apt-get install cmake -y
RUN cmake --version
ENV PATH=$PREFIX/bin:$PATH:/usr/local/bin:$PATH:$HOME/bin \
    PKG_CONFIG_ALLOW_CROSS=true \
    PKG_CONFIG_ALL_STATIC=true \
    PQ_LIB_STATIC_X86_64_UNKNOWN_LINUX_MUSL=true \
    PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig \
    PG_CONFIG_X86_64_UNKNOWN_LINUX_GNU=/usr/bin/pg_config \
    OPENSSL_STATIC=true \
    OPENSSL_DIR=$PREFIX \
    SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
    SSL_CERT_DIR=/etc/ssl/certs \
    LIBZ_SYS_STATIC=1

# Allow ditching the -w /volume flag to docker run
WORKDIR /volume
RUN  mkdir -p /root/.ssh
ADD id_rsa /root/.ssh
ADD ssh_config /etc/ssh/
RUN chmod 600 /root/.ssh/id_rsa

cmd

cargo build --target x86_64-unknown-linux-musl --release

error

rustlib/x86_64-unknown-linux-musl/lib/crtn.o"
  = note: /volume/hyper-access/target/x86_64-unknown-linux-musl/release/deps/libpq_sys-6106f6dbd1f8d914.rlib(fe-secure-openssl.o): In function `pgtls_init':
          fe-secure-openssl.c:(.text+0xd51): undefined reference to `OPENSSL_config'

rustup install fails due to llvm-tools-preview

Run via:

RUN curl https://static.rust-lang.org/rustup.sh | sh -s -- \
  --with-target=x86_64-unknown-linux-musl \
  --yes \
  --disable-sudo \
  --channel=nightly && \
  mkdir /.cargo && \
  echo "[build]\ntarget = \"x86_64-unknown-linux-musl\"" > /.cargo/config

causing

rustup: extracting installer
install: creating uninstall script at /usr/local/lib/rustlib/uninstall.sh
install: installing component 'rustc'
install: installing component 'cargo'
install: installing component 'rls-preview'
install: installing component 'clippy-preview'
install: installing component 'rustfmt-preview'
install: installing component 'llvm-tools-preview'
cp: omitting directory '/root/.rustup.sh/tmp/tmp-6-13/rust-nightly-x86_64-unknown-linux-gnu/llvm-tools-preview/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-nm'
chmod: cannot access '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-nm': No such file or directory
install: error: file creation failed. see logs at '/usr/local/lib/rustlib/install.log'
rustup: command failed: sh /root/.rustup.sh/tmp/tmp-6-13/rust-nightly-x86_64-unknown-linux-gnu/install.sh --prefix=/usr/local
rustup: failed to install toolchain
The command '/bin/sh -c if test "${NIGHTLY_SNAPSHOT}"; then DATEARG="--date=${NIGHTLY_SNAPSHOT}"; fi &&  curl https://static.rust-lang.org/rustup.sh | sh -s --   --with-target=x86_64-unknown-linux-musl   --yes   --disable-sudo   ${DATEARG}   --channel=${CHANNEL} &&   mkdir /.cargo &&   echo "[build]\ntarget = \"x86_64-unknown-linux-musl\"" > /.cargo/config' returned a non-zero code: 1

might try to upgrade the setup a little.. i've been holding off on using the regular rustup.rs for a while.

CI build strategy

Currently the thing is pushed manually after I build, test it, then test some bigger things with it. This is fine for now as I want to rely on it.

But if tests were more expansive, could easily just gate a nightly push on whether the tests passed.
Docker build takes around 10 minutes anyway, so would be nicer to have travis actually do the push so there's more trust.

Once this musl support is in stable this becomes less of an issue as well.

rust-rdkafka support?

Hey, I am trying to build a microservice that has rust-rdkafka as a dependency. I tried to compile the program using clux/muslrust:stable image but couldn't make it happen. librdkafka refuses to compile even if ssl and sasl options are not used. Can you help me with this?
These are the logs

error: failed to run custom build command for `rdkafka-sys v0.11.4-0`
process didn't exit successfully: `/app/saarthi/target/release/build/rdkafka-sys-839593b2fe1624de/build-script-build` (exit code: 101)
--- stdout
Configuring librdkafka
checking for OS or distribution... ok (Linux)
checking for C compiler from CC env... ok
checking for C++ compiler from CXX env... failed
checking for C++ compiler (g++)... ok
checking executable ld... ok
checking executable nm... ok
checking executable objdump... ok
checking executable strip... ok
checking for pkgconfig (by command)... ok
checking for install (by command)... ok
checking for PIC (by compile)... ok
checking for GNU-compatible linker options... ok
checking for GNU linker-script ld flag... ok
checking for __atomic_32 (by compile)... ok
checking for __atomic_64 (by compile)... ok
checking for socket (by compile)... ok
parsing version '0x000b04ff'... ok (0.11.4)
checking for librt (by pkg-config)... failed
checking for librt (by compile)... ok
checking for libpthread (by pkg-config)... failed
checking for libpthread (by compile)... ok
checking for libdl (by pkg-config)... failed
checking for libdl (by compile)... ok
checking for zlib (by pkg-config)... ok
checking for zlib (by compile)... ok (cached)
checking for libcrypto (by pkg-config)... ok
checking for libcrypto (by compile)... ok (cached)
checking for crc32chw (by compile)... ok
checking for regex (by compile)... ok
checking for strndup (by compile)... ok
checking for strerror_r (by compile)... ok
checking for pthread_setname_gnu (by compile)... failed (disable)
checking for nm (by env NM)... ok (cached)
checking for python (by command)... failed (disable)
Generated Makefile.config
Generated config.h

Configuration summary:
  prefix                   /usr/local
  ARCH                     x86_64
  CPU                      generic
  GEN_PKG_CONFIG           y
  ENABLE_DEVEL             n
  ENABLE_VALGRIND          n
  ENABLE_REFCNT_DEBUG      n
  ENABLE_SHAREDPTR_DEBUG   n
  ENABLE_LZ4_EXT           n
  ENABLE_SSL               n
  ENABLE_SASL              n
  MKL_APP_NAME             librdkafka
  MKL_APP_DESC_ONELINE     The Apache Kafka C/C++ library
  MKL_DISTRO               Linux
  SOLIB_EXT                .so
  CC                       musl-gcc
  CXX                      g++
  LD                       ld
  NM                       nm
  OBJDUMP                  objdump
  STRIP                    strip
  CPPFLAGS                 -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align
  PKG_CONFIG               pkg-config
  INSTALL                  install
  LDFLAGS_STATIC           -Wl,-Bstatic
  LDFLAGS_DYNAMIC          -Wl,-Bdynamic
  HAS_LDFLAGS_STATIC       y
  LIB_LDFLAGS              -shared -Wl,-soname,$(LIBFILENAME)
  LDFLAG_LINKERSCRIPT      -Wl,--version-script=
  RDKAFKA_VERSION_STR      0.11.4
  MKL_APP_VERSION          0.11.4
  LIBS                     -lcrypto   -lz   -ldl -lpthread -lrt
  CFLAGS                      
  CXXFLAGS                 -Wno-non-virtual-dtor
  SYMDUMPER                $(NM) -D
  exec_prefix              /usr/local
  bindir                   /usr/local/bin
  sbindir                  /usr/local/sbin
  libexecdir               /usr/local/libexec
  datadir                  /usr/local/share
  sysconfdir               /usr/local/etc
  sharedstatedir           /usr/local/com
  localstatedir            /usr/local/var
  libdir                   /usr/local/lib
  includedir               /usr/local/include
  infodir                  /usr/local/info
  mandir                   /usr/local/man
Generated config.cache

Now type 'make' to build
Compiling librdkafka
make[1]: Entering directory '/root/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.4-0/librdkafka/src'
musl-gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka.c -o rdkafka.o
musl-gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_broker.c -o rdkafka_broker.o
musl-gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_msg.c -o rdkafka_msg.o
musl-gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_topic.c -o rdkafka_topic.o
musl-gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_conf.c -o rdkafka_conf.o
musl-gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_timer.c -o rdkafka_timer.o
musl-gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_offset.c -o rdkafka_offset.o
musl-gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_transport.c -o rdkafka_transport.o
musl-gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_buf.c -o rdkafka_buf.o
musl-gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_queue.c -o rdkafka_queue.o
musl-gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_op.c -o rdkafka_op.o
musl-gcc -MD -MP -g -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align  -c rdkafka_request.c -o rdkafka_request.o
../mklove/Makefile.base:77: recipe for target 'rdkafka_offset.o' failed
../mklove/Makefile.base:77: recipe for target 'rdkafka_transport.o' failed
../mklove/Makefile.base:77: recipe for target 'rdkafka_topic.o' failed
../mklove/Makefile.base:77: recipe for target 'rdkafka.o' failed
../mklove/Makefile.base:77: recipe for target 'rdkafka_conf.o' failed
../mklove/Makefile.base:77: recipe for target 'rdkafka_op.o' failed
../mklove/Makefile.base:77: recipe for target 'rdkafka_broker.o' failed
../mklove/Makefile.base:77: recipe for target 'rdkafka_msg.o' failed
../mklove/Makefile.base:77: recipe for target 'rdkafka_queue.o' failed
../mklove/Makefile.base:77: recipe for target 'rdkafka_buf.o' failed
../mklove/Makefile.base:77: recipe for target 'rdkafka_request.o' failed
../mklove/Makefile.base:77: recipe for target 'rdkafka_timer.o' failed
make[1]: Leaving directory '/root/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.4-0/librdkafka/src'
Makefile:20: recipe for target 'libs' failed

--- stderr
Building and linking librdkafka statically
Running command: "./configure --disable-sasl --disable-ssl --disable-lz4 --enable-static" in dir: librdkafka
disabling linker-script since python is not available
Running command: "make -j 12 libs" in dir: librdkafka
In file included from rdkafka_buf.h:32:0,
                 from rdkafka_int.h:92,
                 from rdkafka_offset.c:51:
rdcrc32.h:30:18: fatal error: zlib.h: No such file or directory
compilation terminated.
make[1]: *** [rdkafka_offset.o] Error 1
make[1]: *** Waiting for unfinished jobs....
In file included from rdkafka_buf.h:32:0,
                 from rdkafka_int.h:92,
                 from rdkafka_transport.c:36:
rdcrc32.h:30:18: fatal error: zlib.h: No such file or directory
compilation terminated.
make[1]: *** [rdkafka_transport.o] Error 1
In file included from rdkafka_buf.h:32:0,
                 from rdkafka_int.h:92,
                 from rdkafka_topic.c:30:
rdcrc32.h:30:18: fatal error: zlib.h: No such file or directory
compilation terminated.
make[1]: *** [rdkafka_topic.o] Error 1
In file included from rdkafka_buf.h:32:0,
                 from rdkafka_int.h:92,
                 from rdkafka.c:38:
rdcrc32.h:30:18: fatal error: zlib.h: No such file or directory
compilation terminated.
make[1]: *** [rdkafka.o] Error 1
In file included from rdkafka_buf.h:32:0,
                 from rdkafka_int.h:92,
                 from rdkafka_conf.c:29:
rdcrc32.h:30:18: fatal error: zlib.h: No such file or directory
compilation terminated.
make[1]: *** [rdkafka_conf.o] Error 1
In file included from rdkafka_buf.h:32:0,
                 from rdkafka_int.h:92,
                 from rdkafka_op.c:31:
rdcrc32.h:30:18: fatal error: zlib.h: No such file or directory
compilation terminated.
In file included from rdkafka_buf.h:32:0,
                 from rdkafka_int.h:92,
                 from rdkafka_broker.c:50:
rdcrc32.h:30:18: fatal error: zlib.h: No such file or directory
compilation terminated.
make[1]: *** [rdkafka_op.o] Error 1
make[1]: *** [rdkafka_broker.o] Error 1
In file included from rdkafka_buf.h:32:0,
                 from rdkafka_int.h:92,
                 from rdkafka_msg.c:30:
rdcrc32.h:30:18: fatal error: zlib.h: No such file or directory
compilation terminated.
make[1]: *** [rdkafka_msg.o] Error 1
In file included from rdkafka_buf.h:32:0,
                 from rdkafka_int.h:92,
                 from rdkafka_timer.c:29:
rdcrc32.h:30:18: fatal error: zlib.h: No such file or directory
In file included from rdkafka_buf.h:32:0,
                 from rdkafka_int.h:92,
                 from rdkafka_queue.c:29:
rdcrc32.h:30:18: fatal error: zlib.h: No such file or directory
compilation terminated.
make[1]: *** [rdkafka_queue.o] Error 1
In file included from rdkafka_buf.h:32:0,
                 from rdkafka_int.h:92,
                 from rdkafka_buf.c:29:
rdcrc32.h:30:18: fatal error: zlib.h: No such file or directory
compilation terminated.
make[1]: *** [rdkafka_buf.o] Error 1
In file included from rdkafka_buf.h:32:0,
                 from rdkafka_int.h:92,
                 from rdkafka_request.c:31:
rdcrc32.h:30:18: fatal error: zlib.h: No such file or directory
compilation terminated.
make[1]: *** [rdkafka_request.o] Error 1
compilation terminated.
make[1]: *** [rdkafka_timer.o] Error 1
make: *** [libs] Error 2
thread 'main' panicked at 'Command failed with error code 2', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/rdkafka-sys-0.11.4-0/build.rs:23:35
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed

diesel_codegen forces dynamic linkage

libpq exists now, and the pq-sys crate will compile, however, programs using diesel_codegen will not. Not quite sure what to do about it. It is apparently trying to link dynamically itself with ssl:

   Compiling webapp v0.1.0 (file:///volume)
error: /volume/target/release/deps/libdiesel_codegen-70f8d8f6e88545a4.so: undefined symbol: SSL_set_ex_data
 --> src/lib.rs:4:1
  |
4 | extern crate diesel_codegen;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: Could not compile `webapp`.

automate getting latest versions

updating deps is done manually by looking at the release pages to replace the values in:

muslrust/Dockerfile

Lines 51 to 55 in 2daafbf

ENV SSL_VER=1.0.2n \
CURL_VER=7.58.0 \
ZLIB_VER=1.2.11 \
PQ_VER=9.6.8 \
SQLITE_VER=3220000 \

official release sites:

These sites are all too annoying to deal with to automate nicely. Write a script that automates getting the latest version numbers from Arch's package manger for versions as they are pretty up to date:

Relevant arch packages:

They even have the previous major for openssl and libpq as well which is nice. Obviously, I'd like to use use latest openssl and latest postgresql-libs, but that's not necessarily without other work. See openssl issue.

Installing `clippy`

Is there any way I can install rust-src component on top of this image (which is required by clippy)?

This image doesn't include rustup (with which you can do rustup component add rust-src) and I cannot quite figure out what exactly I need to do to emulate rustup comuonent add rust-src.

Adding libpq?

Hello. I'm building a rest API which uses postgresql and Diesel. After finding this repo, I'm really excited to get a binary built with static linking so I can easily and quickly deploy it. However I'm inexperienced in the realm of compiling libraries like these from source. I wonder if this library would be worth adding, and if not, could you point me in the right direction so I can get started on a fork of your container. I do see Alpine has libpq in their package repository. Maybe the simplest way would be getting the binary from there?

The container should support running under any user

For example using

$ docker run --user $(id -u)

to get binaries on host not owned by root messes up paths and so on. I wonder if we can 777 all permissions for cargo inside of the container and set up environment variables not to depend on which users runs it. In other words, $HOME should be either fixed or not matter

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.