Commit Graph

6 Commits

Author SHA1 Message Date
Sertonix 8455563ed8 Fix build script compilation when usize is u32
On 32-bit systems usize is not u64 but it was assumed in multiple places
of the build script.

Sometimes using u64 instead of usize since available and used memory can
exceed usize on 32-bit systems (just like totalSystemMemory)

Example errors:

lib/compiler/build_runner.zig:508:26: error: expected type 'usize', found 'u64'
        .available_rss = max_rss,
                         ^~~~~~~
lib/compiler/build_runner.zig:508:26: note: unsigned 32-bit int cannot represent all possible unsigned 64-bit values
referenced by:
    callMain [inlined]: lib/std/start.zig:699:88
    callMainWithArgs [inlined]: lib/std/start.zig:638:20
    posixCallMainAndExit: lib/std/start.zig:590:38
    2 reference(s) hidden; use '-freference-trace=5' to see all references
lib/std/Build/WebServer.zig:849:38: error: expected type 'usize', found 'u64'
    const buf = gpa.realloc(old_buf, new_len) catch @panic("out of memory");
                                     ^~~~~~~
lib/std/Build/WebServer.zig:849:38: note: unsigned 32-bit int cannot represent all possible unsigned 64-bit values
lib/std/mem/Allocator.zig:399:58: note: parameter type declared here
pub fn realloc(self: Allocator, old_mem: anytype, new_n: usize) Error!@TypeOf(old_mem) {
                                                         ^~~~~
build.zig:548:10: error: type 'usize' cannot represent integer value '9300000000'
        .max_rss = 9_300_000_000,
        ~^~~~~~~~~~~~~~~~~~~~~~~
build.zig:778:10: error: type 'usize' cannot represent integer value '8000000000'
        .max_rss = 8_000_000_000,
        ~^~~~~~~~~~~~~~~~~~~~~~~
2026-05-26 09:43:39 -07:00
Andrew Kelley 9eb85c4e5e build system: track TODOs outside source code
related to #363
2026-05-25 18:54:36 -07:00
Andrew Kelley ddabd57743 progress towards compiling zig's build script 2026-05-25 18:54:35 -07:00
Andrew Kelley dd51fc30f8 maker: finish migrating compile step make logic 2026-05-25 18:54:34 -07:00
Andrew Kelley 6b7ce1fa22 massage Step code into compiling 2026-05-25 18:54:34 -07:00
Andrew Kelley b3d162d6bf build maker: rename files to match type 2026-05-25 18:54:34 -07:00