Fix release build: Set RUSTFLAGS to link with libgcc statically

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-07-31 13:12:27 +10:00
parent af3b87df7a
commit 9e5ff25be8
No known key found for this signature in database
GPG key ID: 591C0B03040416D6
2 changed files with 10 additions and 0 deletions

View file

@ -110,6 +110,8 @@ jobs:
- name: Build
run: ${{ env.CTOOL }} build ${{ env.CARGS }}
env:
RUSTFLAGS: ${{ env.RUSTFLAGS }}
- name: Get output
shell: bash

View file

@ -9,9 +9,16 @@ if $for_release then {
output: "debug",
profile: "dev",
args: ($matrix.debug_build_args // ""),
rustflags: "",
features: ($matrix.debug_features // ["rustls", "fancy-with-backtrace"]),
} end
|
.rustflags = (
if $for_release and $matrix.target == "aarch64-unknown-linux-musl" or $matrix.target == "armv7-unknown-linux-musleabihf"
then "-C link-arg=-lgcc -Clink-arg=-static-libgcc"
else "" end
)
|
.features = (
if (.features | length > 0)
then "--no-default-features --features \(.features | join(","))"
@ -23,6 +30,7 @@ if $for_release then {
CTOOL: (if ($matrix."use-cross" // false) then "cross" else "cargo" end),
COUTPUT: .output,
CARGS: "--target \($matrix.target) --profile \(.profile) \(.features) \(.args)",
RUSTFLAGS: .rustflags,
}
|
to_entries[] | "\(.key)=\(.value)"