Skip to content

Commit

Permalink
Merge pull request #27 from BCWResearch/revert-static
Browse files Browse the repository at this point in the history
revert static linking
  • Loading branch information
patrick-bcw authored Aug 20, 2024
2 parents 0560863 + fa9b842 commit 3ea981b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
5 changes: 1 addition & 4 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
[build]
# https://github.com/rust-lang/rust/pull/124129
# https://github.com/dtolnay/linkme/pull/88
rustflags = ["-Z", "linker-features=-lld"]

#[target.x86_64-unknown-linux-gnu]
#linker = "clang-16"
rustflags = ["-Z", "linker-features=-lld"]
16 changes: 5 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@ RUN apt-get update && apt-get install -y \
# for openssl
libssl-dev \
pkg-config \
# for static linking
clang-16 \
# clean the image
&& rm -rf /var/lib/apt/lists/*

ARG PROFILE=release
# forward the docker argument so that the script below can read it
ENV PROFILE=${PROFILE}

# statically link the C runtime (but not openssl)
ENV COMMON_RUSTFLAGS='-C target-cpu=native -Zlinker-features=-lld'

ENV RUSTFLAGS='-C target-cpu=native -Zlinker-features=-lld'

# Build the application.
RUN \
Expand All @@ -53,11 +51,7 @@ cd /src

# use the cache mount
# (we will not be able to to write to e.g `/src/target` because it is bind-mounted)
RUSTFLAGS="${COMMON_RUSTFLAGS} -C target-feature=+crt-static" \
CARGO_TARGET_DIR=/artifacts cargo build --locked "--profile=${PROFILE}" --target=x86_64-unknown-linux-gnu --bin worker

RUSTFLAGS="${COMMON_RUSTFLAGS}" \
CARGO_TARGET_DIR=/artifacts cargo build --locked "--profile=${PROFILE}" --target=x86_64-unknown-linux-gnu --bin coordinator --bin leader --bin rpc --bin verifier
CARGO_TARGET_DIR=/artifacts cargo build --locked "--profile=${PROFILE}" --all


# narrow the find call to SUBDIR because if we just copy out all executables
Expand All @@ -71,8 +65,8 @@ fi
# maxdepth because binaries are in the root
# - other folders contain build scripts etc.
mkdir /output
find "/artifacts/x86_64-unknown-linux-gnu" \
-maxdepth 2 \
find "/artifacts/$SUBDIR" \
-maxdepth 1 \
-type f \
-executable \
-not -name '*.so' \
Expand Down

0 comments on commit 3ea981b

Please sign in to comment.