Bug#1082360: llvm-toolchain-19: Ensure that at least 1 CPU is used for build

Santiago Vila sanvila at debian.org
Fri Sep 20 11:47:39 BST 2024


Package: src:llvm-toolchain-19
Version: 1:19.1.0-3

Hello. The attached patch, already accepted for llvm-toolchain-17,
ensures that:

- At least 1 CPU is used for building (without the patch, the result of
the calculation may yield 0 CPUs to be used).
- No more than $(nproc) CPUs are used for building.

Thanks.
-------------- next part --------------
--- a/debian/rules
+++ b/debian/rules
@@ -83,7 +83,7 @@ else
 endif
 NJOBS := $(shell mt=`awk '/^(MemAvail|SwapFree)/ { mt += $$2 } END {print mt}' /proc/meminfo`; \
 		awk -vn=$(NCPUS) -vmt=$$mt -vm=$(MEM_PER_CPU) \
-		  'END { mt/=1024; n2 = int(mt/m); print n==1 ? 1 : n2<n+1 ? n2 : n+1}' < /dev/null)
+		  'END { mt/=1024; n2 = int(mt/m); print n==1 || n2<=1 ? 1 : n2<=n ? n2 : n }' < /dev/null)
 
 TIME_COMMAND = $(CURDIR)/debian/usage-wrapper.py $(SUMMARY_ONLY) -j $(NJOBS) --base-memory -m 4.0 -o usage-$(notdir $@)-$(DEB_HOST_ARCH).svg
 TIME_BIN := $(if $(wildcard /usr/bin/time),/usr/bin/time,/bin/time)


More information about the Pkg-llvm-team mailing list