From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id C6222158232 for ; Sun, 8 Dec 2024 05:06:32 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9AA10E1259; Sun, 8 Dec 2024 05:06:29 +0000 (UTC) Received: from latitanza.investici.org (latitanza.investici.org [IPv6:2001:888:2000:56::19]) (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) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 563A5E123F for ; Sun, 8 Dec 2024 05:06:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inventati.org; s=stigmate; t=1733634386; bh=aCjKp+4FwyhWl70zwoRFbhqlyxGBkfA/vkBgb+Sykaw=; h=Date:From:To:Subject:References:In-Reply-To:From; b=Dq43ov72s4dtc94CwlVwtRbhSixZ6SFIi316+t/rXomLGLFWE18DxJBpVedDUQ43e co8M0yUqYn1dMHhRQM20H2jPhOlrpkuFfZw1qS6okKPOnfqdTD0x/5D9EWlpbVKvOr 5OcHjwTjxZsjGzVJ3w0LoJvH9SGCptjhWNSfmzN4= Received: from mx3.investici.org (unknown [127.0.0.1]) by latitanza.investici.org (Postfix) with ESMTP id 4Y5Xyp3TMKzGp4Y for ; Sun, 8 Dec 2024 05:06:26 +0000 (UTC) Date: Sun, 8 Dec 2024 00:06:22 -0500 From: Violet Purcell To: gentoo-dev@lists.gentoo.org Subject: Re: LLVM build strategy (was: Re: [gentoo-dev] [RFC] New categories for LLVM) Message-ID: References: <87f27044c599b4168d27d79367fd4b47575502c9.camel@gentoo.org> <87a5d6wza1.fsf@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87a5d6wza1.fsf@gentoo.org> X-Archives-Salt: 2030cfc6-8950-4acf-ac11-ab804cfea5ab X-Archives-Hash: cfda79152d22f6eb85e6906101dcfe15 On Sun, Dec 08, 2024 at 04:53:58AM +0000, Sam James wrote: > I fear this sort of assumes we won't switch to monobuild any time soon. > > I keep thinking [0] about how sustainable our current setup is: > * Fedora moved away from it for >=18 [1]. > * As we saw with offload, it broke a few times in just a week. So it's > only Gentoo who cares about this configuration AFAIK. > * It's not working great if we're already not able to easily package > mlir, flang, or polly. > > Violet attempted working on a merge before [2]. Hey! Thanks for bringing up my work on this. I've also been continuing this work in an overlay which I use myself on some of my machines: https://codeberg.org/vimproved/llvm-overlay. > IIRC, Violet ended up running into issues with getting the CMake to > properly handle both shared and static libraries to install with the > monobuild, so maybe LLVM's CMake is just broken in both directions and > we just have to pick whichever one is least-worst for us (which might be > the standalone builds as we do now)? LLVM's CMake is definitely just rather broken in many ways, yeah. The biggest issue I experienced when working on this was with LLD libraries. Currently, sys-devel/lld is built with -DBUILD_SHARED_LIBS=ON, which builds some LLD libraries used by e.g. zig as shared libraries. However, there's no way to do this in monobuild since passing -DBUILD_SHARED_LIBS=ON is not desirable. The solution I settled on was splitting a sys-libs/lld-libs package which builds LLD with -DBUILD_SHARED_LIBS=ON and then only installs the shared libraries. As for sys-libs/llvm-libs, this package is a result of me trying to figure out a way to have a statically linked system clang (for performance purposes) while still having LLVM functional as a library. After a lot of sifting through CMake spaghetti I settled on splitting the LLVM monobuild into two packages: sys-devel/llvm and sys-libs/llvm-libs. sys-devel/llvm installs the toolchain parts of LLVM (statically linked), and sys-libs/llvm-libs installs the library and CMake parts of LLVM. This overlay is just for my personal use, and I don't think the above package split would be viable for ::gentoo however. One more thing that wasn't mentioned here, LLVM monobuild would also potentially unblock PGO/BOLT optimizations for clang, so overall it could have some pretty good speed improvements for system LLVM toolchain users. - Violet