Skip to content

Commit 49d5ddd

Browse files
authored
Merge pull request #6 from sailfishos/aarch64-test
[rust] Limit memory usage for aarch64 builds. JB#50504
2 parents 6537186 + 120902c commit 49d5ddd

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

rust.spec

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@
55

66
%ifarch %ix86
77
%global rust_triple i686-unknown-linux-gnu
8+
%define xbuildjobs %{nil}
89
%else
910
%ifarch %{arm}
1011
%global rust_triple armv7-unknown-linux-gnueabihf
12+
%define xbuildjobs %{nil}
1113
%else
1214
%ifarch aarch64
1315
%global rust_triple aarch64-unknown-linux-gnu
16+
# Limit build jobs in order to not exhaust memory on builds. JB#50504
17+
%define xbuildjobs -j 4
1418
%endif
1519
%endif
1620
%endif
@@ -43,6 +47,7 @@ Patch3: 0003-Disable-statx-for-all-builds.-JB-50106.patch
4347
%global local_rust_root %{_builddir}/%{bootstrap_root}/usr
4448
%global bootstrap_source rust-%{rust_version}-%{rust_triple}.tar.gz
4549

50+
BuildRequires: ccache
4651
BuildRequires: make
4752
BuildRequires: cmake
4853
BuildRequires: gcc
@@ -226,9 +231,13 @@ export RUSTFLAGS="%{rustflags}"
226231

227232
# full debuginfo is exhausting memory; just do libstd for now
228233
# https://github.com/rust-lang/rust/issues/45854
229-
# %define enable_debuginfo --debuginfo-level=0 --debuginfo-level-std=2
230-
# %define enable_debuginfo --disable-debuginfo --disable-debuginfo-only-std --disable-debuginfo-tools --disable-debuginfo-lines
234+
# Limit memory usage for aarch64 build even more. JB#50504
235+
%ifarch aarch64
236+
%define enable_debuginfo --debuginfo-level=0 --debuginfo-level-rustc=0 --debuginfo-level-std=0 --debuginfo-level-tools=0 --debuginfo-level-tests=0
237+
%else
231238
%define enable_debuginfo --debuginfo-level=0 --debuginfo-level-std=2 --disable-debuginfo --disable-debuginfo-only-std --disable-debuginfo-tools --disable-debuginfo-lines
239+
%endif
240+
232241

233242
%configure --disable-option-checking \
234243
--libdir=%{common_libdir} \
@@ -237,19 +246,22 @@ export RUSTFLAGS="%{rustflags}"
237246
--local-rust-root=%{local_rust_root} \
238247
--enable-local-rebuild \
239248
--enable-llvm-link-shared \
249+
--enable-ccache \
240250
--enable-optimize \
241251
--disable-docs \
242252
--disable-compiler-docs \
253+
--disable-jemalloc \
243254
--disable-rpath \
244255
--disable-codegen-tests \
256+
--disable-verbose-tests \
245257
%{enable_debuginfo} \
246258
--enable-extended \
247259
--enable-vendor \
260+
--set rust.codegen-units-std=1 \
248261
--tools=cargo \
249-
--llvm-root=/usr/ \
250-
--enable-parallel-compiler
262+
--llvm-root=/usr/
251263

252-
%{python} ./x.py build
264+
%{python} ./x.py %{xbuildjobs} build
253265

254266

255267
%install

0 commit comments

Comments
 (0)