| ... | @@ -556,14 +556,11 @@ fn addCmakeCfgOptionsToExe( | ... | @@ -556,14 +556,11 @@ fn addCmakeCfgOptionsToExe( |
| 556 | if (use_zig_libcxx) { | 556 | if (use_zig_libcxx) { |
| 557 | exe.linkLibCpp(); | 557 | exe.linkLibCpp(); |
| 558 | } else { | 558 | } else { |
| 559 | const need_cpp_includes = true; | | |
| 560 | const lib_suffix = switch (cfg.llvm_linkage) { | | |
| 561 | .static => exe.target.staticLibSuffix()[1..], | | |
| 562 | .dynamic => exe.target.dynamicLibSuffix()[1..], | | |
| 563 | }; | | |
| 564 | | | |
| 565 | // System -lc++ must be used because in this code path we are attempting to link | 559 | // System -lc++ must be used because in this code path we are attempting to link |
| 566 | // against system-provided LLVM, Clang, LLD. | 560 | // against system-provided LLVM, Clang, LLD. |
| | 561 | const need_cpp_includes = true; |
| | 562 | const static = cfg.llvm_linkage == .static; |
| | 563 | const lib_suffix = if (static) exe.target.staticLibSuffix()[1..] else exe.target.dynamicLibSuffix()[1..]; |
| 567 | switch (exe.target.getOsTag()) { | 564 | switch (exe.target.getOsTag()) { |
| 568 | .linux => { | 565 | .linux => { |
| 569 | // First we try to link against gcc libstdc++. If that doesn't work, we fall | 566 | // First we try to link against gcc libstdc++. If that doesn't work, we fall |
| ... | @@ -580,20 +577,24 @@ fn addCmakeCfgOptionsToExe( | ... | @@ -580,20 +577,24 @@ fn addCmakeCfgOptionsToExe( |
| 580 | exe.linkSystemLibrary("c++"); | 577 | exe.linkSystemLibrary("c++"); |
| 581 | }, | 578 | }, |
| 582 | .freebsd => { | 579 | .freebsd => { |
| 583 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++.{s}", .{lib_suffix}), null, need_cpp_includes); | 580 | if (static) { |
| 584 | try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes); | 581 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++.{s}", .{lib_suffix}), null, need_cpp_includes); |
| | 582 | try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes); |
| | 583 | } else { |
| | 584 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++.{s}", .{lib_suffix}), null, need_cpp_includes); |
| | 585 | } |
| 585 | }, | 586 | }, |
| 586 | .openbsd => { | 587 | .openbsd => { |
| 587 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++.{s}", .{lib_suffix}), null, need_cpp_includes); | 588 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++.{s}", .{lib_suffix}), null, need_cpp_includes); |
| 588 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++abi.{s}", .{lib_suffix}), null, need_cpp_includes); | 589 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++abi.{s}", .{lib_suffix}), null, need_cpp_includes); |
| 589 | }, | 590 | }, |
| 590 | .netbsd => { | 591 | .netbsd, .dragonfly => { |
| 591 | try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes); | 592 | if (static) { |
| 592 | try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes); | 593 | try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes); |
| 593 | }, | 594 | try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes); |
| 594 | .dragonfly => { | 595 | } else { |
| 595 | try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes); | 596 | try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes); |
| 596 | try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes); | 597 | } |
| 597 | }, | 598 | }, |
| 598 | else => {}, | 599 | else => {}, |
| 599 | } | 600 | } |