From b54783917c310312a39d4a7e384a5fcafa1bc3c6 Mon Sep 17 00:00:00 2001 From: Patrick Haun Date: Mon, 19 Mar 2018 19:43:43 +0100 Subject: [PATCH 1/2] [fix] always link zlib static libz-sys uses these options https://github.com/alexcrichton/libz-sys/blob/8eb6f9e8f45cef71f8a3fa94d849ac54a263c090/build.rs#L52 --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 43bf2b6..8924c74 100644 --- a/Dockerfile +++ b/Dockerfile @@ -96,7 +96,9 @@ ENV OPENSSL_DIR=/usr/local/musl/ \ PQ_LIB_STATIC_X86_64_UNKNOWN_LINUX_MUSL=1 \ PG_CONFIG_X86_64_UNKNOWN_LINUX_GNU=/usr/bin/pg_config \ PKG_CONFIG_ALLOW_CROSS=true \ - PKG_CONFIG_ALL_STATIC=true + PKG_CONFIG_ALL_STATIC=true \ + LIBZ_SYS_STATIC=1 \ + TARGET=musl # (Please feel free to submit pull requests for musl-libc builds of other C # libraries needed by the most popular and common Rust crates, to avoid From 2b8bab380b6910406b58a673df2f73d54f88f6cd Mon Sep 17 00:00:00 2001 From: Maximilien Riehl Date: Mon, 26 Mar 2018 08:47:01 +0200 Subject: [PATCH 2/2] [test][chore] add travis config and use git2 dependency in test cc @bomgar --- .travis.yml | 15 +++++++++++++++ test-image | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..3d79cb9 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,15 @@ +language: rust + +services: + - docker + +os: + - linux + +script: +- bash ./test-image + +notifications: + email: + on_success: never + on_failure: always diff --git a/test-image b/test-image index 6bdd4d2..ef34a11 100755 --- a/test-image +++ b/test-image @@ -19,7 +19,26 @@ set -euo pipefail export USER=rust cargo new --vcs none --bin testme cd testme +# depending on git2 (and using it) makes the test much better, because git2 links against openssl and libz-sys among others +sed -i 's/\[dependencies\]/\[dependencies\]\ngit2 = \"0.6\"/' Cargo.toml +echo ' +extern crate git2; +use git2::Repository; +fn main() { +let _local = Repository::init(\"fkbr\"); +println!(\"Hello, world!\"); +}' > src/main.rs cargo build + +# ldd will not die if the file does not exist, we need to check that too +if [ ! -f target/x86_64-unknown-linux-musl/debug/testme ]; then + echo 'binary was not created by cargo build or has unexpected name. Heres whats in target:' 1>&2 + # no tree in image, but this also works + set -x + ls -l target && ls -l target/x86_64-unknown-linux-musl && ls -l target/x86_64-unknown-linux-musl/debug + exit 1 +fi + echo 'Checking to make sure it is not a dynamic executable' if ldd target/x86_64-unknown-linux-musl/debug/testme; then echo 'Executable is not static!' 1>&2