diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-03-17 23:03:45 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-03-17 23:03:45 -0400 |
| commit | dbde5df568597c63e28bb1244d695156afbad5d0 (patch) | |
| tree | 4046729881ce284aaf4369e03d30bce7fa435911 /build.zig | |
| parent | 7251eb1681d269ef5672193a608b580e371981fb (diff) | |
| download | zig-dbde5df568597c63e28bb1244d695156afbad5d0.tar.gz zig-dbde5df568597c63e28bb1244d695156afbad5d0.zip | |
clean up some self-hosted bitrot + don't assume libstdc++
closes #4682
The self-hosted compiler is still bit rotted and still not compiling
successfully yet. I have a more serious rework of the code in a
different branch.
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -298,10 +298,14 @@ fn configureStage2(b: *Builder, exe: var, ctx: Context) !void { dependOnLib(b, exe, ctx.llvm); if (exe.target.getOsTag() == .linux) { - try addCxxKnownPath(b, ctx, exe, "libstdc++.a", - \\Unable to determine path to libstdc++.a - \\On Fedora, install libstdc++-static and try again. - ); + // First we try to static link against gcc libstdc++. If that doesn't work, + // we fall back to -lc++ and cross our fingers. + addCxxKnownPath(b, ctx, exe, "libstdc++.a", "") catch |err| switch (err) { + error.RequiredLibraryNotFound => { + exe.linkSystemLibrary("c++"); + }, + else => |e| return e, + }; exe.linkSystemLibrary("pthread"); } else if (exe.target.isFreeBSD()) { @@ -320,7 +324,7 @@ fn configureStage2(b: *Builder, exe: var, ctx: Context) !void { // System compiler, not gcc. exe.linkSystemLibrary("c++"); }, - else => return err, + else => |e| return e, } } |
