Skip to content

Commit 7641717

Browse files
authored
[SM-1444] Fix Windows GNU Builds (#1053)
## 🎟️ Tracking https://bitwarden.atlassian.net/browse/SM-1444 ## 📔 Objective Windows GNU builds are currently broken due to a bug in [rustls-platform-verifier](https://github.com/rustls/rustls-platform-verifier) when LTO is turned on. I have submitted a GH Issue for this here: rustls/rustls-platform-verifier#141 ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes
1 parent 2f1717d commit 7641717

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

.github/workflows/build-rust-cross-platform.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,23 @@ jobs:
6060
- name: Add build architecture
6161
run: rustup target add ${{ matrix.settings.target }}
6262

63+
# Build Rust for musl
6364
- name: Build Rust for - ${{ matrix.settings.target }}
6465
if: ${{ contains(matrix.settings.target, 'musl') }}
6566
env:
6667
RUSTFLAGS: "-D warnings"
6768
run: cargo zigbuild -p bitwarden-c --target ${{ matrix.settings.target }} --release
6869

70+
# Build Rust for windows-gnu
6971
- name: Build Rust for - ${{ matrix.settings.target }}
70-
if: ${{ !contains(matrix.settings.target, 'musl') }}
72+
if: ${{ matrix.settings.target == 'x86_64-pc-windows-gnu' }}
73+
env:
74+
RUSTFLAGS: "-D warnings"
75+
run: cargo build -p bitwarden-c --target ${{ matrix.settings.target }} --profile=release-windows
76+
77+
# Build Rust for !musl && !windows-gnu
78+
- name: Build Rust for - ${{ matrix.settings.target }}
79+
if: ${{ !contains(matrix.settings.target, 'musl') && matrix.settings.target != 'x86_64-pc-windows-gnu' }}
7180
env:
7281
RUSTFLAGS: "-D warnings"
7382
MACOSX_DEPLOYMENT_TARGET: "10.14" # allows using new macos runner versions while still supporting older systems
@@ -79,3 +88,4 @@ jobs:
7988
name: libbitwarden_c_files-${{ matrix.settings.target }}
8089
path: |
8190
target/${{ matrix.settings.target }}/release/*bitwarden_c*
91+
target/${{ matrix.settings.target }}/release-windows/*bitwarden_c*

Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ opt-level = 1
4949
[profile.release]
5050
lto = "thin"
5151
codegen-units = 1
52+
53+
# Turn off LTO on release mode for windows
54+
# This is a workaround until this is fixed: https://github.com/rustls/rustls-platform-verifier/issues/141
55+
[profile.release-windows]
56+
inherits = "release"
57+
lto = "off"
58+
5259
# Stripping the binary reduces the size by ~30%, but the stacktraces won't be usable anymore.
5360
# This is fine as long as we don't have any unhandled panics, but let's keep it disabled for now
5461
# strip = true

0 commit comments

Comments
 (0)