From 750761991dc0895d6a9c16817feeb3beddb162c9 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 4 Aug 2025 23:23:35 -0400 Subject: [PATCH] BLD: Pass auto to -flto with gcc to parallelize LTO build on linux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently when building CPython with loto (./configure --with-lto) on linux with gcc gives a number of similar warnings: lto-wrapper: warning: using serial compilation of 70 LTRANS jobs lto-wrapper: note: see the ‘-flto’ option documentation for more information To fix this pass the -flot=auto to allow gcc to run the lto jobs in parallel. If no value is passed the default in 1 at a time. The ability to pass auto goes back goc at least gcc 10 [1]. A similar change can be made on Darwin, but did not make that change without testing. This significantly speeds up the build process when using lto (dependent on the number of cores available). [1] https://gcc.gnu.org/onlinedocs/gcc-10.1.0/gcc/Optimize-Options.html --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 74df430d10d6bd..bf4c377f899650 100755 --- a/configure +++ b/configure @@ -8863,7 +8863,7 @@ fi LTOCFLAGS="-flto" ;; *) - LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects" + LTOFLAGS="-flto=auto -fuse-linker-plugin -ffat-lto-objects" ;; esac ;;