| ... | ... | @@ -565,13 +565,17 @@ fn addCmakeCfgOptionsToExe( |
| 565 | 565 | exe.linkLibCpp(); |
| 566 | 566 | } else { |
| 567 | 567 | const need_cpp_includes = true; |
| 568 | const lib_suffix = switch (cfg.llvm_linkage) { |
| 569 | .static => exe.target.staticLibSuffix()[1..], |
| 570 | .dynamic => exe.target.dynamicLibSuffix()[1..], |
| 571 | }; |
| 568 | 572 | |
| 569 | 573 | // System -lc++ must be used because in this code path we are attempting to link |
| 570 | 574 | // against system-provided LLVM, Clang, LLD. |
| 571 | 575 | if (exe.target.getOsTag() == .linux) { |
| 572 | | // First we try to static link against gcc libstdc++. If that doesn't work, |
| 573 | | // we fall back to -lc++ and cross our fingers. |
| 574 | | addCxxKnownPath(b, cfg, exe, "libstdc++.a", "", need_cpp_includes) catch |err| switch (err) { |
| 576 | // First we try to link against gcc libstdc++. If that doesn't work, we fall |
| 577 | // back to -lc++ and cross our fingers. |
| 578 | addCxxKnownPath(b, cfg, exe, b.fmt("libstdc++.{s}", .{lib_suffix}), "", need_cpp_includes) catch |err| switch (err) { |
| 575 | 579 | error.RequiredLibraryNotFound => { |
| 576 | 580 | exe.linkSystemLibrary("c++"); |
| 577 | 581 | }, |
| ... | ... | @@ -579,11 +583,11 @@ fn addCmakeCfgOptionsToExe( |
| 579 | 583 | }; |
| 580 | 584 | exe.linkSystemLibrary("unwind"); |
| 581 | 585 | } else if (exe.target.isFreeBSD()) { |
| 582 | | try addCxxKnownPath(b, cfg, exe, "libc++.a", null, need_cpp_includes); |
| 586 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++.{s}", .{lib_suffix}), null, need_cpp_includes); |
| 583 | 587 | exe.linkSystemLibrary("pthread"); |
| 584 | 588 | } else if (exe.target.getOsTag() == .openbsd) { |
| 585 | | try addCxxKnownPath(b, cfg, exe, "libc++.a", null, need_cpp_includes); |
| 586 | | try addCxxKnownPath(b, cfg, exe, "libc++abi.a", null, need_cpp_includes); |
| 589 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++.{s}", .{lib_suffix}), null, need_cpp_includes); |
| 590 | try addCxxKnownPath(b, cfg, exe, b.fmt("libc++abi.{s}", .{lib_suffix}), null, need_cpp_includes); |
| 587 | 591 | } else if (exe.target.isDarwin()) { |
| 588 | 592 | exe.linkSystemLibrary("c++"); |
| 589 | 593 | } |