@@ -5188,6 +5188,15 @@ fn failCObjWithOwnedErrorMsg(
5188
5188
fn detectWin32ResourceIncludeDirs (arena : Allocator , options : InitOptions ) ! LibCDirs {
5189
5189
// Set the includes to .none here when there are no rc files to compile
5190
5190
var includes = if (options .rc_source_files .len > 0 ) options .rc_includes else .none ;
5191
+ if (builtin .target .os .tag != .windows ) {
5192
+ switch (includes ) {
5193
+ // MSVC can't be found when the host isn't Windows, so short-circuit.
5194
+ .msvc = > includes = .none ,
5195
+ // Skip straight to gnu since we won't be able to detect MSVC on non-Windows hosts.
5196
+ .any = > includes = .gnu ,
5197
+ .none , .gnu = > {},
5198
+ }
5199
+ }
5191
5200
while (true ) {
5192
5201
switch (includes ) {
5193
5202
.any , .msvc = > return detectLibCIncludeDirs (
@@ -5212,21 +5221,12 @@ fn detectWin32ResourceIncludeDirs(arena: Allocator, options: InitOptions) !LibCD
5212
5221
}
5213
5222
return err ;
5214
5223
},
5215
- .gnu = > return detectLibCIncludeDirs (
5216
- arena ,
5217
- options .zig_lib_directory .path .? ,
5218
- .{
5219
- .cpu = options .target .cpu ,
5220
- .os = options .target .os ,
5221
- .abi = .gnu ,
5222
- .ofmt = options .target .ofmt ,
5223
- },
5224
- options .is_native_abi ,
5225
- // The .rc preprocessor will need to know the libc include dirs even if we
5226
- // are not linking libc, so force 'link_libc' to true
5227
- true ,
5228
- options .libc_installation ,
5229
- ),
5224
+ .gnu = > return detectLibCFromBuilding (arena , options .zig_lib_directory .path .? , .{
5225
+ .cpu = options .target .cpu ,
5226
+ .os = options .target .os ,
5227
+ .abi = .gnu ,
5228
+ .ofmt = options .target .ofmt ,
5229
+ }),
5230
5230
.none = > return LibCDirs {
5231
5231
.libc_include_dir_list = &[0 ][]u8 {},
5232
5232
.libc_installation = null ,
0 commit comments