Subject: Re: bug#53506: guix-packages-base.drv leads to segfault on i686-linux

From: Ludovic Courtès <[email-masked]>
Date: Mon, 24 Jan 2022 18:15:09 +0100

Ludovic Courtès <[email-masked]> skribis:

> ‘guix-packages-base.drv’ fails to build due to a Guile segfault (!):
>
> [653/656] compiling...	 99.1% of 328 files[654/656] compiling...	 99.4% of 328 files[655/656] compiling...	 99.7% of 328 filesGC Warning: Failed to expand heap by 8388608 bytes
> GC Warning: Failed to expand heap by 8388608 bytes
> GC Warning: Failed to expand heap by 8388608 bytes
>
> [...]
>
> GC Warning: Failed to expand heap by 8388608 bytes
> GC Warning: Failed to expand heap by 8388608 bytes
> builder for `/gnu/store/cnrmdbcyy8r9bs2gl2kgpnyplivrzf5c-guix-packages-base.drv' failed due to signal 11 (Segmentation fault)
> @ build-failed /gnu/store/cnrmdbcyy8r9bs2gl2kgpnyplivrzf5c-guix-packages-base.drv - 1 builder for `/gnu/store/cnrmdbcyy8r9bs2gl2kgpnyplivrzf5c-guix-packages-base.drv' failed due to signal 11 (Segmentation fault)

On closer inspection, this is caused by OOM, with Guile peaking at 2.8G
resident (!) at that point, more than on x86_64.

I’m quite sure this is because the compiler resorts to bignums more than
on x86_64 (fixnums are smaller), thereby consuming more heap.

Splitting creates-io.scm into two files might work as a temporary
workaround since the compiler creates a number of labels (integers)
roughly proportional to the number of lines in the file:

--8<---------------cut here---------------start------------->8---
$ wc -l gnu/packages/*.scm|sort -k1 -n |tail
   13977 gnu/packages/java.scm
   15275 gnu/packages/bioconductor.scm
   15929 gnu/packages/bioinformatics.scm
   16086 gnu/packages/haskell-xyz.scm
   20378 gnu/packages/lisp-xyz.scm
   28770 gnu/packages/python-xyz.scm
   29960 gnu/packages/emacs-xyz.scm
   32071 gnu/packages/cran.scm
   70442 gnu/packages/crates-io.scm
  690662 totalo
--8<---------------cut here---------------end--------------->8---

Background:

  https://lists.gnu.org/archive/html/guile-devel/2017-10/msg00035.html
  https://lists.gnu.org/archive/html/guile-devel/2020-02/msg00023.html
  https://wingolog.org/archives/2020/06/03/a-baseline-compiler-for-guile

Ludo’.