Skip to content

Commit

Permalink
Filter out -lmsvcrt for Windows gnu targets (#274)
Browse files Browse the repository at this point in the history
* Replace `-lmsvcrt` with `-lmsvcrt-os` for Windows gnu targets

* Remove `-lmsvcrt`

* Skip windows gnu on zig 0.13
  • Loading branch information
messense authored Sep 18, 2024
1 parent d356b68 commit 39faad2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ jobs:
cargo run zigbuild --target aarch64-unknown-linux-musl
cargo run zigbuild --target aarch64-unknown-linux-musl --manifest-path tests/hello-rustls/Cargo.toml
- name: Windows - Test gnu build
# We are having trouble building with zig 0.13
if: ${{ matrix.zig == '0.10.1' }}
run: |
cargo run zigbuild --target x86_64-pc-windows-gnu
cargo run zigbuild --target x86_64-pc-windows-gnu --manifest-path tests/hello-windows/Cargo.toml
Expand All @@ -202,7 +204,7 @@ jobs:
run: |
cargo run zigbuild --target aarch64-unknown-linux-gnu --manifest-path tests/hello-rustls/Cargo.toml --features curl
- name: Windows - Test run
if: ${{ matrix.os == 'windows-latest' }}
if: ${{ matrix.os == 'windows-latest' && matrix.zig == '0.10.1' }}
run: |
./target/x86_64-pc-windows-gnu/debug/cargo-zigbuild.exe zigbuild --help
./tests/hello-windows/target/x86_64-pc-windows-gnu/debug/hello-windows.exe
Expand Down
2 changes: 2 additions & 0 deletions src/zig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ impl Zig {
// https://github.com/rust-lang/rust/blob/f0bc76ac41a0a832c9ee621e31aaf1f515d3d6a5/compiler/rustc_target/src/spec/i686_pc_windows_gnu.rs#L16
// zig doesn't support --disable-auto-image-base, --dynamicbase and --large-address-aware
return None;
} else if arg == "-lmsvcrt" {
return None;
}
} else if arg == "-Wl,--no-undefined-version" {
// https://github.com/rust-lang/rust/blob/542ed2bf72b232b245ece058fc11aebb1ca507d7/compiler/rustc_codegen_ssa/src/back/linker.rs#L723
Expand Down

0 comments on commit 39faad2

Please sign in to comment.