From nobody Wed Oct 25 10:32:05 2023 X-Original-To: ports@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SFlbv39jVz4yKmX for ; Wed, 25 Oct 2023 10:32:11 +0000 (UTC) (envelope-from void@f-m.fm) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4SFlbt3cRYz3StN for ; Wed, 25 Oct 2023 10:32:10 +0000 (UTC) (envelope-from void@f-m.fm) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=f-m.fm header.s=fm3 header.b=QIsE3yAQ; dkim=pass header.d=messagingengine.com header.s=fm3 header.b=gNKQdl8e; spf=pass (mx1.freebsd.org: domain of void@f-m.fm designates 66.111.4.27 as permitted sender) smtp.mailfrom=void@f-m.fm; dmarc=pass (policy=none) header.from=f-m.fm Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 492345C02CF for ; Wed, 25 Oct 2023 06:32:09 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 25 Oct 2023 06:32:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=f-m.fm; h=cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1698229929; x=1698316329; bh=bK Hv4BQffYNn8bBsLxmJ18aYLdwY8S+x5pSBAAYFzEc=; b=QIsE3yAQN0eZGXaadH k2C2onvSEF+FrLf8OewQtCsr6Sf2g27csP+N9cXwvFQJHX3ouQIiJvjydjCw/10l SJznx0FjZbrRJthCldGl8w9A8+i5crvK1ODmRHgMLaSU9TqdUK6SHtI1kLzuRRxQ bm8e2DGeUFVVi5jqxl7d7a6cgdskvuk5SLNEq2iVMRyS0rmwVh0+O2PW6zM76xdB Ys2FW9W9BJtcAs33Ztk4ITEEfjtXpjGfntNl/wPRRfhrfmMRcEbIuJMXJuX7Ti5c qmTWH6TOsQMB0oKR/zRMntojp80KgJoxYrd2Ck9L2xvqadSibTPCgEfL/blrtqn3 SU3g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1698229929; x=1698316329; bh=bKHv4BQffYNn8 bBsLxmJ18aYLdwY8S+x5pSBAAYFzEc=; b=gNKQdl8eovayltEH7t7VjR9zp5Kxu MzgjM4mo6KsstMw+rNZ+cb5mIM1j9yOx/3YZGtzCVkIa2pHSSTpiLb8hL3Amhvmw /bFoGFR+YZJLSOGUUVUyek+EVyHXcRic4xC4HhxNU7SgvGEXabtkl1jx1JlII07a ZBd3OskG9NWK8S3EOYvFg3XnuBnFydRLmzpvVRGd2YjqRDVQHw2XkuuPNKHHm4B+ MZDB8/SzQW25YXDtTeBIgG2ti7nTEgTGHf4Mb/y5RjaIcEI+HDWqFsr3blJu3BRa GA/JVcsv563lZG20H0wrco61tt1TkHMxH8eydY+OTfC/eKVrYxRFO/ekQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrledtgddvlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfhfgggtuggjsehttdertd dttddvnecuhfhrohhmpehvohhiugcuoehvohhiugesfhdqmhdrfhhmqeenucggtffrrght thgvrhhnpeekleduvdelhfeileefgffghfffkedtheellefgudfgvdegkeejjedutdehhe fgueenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehv ohhiugesfhdqmhdrfhhm X-ME-Proxy: Feedback-ID: i2541463c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 25 Oct 2023 06:32:08 -0400 (EDT) Date: Wed, 25 Oct 2023 11:32:05 +0100 From: void To: ports@freebsd.org Subject: Re: Rust build huge memory consumption Message-ID: References: <09a4bfb8-ba61-4e05-b646-973104337f77@groumpf.org> List-Id: Porting software to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-ports List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-ports@freebsd.org X-BeenThere: freebsd-ports@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <09a4bfb8-ba61-4e05-b646-973104337f77@groumpf.org> X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.75 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DWL_DNSWL_LOW(-1.00)[messagingengine.com:dkim]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_NOT_FQDN(0.50)[]; DMARC_POLICY_ALLOW(-0.50)[f-m.fm,none]; R_SPF_ALLOW(-0.20)[+ip4:66.111.4.27]; R_DKIM_ALLOW(-0.20)[f-m.fm:s=fm3,messagingengine.com:s=fm3]; NEURAL_HAM_SHORT(-0.15)[-0.151]; MIME_GOOD(-0.10)[text/plain]; RCVD_IN_DNSWL_LOW(-0.10)[66.111.4.27:from]; RCPT_COUNT_ONE(0.00)[1]; PREVIOUSLY_DELIVERED(0.00)[ports@freebsd.org]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:19151, ipnet:66.111.4.0/24, country:US]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_NONE(0.00)[]; FREEMAIL_FROM(0.00)[f-m.fm]; MLMMJ_DEST(0.00)[ports@freebsd.org]; DKIM_TRACE(0.00)[f-m.fm:+,messagingengine.com:+]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; FREEMAIL_ENVFROM(0.00)[f-m.fm]; RCVD_VIA_SMTP_AUTH(0.00)[] X-Rspamd-Queue-Id: 4SFlbt3cRYz3StN Hi, On Wed, Oct 25, 2023 at 08:38:54AM +0200, Xavier Humbert wrote: >Hi, > >When building rust, all memory is eaten, leading to OOM killing almost >everything, eventually failing, and leading to an unstable system. > >Is there a way to tell the compiler to avoid this behaviour ? Are you building just from the ports tree or are you using poudriere? if the former, try unsetting LTO in /etc/make.conf and if you have a MAKE_JOBS statement in there, comment it out. Try installing devel/sccache before your build. Ensure that ccache is installed too. pay attention to the pkg-message after install. If you're using poudriere, the following settings are relevant: 1. make sure you have ports-mgmt/sccache-overlay installed. 2. in the make.conf for the poudriere jail, have these set: SCCACHE_DIR=/var/cache/ccache/sccache OVERLAYS+=/usr/local/share/sccache/overlay WITH_CCACHE_BUILD= CCACHE_DIR=/var/cache/ccache 3. also make sure devel/ccache-static (it *has* to be the -static variant) is installed. To use the sscache overlay, invoke the poudriere build with -O sccache after installing as per the instructions. On a rpi4b/8GB (therefore relatively resource constrained) running 14-stable and poudriere-devel, it has the following settings (relevant to this discussion) in poudriere.conf USE_TMPFS=all TMPFS_BLACKLIST="rust* llvm* libreo* firef* tex* ungoogled-ch* chromi* gcc* openjdk* electron* iridium" MAX_FILES=4096 PARALLEL_JOBS=1 PREPARE_PARALLEL_JOBS=2 The following tunables are set in /etc/sysctl.conf # filesystem vm.pageout_oom_seq=120 vm.pfault_oom_attempts=-1 vm.pageout_update_period=0 vfs.zfs.arc.min=536870912 vfs.zfs.arc.max=1073741824 The rpi is clocked to 2.1GHz. It took 9hrs 3 mins to build rust-1.73.0 good luck, --