[bug#77431] gnu: zig: Set rss_max to unlimited

Message ID 20250401083336.27759-1-tommy.langhelle@tv2.no
State New
Headers
Series [bug#77431] gnu: zig: Set rss_max to unlimited |

Commit Message

Tommy Langhelle April 1, 2025, 8:33 a.m. UTC
Upstream sets this for CI purposes, but it fails my ARM builds. The
limit itself doesn't make too much sense as long as zig builds and the
build host is big enough, so simply allowing unlimited rss should be
fine.

* gnu/packages/patches/zig-0.14-set-max_rss-to-unlimited-for-building-zig.patch: New file.
* gnu/packages/zig.scm (zig-0.14)[source]: Add patch.
* gnu/local.mk (dist_patch_DATA): Register it.
---
 gnu/local.mk                                  |  1 +
 ...ax_rss-to-unlimited-for-building-zig.patch | 31 +++++++++++++++++++
 gnu/packages/zig.scm                          |  3 +-
 3 files changed, 34 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/zig-0.14-set-max_rss-to-unlimited-for-building-zig.patch


base-commit: e7aeec67feaa5cf888f0aae14400fc015390aa8e
  

Comments

Hilton Chain April 1, 2025, 3:25 p.m. UTC | #1
Hi Tommy,

On Tue, 01 Apr 2025 16:33:36 +0800,
Tommy Langhelle wrote:
>
> Upstream sets this for CI purposes, but it fails my ARM builds. The
> limit itself doesn't make too much sense as long as zig builds and the
> build host is big enough, so simply allowing unlimited rss should be
> fine.

Can you share build log for your failed build?

> * gnu/packages/patches/zig-0.14-set-max_rss-to-unlimited-for-building-zig.patch: New file.
> * gnu/packages/zig.scm (zig-0.14)[source]: Add patch.
> * gnu/local.mk (dist_patch_DATA): Register it.
> ---
> [...]
> diff --git a/gnu/packages/patches/zig-0.14-set-max_rss-to-unlimited-for-building-zig.patch b/gnu/packages/patches/zig-0.14-set-max_rss-to-unlimited-for-building-zig.patch
> new file mode 100644
> index 0000000000..d944827353
> --- /dev/null
> +++ b/gnu/packages/patches/zig-0.14-set-max_rss-to-unlimited-for-building-zig.patch
> @@ -0,0 +1,31 @@
> +From 408722e084edf0a86066344e29bdfced70679129 Mon Sep 17 00:00:00 2001
> +From: Tommy Langhelle <tomlanghe@gmail.com>
> +Date: Mon, 31 Mar 2025 11:47:12 +0200
> +Subject: [PATCH] Set max_rss to unlimited for building zig
> +
> +https://github.com/ziglang/zig/issues/18263
> +
> +Upstream sets this for CI purposes, but it fails my ARM builds. The
> +limit itself doesn't make too much sense as long as zig builds and the
> +build host is big enough, so simply allowing unlimited rss should be
> +fine.
> +---
> + build.zig | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/build.zig b/build.zig
> +index 375cb6df09..16862fc5f9 100644
> +--- a/build.zig
> ++++ b/build.zig
> +@@ -703,7 +703,7 @@ fn addCompilerStep(b: *std.Build, options: AddCompilerStepOptions) *std.Build.St
> +
> +     const exe = b.addExecutable(.{
> +         .name = "zig",
> +-        .max_rss = 7_800_000_000,
> ++        .max_rss = 0,
> +         .root_module = compiler_mod,
> +     });
> +     exe.stack_size = stack_size;
> +--
> +2.41.0

For this change a snippet should be sufficient.  Can you turn this patch into a
snippet and send an updated revision?

Thanks
  
Tommy Langhelle April 4, 2025, 11:39 a.m. UTC | #2
Sure! Here is the relevant section of the log:


[ 73%] Running zig1.wasm to produce
/tmp/guix-build-zig-0.14.0.drv-0/source/zig2.c

[ 78%] Running zig1.wasm to produce
/tmp/guix-build-zig-0.14.0.drv-0/source/compiler_rt.c

/tmp/guix-build-zig-0.14.0.drv-0/source/zig1
/tmp/guix-build-zig-0.14.0.drv-0/source/lib build-exe -ofmt=c -lc
-OReleaseSmall --name zig2
-femit-bin="/tmp/guix-build-zig-0.14.0.drv-0/source/zig2.c" -target
aarch64-linux-gnu --dep build_options --dep aro -Mroot=src/main.zig
-Mbuild_options=/tmp/guix-build-zig-0.14.0.drv-0/source/config.zig
-Maro=lib/compiler/aro/aro.zig

/tmp/guix-build-zig-0.14.0.drv-0/source/zig1
/tmp/guix-build-zig-0.14.0.drv-0/source/lib build-obj -ofmt=c
-OReleaseSmall --name compiler_rt
-femit-bin="/tmp/guix-build-zig-0.14.0.drv-0/source/compiler_rt.c" -target
aarch64-linux-gnu -Mroot=lib/compiler_rt.zig

cd /tmp/guix-build-zig-0.14.0.drv-0/source &&
/gnu/store/1mjsh0bmxpr1ivvwagyjv0plk066b211-cmake-minimal-3.24.2/bin/cmake
-E cmake_depends "Unix Makefiles" /tmp/guix-build-zig-0.14.0.drv-0/source
/tmp/guix-build-zig-0.14.0.drv-0/source
/tmp/guix-build-zig-0.14.0.drv-0/source
/tmp/guix-build-zig-0.14.0.drv-0/source
/tmp/guix-build-zig-0.14.0.drv-0/source/CMakeFiles/zig2.dir/DependInfo.cmake
--color=

make[2]: Leaving directory '/tmp/guix-build-zig-0.14.0.drv-0/source'

make  -f CMakeFiles/zig2.dir/build.make CMakeFiles/zig2.dir/build

make[2]: Entering directory '/tmp/guix-build-zig-0.14.0.drv-0/source'

[ 89%] Building C object CMakeFiles/zig2.dir/compiler_rt.c.o

[ 89%] Building C object CMakeFiles/zig2.dir/zig2.c.o

/gnu/store/zcvhj876402zaz3cd2j6s2k4y4fnzdf7-gcc-11.4.0/bin/gcc
-D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
-D__STDC_LIMIT_MACROS -I/tmp/guix-build-zig-0.14.0.drv-0/source/stage1 -O2
-g -DNDEBUG -std=c99 -O0 -fno-stack-protector -MD -MT
CMakeFiles/zig2.dir/zig2.c.o -MF CMakeFiles/zig2.dir/zig2.c.o.d -o
CMakeFiles/zig2.dir/zig2.c.o -c
/tmp/guix-build-zig-0.14.0.drv-0/source/zig2.c

/gnu/store/zcvhj876402zaz3cd2j6s2k4y4fnzdf7-gcc-11.4.0/bin/gcc
-D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
-D__STDC_LIMIT_MACROS -I/tmp/guix-build-zig-0.14.0.drv-0/source/stage1 -O2
-g -DNDEBUG -std=c99 -O0 -fno-stack-protector -MD -MT
CMakeFiles/zig2.dir/compiler_rt.c.o -MF
CMakeFiles/zig2.dir/compiler_rt.c.o.d -o
CMakeFiles/zig2.dir/compiler_rt.c.o -c
/tmp/guix-build-zig-0.14.0.drv-0/source/compiler_rt.c

[ 94%] Linking CXX executable zig2

/gnu/store/1mjsh0bmxpr1ivvwagyjv0plk066b211-cmake-minimal-3.24.2/bin/cmake
-E cmake_link_script CMakeFiles/zig2.dir/link.txt --verbose=1

/gnu/store/zcvhj876402zaz3cd2j6s2k4y4fnzdf7-gcc-11.4.0/bin/c++ -O2 -g
-DNDEBUG -Wl,-z,stack-size=0x10000000 CMakeFiles/zig2.dir/zig2.c.o
CMakeFiles/zig2.dir/compiler_rt.c.o -o zig2  zigcpp/libzigcpp.a
/gnu/store/700f3b2d6m77xsxpp8dqjv2f4fif723z-clang-19.1.7/lib/libclang-cpp.so.19.1
/gnu/store/0ca4w71pz4dmfikzwb5j3qly3gbikjld-lld-19.1.7/lib/liblldMinGW.a
/gnu/store/0ca4w71pz4dmfikzwb5j3qly3gbikjld-lld-19.1.7/lib/liblldELF.a
/gnu/store/0ca4w71pz4dmfikzwb5j3qly3gbikjld-lld-19.1.7/lib/liblldCOFF.a
/gnu/store/0ca4w71pz4dmfikzwb5j3qly3gbikjld-lld-19.1.7/lib/liblldWasm.a
/gnu/store/0ca4w71pz4dmfikzwb5j3qly3gbikjld-lld-19.1.7/lib/liblldMachO.a
/gnu/store/0ca4w71pz4dmfikzwb5j3qly3gbikjld-lld-19.1.7/lib/liblldCommon.a
/gnu/store/rq7nyisff6cz7ysbrkcyfqnglzyzk1d8-llvm-19.1.7/lib/libLLVM-19.so
-lrt -ldl -lm -lz

make[2]: Leaving directory '/tmp/guix-build-zig-0.14.0.drv-0/source'

[ 94%] Built target zig2

make  -f CMakeFiles/stage3.dir/build.make CMakeFiles/stage3.dir/depend

make[2]: Entering directory '/tmp/guix-build-zig-0.14.0.drv-0/source'

cd /tmp/guix-build-zig-0.14.0.drv-0/source &&
/gnu/store/1mjsh0bmxpr1ivvwagyjv0plk066b211-cmake-minimal-3.24.2/bin/cmake
-E cmake_depends "Unix Makefiles" /tmp/guix-build-zig-0.14.0.drv-0/source
/tmp/guix-build-zig-0.14.0.drv-0/source
/tmp/guix-build-zig-0.14.0.drv-0/source
/tmp/guix-build-zig-0.14.0.drv-0/source
/tmp/guix-build-zig-0.14.0.drv-0/source/CMakeFiles/stage3.dir/DependInfo.cmake
--color=

make[2]: Leaving directory '/tmp/guix-build-zig-0.14.0.drv-0/source'

make  -f CMakeFiles/stage3.dir/build.make CMakeFiles/stage3.dir/build

make[2]: Entering directory '/tmp/guix-build-zig-0.14.0.drv-0/source'

[100%] Building stage3

/tmp/guix-build-zig-0.14.0.drv-0/source/zig2 build --prefix
/tmp/guix-build-zig-0.14.0.drv-0/source/stage3 --zig-lib-dir
/tmp/guix-build-zig-0.14.0.drv-0/source/lib -Dversion-string=0.14.0
-Dtarget=aarch64-linux-gnu -Dcpu=baseline -Denable-llvm
-Dconfig_h=/tmp/guix-build-zig-0.14.0.drv-0/source/config.h -Dno-langref
-Doptimize=ReleaseFast

install

+- install zig

   +- zig build-exe zig ReleaseFast aarch64-linux-gnu failure

error: memory usage peaked at 8708960256 bytes, exceeding the declared
upper bound of 7800000000

Build Summary: 2/5 steps succeeded; 1 failed

install transitive failure

+- install zig transitive failure

   +- zig build-exe zig ReleaseFast aarch64-linux-gnu failure

error: the following build command failed with exit code 1:

/tmp/zig-cache/o/ba585b8503da6c37d6ae47a94f10099d/build
/tmp/guix-build-zig-0.14.0.drv-0/source/zig2
/tmp/guix-build-zig-0.14.0.drv-0/source/lib
/tmp/guix-build-zig-0.14.0.drv-0/source /tmp/zig-cache /tmp/zig-cache
--seed 0x8ea5a1a -Zb5c4d8b9dc38645c --prefix
/tmp/guix-build-zig-0.14.0.drv-0/source/stage3 -Dversion-string=0.14.0
-Dtarget=aarch64-linux-gnu -Dcpu=baseline -Denable-llvm
-Dconfig_h=/tmp/guix-build-zig-0.14.0.drv-0/source/config.h -Dno-langref
-Doptimize=ReleaseFast

make[2]: *** [CMakeFiles/stage3.dir/build.make:76: stage3/bin/zig] Error 1

make[2]: Leaving directory '/tmp/guix-build-zig-0.14.0.drv-0/source'

make[1]: *** [CMakeFiles/Makefile2:199: CMakeFiles/stage3.dir/all] Error 2

make[1]: Leaving directory '/tmp/guix-build-zig-0.14.0.drv-0/source'

make: *** [Makefile:139: all] Error 2

error: in phase 'build': uncaught exception:

%exception #<&invoke-error program: "make" arguments: ("-j" "4")
exit-status: 2 term-signal: #f stop-signal: #f>

phase `build' failed after 1007.4 seconds

command "make" "-j" "4" failed with status 2

build process 6 exited with status 256


The critical output is this:

error: memory usage peaked at 8708960256 bytes, exceeding the declared
upper bound of 7800000000



I've got the full log if you want it, but this should be enough.


tir. 1. apr. 2025 kl. 17:25 skrev Hilton Chain <hako@ultrarare.space>:

> Hi Tommy,
>
> On Tue, 01 Apr 2025 16:33:36 +0800,
> Tommy Langhelle wrote:
> >
> > Upstream sets this for CI purposes, but it fails my ARM builds. The
> > limit itself doesn't make too much sense as long as zig builds and the
> > build host is big enough, so simply allowing unlimited rss should be
> > fine.
>
> Can you share build log for your failed build?
>
> > *
> gnu/packages/patches/zig-0.14-set-max_rss-to-unlimited-for-building-zig.patch:
> New file.
> > * gnu/packages/zig.scm (zig-0.14)[source]: Add patch.
> > * gnu/local.mk (dist_patch_DATA): Register it.
> > ---
> > [...]
> > diff --git
> a/gnu/packages/patches/zig-0.14-set-max_rss-to-unlimited-for-building-zig.patch
> b/gnu/packages/patches/zig-0.14-set-max_rss-to-unlimited-for-building-zig.patch
> > new file mode 100644
> > index 0000000000..d944827353
> > --- /dev/null
> > +++
> b/gnu/packages/patches/zig-0.14-set-max_rss-to-unlimited-for-building-zig.patch
> > @@ -0,0 +1,31 @@
> > +From 408722e084edf0a86066344e29bdfced70679129 Mon Sep 17 00:00:00 2001
> > +From: Tommy Langhelle <tomlanghe@gmail.com>
> > +Date: Mon, 31 Mar 2025 11:47:12 +0200
> > +Subject: [PATCH] Set max_rss to unlimited for building zig
> > +
> > +https://github.com/ziglang/zig/issues/18263
> > +
> > +Upstream sets this for CI purposes, but it fails my ARM builds. The
> > +limit itself doesn't make too much sense as long as zig builds and the
> > +build host is big enough, so simply allowing unlimited rss should be
> > +fine.
> > +---
> > + build.zig | 2 +-
> > + 1 file changed, 1 insertion(+), 1 deletion(-)
> > +
> > +diff --git a/build.zig b/build.zig
> > +index 375cb6df09..16862fc5f9 100644
> > +--- a/build.zig
> > ++++ b/build.zig
> > +@@ -703,7 +703,7 @@ fn addCompilerStep(b: *std.Build, options:
> AddCompilerStepOptions) *std.Build.St
> > +
> > +     const exe = b.addExecutable(.{
> > +         .name = "zig",
> > +-        .max_rss = 7_800_000_000,
> > ++        .max_rss = 0,
> > +         .root_module = compiler_mod,
> > +     });
> > +     exe.stack_size = stack_size;
> > +--
> > +2.41.0
>
> For this change a snippet should be sufficient.  Can you turn this patch
> into a
> snippet and send an updated revision?
>
> Thanks
>
  

Patch

diff --git a/gnu/local.mk b/gnu/local.mk
index f03fcb14fc..63e87a232e 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2473,6 +2473,7 @@  dist_patch_DATA =						\
   %D%/packages/patches/zig-0.14-fix-runpath.patch		\
   %D%/packages/patches/zig-0.14-use-baseline-cpu-by-default.patch	\
   %D%/packages/patches/zig-0.14-use-system-paths.patch		\
+  %D%/packages/patches/zig-0.14-set-max_rss-to-unlimited-for-building-zig.patch		\
   %D%/packages/patches/zsh-egrep-failing-test.patch		\
   %D%/packages/patches/zuo-bin-sh.patch
 
diff --git a/gnu/packages/patches/zig-0.14-set-max_rss-to-unlimited-for-building-zig.patch b/gnu/packages/patches/zig-0.14-set-max_rss-to-unlimited-for-building-zig.patch
new file mode 100644
index 0000000000..d944827353
--- /dev/null
+++ b/gnu/packages/patches/zig-0.14-set-max_rss-to-unlimited-for-building-zig.patch
@@ -0,0 +1,31 @@ 
+From 408722e084edf0a86066344e29bdfced70679129 Mon Sep 17 00:00:00 2001
+From: Tommy Langhelle <tomlanghe@gmail.com>
+Date: Mon, 31 Mar 2025 11:47:12 +0200
+Subject: [PATCH] Set max_rss to unlimited for building zig
+
+https://github.com/ziglang/zig/issues/18263
+
+Upstream sets this for CI purposes, but it fails my ARM builds. The
+limit itself doesn't make too much sense as long as zig builds and the
+build host is big enough, so simply allowing unlimited rss should be
+fine.
+---
+ build.zig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/build.zig b/build.zig
+index 375cb6df09..16862fc5f9 100644
+--- a/build.zig
++++ b/build.zig
+@@ -703,7 +703,7 @@ fn addCompilerStep(b: *std.Build, options: AddCompilerStepOptions) *std.Build.St
+ 
+     const exe = b.addExecutable(.{
+         .name = "zig",
+-        .max_rss = 7_800_000_000,
++        .max_rss = 0,
+         .root_module = compiler_mod,
+     });
+     exe.stack_size = stack_size;
+-- 
+2.41.0
+
diff --git a/gnu/packages/zig.scm b/gnu/packages/zig.scm
index 733251242e..eb7bda8c62 100644
--- a/gnu/packages/zig.scm
+++ b/gnu/packages/zig.scm
@@ -1871,7 +1871,8 @@  (define-public zig-0.14
         (search-patches
          "zig-0.14-use-baseline-cpu-by-default.patch"
          "zig-0.14-use-system-paths.patch"
-         "zig-0.14-fix-runpath.patch"))))
+         "zig-0.14-fix-runpath.patch"
+         "zig-0.14-set-max_rss-to-unlimited-for-building-zig.patch"))))
     (inputs
      (modify-inputs (package-inputs zig-0.13)
        (replace "clang" clang-19)