diff --git a/bootstrap/Compilation.zig b/bootstrap/Compilation.zig index 8afc6c9..76910ed 100644 --- a/bootstrap/Compilation.zig +++ b/bootstrap/Compilation.zig @@ -654,8 +654,8 @@ pub fn compileCSourceFile(context: *const Context, arguments: []const []const u8 "/usr/include/x86_64-linux-gnu", } else switch (@import("builtin").cpu.arch) { .x86_64 => &.{ - "/usr/include/c++/13.2.1", - "/usr/include/c++/13.2.1/x86_64-pc-linux-gnu", + "/usr/include/c++/14", + "/usr/include/c++/14/x86_64-redhat-linux", "/usr/lib/clang/17/include", "/usr/include", "/usr/include/linux", diff --git a/bootstrap/linker/lld.zig b/bootstrap/linker/lld.zig index 807de82..7dda630 100644 --- a/bootstrap/linker/lld.zig +++ b/bootstrap/linker/lld.zig @@ -89,27 +89,18 @@ pub fn link(context: *const Compilation.Context, options: linker.Options) !void } else { if (options.link_libcpp) { assert(options.link_libc); - switch (@import("builtin").cpu.arch) { - .x86_64 => _ = argv.append("/usr/lib/libstdc++.so"), - .aarch64 => _ = argv.append("/usr/lib64/libstdc++.so.6"), - else => unreachable, - } + _ = argv.append("/usr/lib64/libstdc++.so.6"); } if (options.link_libc) { + _ = argv.append("/usr/lib64/crt1.o"); + _ = argv.append("/usr/lib64/crti.o"); + argv.append_slice(&.{ "-L", "/usr/lib64" }); + + _ = argv.append("-dynamic-linker"); switch (@import("builtin").cpu.arch) { - .x86_64 => { - _ = argv.append("/usr/lib/crt1.o"); - _ = argv.append("/usr/lib/crti.o"); - argv.append_slice(&.{ "-L", "/usr/lib" }); - argv.append_slice(&.{ "-dynamic-linker", "/lib64/ld-linux-x86-64.so.2" }); - }, - .aarch64 => { - _ = argv.append("/usr/lib64/crt1.o"); - _ = argv.append("/usr/lib64/crti.o"); - argv.append_slice(&.{ "-L", "/usr/lib64" }); - argv.append_slice(&.{ "-dynamic-linker", "/lib/ld-linux-aarch64.so.1" }); - }, + .x86_64 => _ = argv.append("/lib64/ld-linux-x86-64.so.2"), + .aarch64 => _ = argv.append("/lib/ld-linux-aarch64.so.1"), else => unreachable, } @@ -121,15 +112,7 @@ pub fn link(context: *const Compilation.Context, options: linker.Options) !void _ = argv.append("-lrt"); _ = argv.append("-lutil"); - switch (@import("builtin").cpu.arch) { - .x86_64 => { - _ = argv.append("/usr/lib/crtn.o"); - }, - .aarch64 => { - _ = argv.append("/usr/lib64/crtn.o"); - }, - else => unreachable, - } + _ = argv.append("/usr/lib64/crtn.o"); } } }, diff --git a/build.zig b/build.zig index b3ce438..b4474f4 100644 --- a/build.zig +++ b/build.zig @@ -462,35 +462,21 @@ pub fn build(b: *std.Build) !void { var tokenizer = std.mem.tokenize(u8, result.stdout, " "); const cxx_version = while (tokenizer.next()) |chunk| { if (std.ascii.isDigit(chunk[0])) { - if (std.SemanticVersion.parse(chunk)) |_| { - break chunk; + if (std.SemanticVersion.parse(chunk)) |sema_version| { + break try std.fmt.allocPrint(b.allocator, "{}", .{sema_version.major}); } else |err| err catch {}; } } else { unreachable; }; - const cxx_include_base = switch (@import("builtin").cpu.arch) { - .x86_64 => try std.mem.concat(b.allocator, u8, &.{ "/usr/include/c++/", cxx_version }), - .aarch64 => "/usr/include/c++/13", - else => @compileError("Arch not supported"), - }; - compiler.addObjectFile(.{ - .cwd_relative = switch (@import("builtin").cpu.arch) { - .aarch64 => "/lib64/libstdc++.so.6", - .x86_64 => "/usr/lib/libstdc++.so", - else => @compileError("Arch not supported"), - }, - }); + const cxx_include_base = try std.mem.concat(b.allocator, u8, &.{ "/usr/include/c++/", cxx_version }); + compiler.addObjectFile(.{ .cwd_relative = "/usr/lib64/libstdc++.so.6" }); + compiler.addIncludePath(.{ .cwd_relative = "/usr/lib64/llvm17/include/" }); compiler.addIncludePath(.{ .cwd_relative = "/usr/include" }); compiler.addIncludePath(.{ .cwd_relative = cxx_include_base }); - compiler.addIncludePath(.{ - .cwd_relative = try std.mem.concat(b.allocator, u8, &.{ cxx_include_base, switch (@import("builtin").cpu.arch) { - .x86_64 => "/x86_64-pc-linux-gnu", - .aarch64 => "/aarch64-redhat-linux", - else => @compileError("Arch not supported"), - } }), - }); + compiler.addIncludePath(.{ .cwd_relative = try std.mem.concat(b.allocator, u8, &.{ cxx_include_base, "/" ++ @tagName(@import("builtin").cpu.arch) ++ "-redhat-linux"}) }); + compiler.addLibraryPath(.{ .cwd_relative = "/usr/lib64/llvm17/lib" }); compiler.addLibraryPath(.{ .cwd_relative = "/usr/lib" }); } },