| ... | @@ -2688,6 +2688,13 @@ fn buildOutputType( | ... | @@ -2688,6 +2688,13 @@ fn buildOutputType( |
| 2688 | lib: Compilation.SystemLib, | 2688 | lib: Compilation.SystemLib, |
| 2689 | }) = .{}; | 2689 | }) = .{}; |
| 2690 | | 2690 | |
| | 2691 | var libc_installation: ?LibCInstallation = null; |
| | 2692 | if (libc_paths_file) |paths_file| { |
| | 2693 | libc_installation = LibCInstallation.parse(arena, paths_file, cross_target) catch |err| { |
| | 2694 | fatal("unable to parse libc paths file at path {s}: {s}", .{ paths_file, @errorName(err) }); |
| | 2695 | }; |
| | 2696 | } |
| | 2697 | |
| 2691 | for (system_libs.keys(), system_libs.values()) |lib_name, info| { | 2698 | for (system_libs.keys(), system_libs.values()) |lib_name, info| { |
| 2692 | if (target_util.is_libc_lib_name(target_info.target, lib_name)) { | 2699 | if (target_util.is_libc_lib_name(target_info.target, lib_name)) { |
| 2693 | link_libc = true; | 2700 | link_libc = true; |
| ... | @@ -2709,7 +2716,7 @@ fn buildOutputType( | ... | @@ -2709,7 +2716,7 @@ fn buildOutputType( |
| 2709 | }, | 2716 | }, |
| 2710 | } | 2717 | } |
| 2711 | | 2718 | |
| 2712 | if (target_info.target.os.tag == .windows) { | 2719 | if (target_info.target.isMinGW()) { |
| 2713 | const exists = mingw.libExists(arena, target_info.target, zig_lib_directory, lib_name) catch |err| { | 2720 | const exists = mingw.libExists(arena, target_info.target, zig_lib_directory, lib_name) catch |err| { |
| 2714 | fatal("failed to check zig installation for DLL import libs: {s}", .{ | 2721 | fatal("failed to check zig installation for DLL import libs: {s}", .{ |
| 2715 | @errorName(err), | 2722 | @errorName(err), |
| ... | @@ -2768,6 +2775,21 @@ fn buildOutputType( | ... | @@ -2768,6 +2775,21 @@ fn buildOutputType( |
| 2768 | try rpath_list.appendSlice(paths.rpaths.items); | 2775 | try rpath_list.appendSlice(paths.rpaths.items); |
| 2769 | } | 2776 | } |
| 2770 | | 2777 | |
| | 2778 | if (builtin.target.os.tag == .windows and |
| | 2779 | target_info.target.abi == .msvc and |
| | 2780 | external_system_libs.len != 0) |
| | 2781 | { |
| | 2782 | if (libc_installation == null) { |
| | 2783 | libc_installation = try LibCInstallation.findNative(.{ |
| | 2784 | .allocator = arena, |
| | 2785 | .verbose = true, |
| | 2786 | .target = cross_target.toTarget(), |
| | 2787 | }); |
| | 2788 | |
| | 2789 | try lib_dirs.appendSlice(&.{ libc_installation.?.msvc_lib_dir.?, libc_installation.?.kernel32_lib_dir.? }); |
| | 2790 | } |
| | 2791 | } |
| | 2792 | |
| 2771 | // If any libs in this list are statically provided, we omit them from the | 2793 | // If any libs in this list are statically provided, we omit them from the |
| 2772 | // resolved list and populate the link_objects array instead. | 2794 | // resolved list and populate the link_objects array instead. |
| 2773 | { | 2795 | { |
| ... | @@ -3240,15 +3262,6 @@ fn buildOutputType( | ... | @@ -3240,15 +3262,6 @@ fn buildOutputType( |
| 3240 | try thread_pool.init(.{ .allocator = gpa }); | 3262 | try thread_pool.init(.{ .allocator = gpa }); |
| 3241 | defer thread_pool.deinit(); | 3263 | defer thread_pool.deinit(); |
| 3242 | | 3264 | |
| 3243 | var libc_installation: ?LibCInstallation = null; | | |
| 3244 | defer if (libc_installation) |*l| l.deinit(gpa); | | |
| 3245 | | | |
| 3246 | if (libc_paths_file) |paths_file| { | | |
| 3247 | libc_installation = LibCInstallation.parse(gpa, paths_file, cross_target) catch |err| { | | |
| 3248 | fatal("unable to parse libc paths file at path {s}: {s}", .{ paths_file, @errorName(err) }); | | |
| 3249 | }; | | |
| 3250 | } | | |
| 3251 | | | |
| 3252 | var global_cache_directory: Compilation.Directory = l: { | 3265 | var global_cache_directory: Compilation.Directory = l: { |
| 3253 | if (override_global_cache_dir) |p| { | 3266 | if (override_global_cache_dir) |p| { |
| 3254 | break :l .{ | 3267 | break :l .{ |