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 - name: Build
run: ${{ env.CTOOL }} build ${{ env.CARGS }} run: ${{ env.CTOOL }} build ${{ env.CARGS }}
env:
RUSTFLAGS: ${{ env.RUSTFLAGS }}
- name: Get output - name: Get output
shell: bash shell: bash

View file

@ -9,9 +9,16 @@ if $for_release then {
output: "debug", output: "debug",
profile: "dev", profile: "dev",
args: ($matrix.debug_build_args // ""), args: ($matrix.debug_build_args // ""),
rustflags: "",
features: ($matrix.debug_features // ["rustls", "fancy-with-backtrace"]), features: ($matrix.debug_features // ["rustls", "fancy-with-backtrace"]),
} end } 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 = ( .features = (
if (.features | length > 0) if (.features | length > 0)
then "--no-default-features --features \(.features | join(","))" 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), CTOOL: (if ($matrix."use-cross" // false) then "cross" else "cargo" end),
COUTPUT: .output, COUTPUT: .output,
CARGS: "--target \($matrix.target) --profile \(.profile) \(.features) \(.args)", CARGS: "--target \($matrix.target) --profile \(.profile) \(.features) \(.args)",
RUSTFLAGS: .rustflags,
} }
| |
to_entries[] | "\(.key)=\(.value)" to_entries[] | "\(.key)=\(.value)"