Skip to content

Commit 5617293

Browse files
alexcrichtonbongjunj
authored andcommitted
Shrink C API release artifacts (bytecodealliance#11483)
This is needed to currently shrink our `*.a` artifacts under 100M in size which is required downstream in the wasmtime-go embedding. Some testing in bytecodealliance#11475 of using full LTO or only building Linux/macOS with 1 CGU shows that this'll likely increase cycle time by ~1 minute. Windows builders are already the slowest release build builders and this is adding 1 minute using 1 CGU vs 2-3 extra minutes for full LTO. Linux/macOS are switched to using full LTO which the CI builders currently have plenty of time for. This shaves 50M off the C API artifacts for Linux which buys a good amount of headroom for future changes. Closes bytecodealliance#11476
1 parent 8cf271e commit 5617293

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

ci/build-release-artifacts.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,21 @@ cargo build --release $flags --target $target -p wasmtime-cli $bin_flags --featu
7777
# a different project that wants to unwind.
7878
export RUSTFLAGS="$RUSTFLAGS -C force-unwind-tables"
7979

80+
# Shrink the size of `*.a` artifacts without spending too much extra time in CI.
81+
# See #11476 for some more context. Here Windows builds achieve this with 1 CGU
82+
# which results in modest size gains, and other platforms use LTO to achieve
83+
# much more significant size gains. The reason the platforms are different is
84+
# that CI is extremely slow on Windows, almost 2x slower, so this is an attempt
85+
# to keep CI cycle time under control.
86+
case $build in
87+
*-mingw* | *-windows*)
88+
export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
89+
;;
90+
*)
91+
export CARGO_PROFILE_RELEASE_LTO=true
92+
;;
93+
esac
94+
8095
mkdir -p target/c-api-build
8196
cd target/c-api-build
8297
cmake \

0 commit comments

Comments
 (0)