| ... | @@ -589,14 +589,11 @@ fn addCmakeCfgOptionsToExe( | ... | @@ -589,14 +589,11 @@ fn addCmakeCfgOptionsToExe( |
| 589 | if (use_zig_libcxx) { | 589 | if (use_zig_libcxx) { |
| 590 | exe.linkLibCpp(); | 590 | exe.linkLibCpp(); |
| 591 | } else { | 591 | } else { |
| 592 | const need_cpp_includes = true; | | |
| 593 | const lib_suffix = switch (cfg.llvm_linkage) { | | |
| 594 | .static => exe.target.staticLibSuffix()[1..], | | |
| 595 | .dynamic => exe.target.dynamicLibSuffix()[1..], | | |
| 596 | }; | | |
| 597 | | | |
| 598 | // System -lc++ must be used because in this code path we are attempting to link | 592 | // System -lc++ must be used because in this code path we are attempting to link |
| 599 | // against system-provided LLVM, Clang, LLD. | 593 | // against system-provided LLVM, Clang, LLD. |
| | 594 | const need_cpp_includes = true; |
| | 595 | const static = cfg.llvm_linkage == .static; |
| | 596 | const lib_suffix = if (static) exe.target.staticLibSuffix()[1..] else exe.target.dynamicLibSuffix()[1..]; |
| 600 | switch (exe.target.getOsTag()) { | 597 | switch (exe.target.getOsTag()) { |
| 601 | .linux => { | 598 | .linux => { |
| 602 | // First we try to link against gcc libstdc++. If that doesn't work, we fall | 599 | // First we try to link against gcc libstdc++. If that doesn't work, we fall |
| ... | @@ -613,20 +610,24 @@ fn addCmakeCfgOptionsToExe( | ... | @@ -613,20 +610,24 @@ fn addCmakeCfgOptionsToExe( |
| 613 | exe.linkSystemLibrary("c++"); | 610 | exe.linkSystemLibrary("c++"); |
| 614 | }, | 611 | }, |
| 615 | .freebsd => { | 612 | .freebsd => { |
| 616 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++.{s}", .{lib_suffix}), null, need_cpp_includes); | 613 | if (static) { |
| 617 | try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes); | 614 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++.{s}", .{lib_suffix}), null, need_cpp_includes); |
| | 615 | try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes); |
| | 616 | } else { |
| | 617 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++.{s}", .{lib_suffix}), null, need_cpp_includes); |
| | 618 | } |
| 618 | }, | 619 | }, |
| 619 | .openbsd => { | 620 | .openbsd => { |
| 620 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++.{s}", .{lib_suffix}), null, need_cpp_includes); | 621 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++.{s}", .{lib_suffix}), null, need_cpp_includes); |
| 621 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++abi.{s}", .{lib_suffix}), null, need_cpp_includes); | 622 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++abi.{s}", .{lib_suffix}), null, need_cpp_includes); |
| 622 | }, | 623 | }, |
| 623 | .netbsd => { | 624 | .netbsd, .dragonfly => { |
| 624 | try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes); | 625 | if (static) { |
| 625 | try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes); | 626 | try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes); |
| 626 | }, | 627 | try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes); |
| 627 | .dragonfly => { | 628 | } else { |
| 628 | try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes); | 629 | try addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), null, need_cpp_includes); |
| 629 | try addCxxKnownPath(b, cfg, exe, b.fmt("libgcc_eh.{s}", .{lib_suffix}), null, need_cpp_includes); | 630 | } |
| 630 | }, | 631 | }, |
| 631 | else => {}, | 632 | else => {}, |
| 632 | } | 633 | } |