| ... | @@ -2623,6 +2623,12 @@ fn buildOutputType( | ... | @@ -2623,6 +2623,12 @@ fn buildOutputType( |
| 2623 | name: []const u8, | 2623 | name: []const u8, |
| 2624 | info: SystemLib, | 2624 | info: SystemLib, |
| 2625 | }) = .{}; | 2625 | }) = .{}; |
| | 2626 | |
| | 2627 | var resolved_system_libs: std.MultiArrayList(struct { |
| | 2628 | name: []const u8, |
| | 2629 | lib: Compilation.SystemLib, |
| | 2630 | }) = .{}; |
| | 2631 | |
| 2626 | for (system_libs.keys(), system_libs.values()) |lib_name, info| { | 2632 | for (system_libs.keys(), system_libs.values()) |lib_name, info| { |
| 2627 | if (target_util.is_libc_lib_name(target_info.target, lib_name)) { | 2633 | if (target_util.is_libc_lib_name(target_info.target, lib_name)) { |
| 2628 | link_libc = true; | 2634 | link_libc = true; |
| ... | @@ -2644,6 +2650,25 @@ fn buildOutputType( | ... | @@ -2644,6 +2650,25 @@ fn buildOutputType( |
| 2644 | }, | 2650 | }, |
| 2645 | } | 2651 | } |
| 2646 | | 2652 | |
| | 2653 | if (target_info.target.os.tag == .windows) { |
| | 2654 | const exists = mingw.libExists(arena, target_info.target, zig_lib_directory, lib_name) catch |err| { |
| | 2655 | fatal("failed to check zig installation for DLL import libs: {s}", .{ |
| | 2656 | @errorName(err), |
| | 2657 | }); |
| | 2658 | }; |
| | 2659 | if (exists) { |
| | 2660 | try resolved_system_libs.append(arena, .{ |
| | 2661 | .name = lib_name, |
| | 2662 | .lib = .{ |
| | 2663 | .needed = true, |
| | 2664 | .weak = false, |
| | 2665 | .path = undefined, |
| | 2666 | }, |
| | 2667 | }); |
| | 2668 | continue; |
| | 2669 | } |
| | 2670 | } |
| | 2671 | |
| 2647 | if (fs.path.isAbsolute(lib_name)) { | 2672 | if (fs.path.isAbsolute(lib_name)) { |
| 2648 | fatal("cannot use absolute path as a system library: {s}", .{lib_name}); | 2673 | fatal("cannot use absolute path as a system library: {s}", .{lib_name}); |
| 2649 | } | 2674 | } |
| ... | @@ -2715,11 +2740,6 @@ fn buildOutputType( | ... | @@ -2715,11 +2740,6 @@ fn buildOutputType( |
| 2715 | // existence via flags instead. | 2740 | // existence via flags instead. |
| 2716 | // Similarly, if any libs in this list are statically provided, we omit | 2741 | // Similarly, if any libs in this list are statically provided, we omit |
| 2717 | // them from the resolved list and populate the link_objects array instead. | 2742 | // them from the resolved list and populate the link_objects array instead. |
| 2718 | var resolved_system_libs: std.MultiArrayList(struct { | | |
| 2719 | name: []const u8, | | |
| 2720 | lib: Compilation.SystemLib, | | |
| 2721 | }) = .{}; | | |
| 2722 | | | |
| 2723 | { | 2743 | { |
| 2724 | var test_path = std.ArrayList(u8).init(gpa); | 2744 | var test_path = std.ArrayList(u8).init(gpa); |
| 2725 | defer test_path.deinit(); | 2745 | defer test_path.deinit(); |
| ... | @@ -2735,25 +2755,6 @@ fn buildOutputType( | ... | @@ -2735,25 +2755,6 @@ fn buildOutputType( |
| 2735 | }).init(arena); | 2755 | }).init(arena); |
| 2736 | | 2756 | |
| 2737 | syslib: for (external_system_libs.items(.name), external_system_libs.items(.info)) |lib_name, info| { | 2757 | syslib: for (external_system_libs.items(.name), external_system_libs.items(.info)) |lib_name, info| { |
| 2738 | if (target_info.target.os.tag == .windows) { | | |
| 2739 | const exists = mingw.libExists(arena, target_info.target, zig_lib_directory, lib_name) catch |err| { | | |
| 2740 | fatal("failed to check zig installation for DLL import libs: {s}", .{ | | |
| 2741 | @errorName(err), | | |
| 2742 | }); | | |
| 2743 | }; | | |
| 2744 | if (exists) { | | |
| 2745 | try resolved_system_libs.append(arena, .{ | | |
| 2746 | .name = lib_name, | | |
| 2747 | .lib = .{ | | |
| 2748 | .needed = true, | | |
| 2749 | .weak = false, | | |
| 2750 | .path = undefined, | | |
| 2751 | }, | | |
| 2752 | }); | | |
| 2753 | continue; | | |
| 2754 | } | | |
| 2755 | } | | |
| 2756 | | | |
| 2757 | // Checked in the first pass above while looking for libc libraries. | 2758 | // Checked in the first pass above while looking for libc libraries. |
| 2758 | assert(!fs.path.isAbsolute(lib_name)); | 2759 | assert(!fs.path.isAbsolute(lib_name)); |
| 2759 | | 2760 | |