[Bug 272508] lang/gcc12: use --enable-link-serialization to avoid memory crunch on multi-core systems

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 14 Jul 2023 20:25:03 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272508

            Bug ID: 272508
           Summary: lang/gcc12: use --enable-link-serialization to avoid
                    memory crunch on multi-core systems
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: salvadore@freebsd.org
          Reporter: nicholas.e.taylor@gmail.com
             Flags: maintainer-feedback?(salvadore@freebsd.org)
          Assignee: salvadore@freebsd.org

Created attachment 243396
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=243396&action=edit
Add SERIAL_LINK option

lang/gcc12, particularly with an LTO bootstrap, can use up a lot of memory on
multi-core systems.  A major contributor to the problem is that the slow,
memory-hungry LTO link jobs from multiple parallel compilations tend to occur
at the same time.

GCC 12 configure provides[1] an option, --enable-link-serialization, to set up
dependencies so that those link jobs will not occur in parallel.  I found that
enabling it on my 16-core system[2] let me build lang/gcc12 with LTO_BOOTSTRAP,
without any visits from the OOM reaper: a novel experience for me.

The attached patch adds a SERIAL_LINK option to lang/gcc12; when enabled, it
sets the --enable-link-serialization configure option.

I admit the audience of "Builds lang/gcc12 with LTO_BOOTSTRAP, too many cores,
and not enough RAM" is pretty niche, but perhaps this will help someone else.

[1] https://gcc.gnu.org/install/configure.html
[2] 16 GB RAM and 40 GB swap

-- 
You are receiving this mail because:
You are the assignee for the bug.