Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rqvKU-00EhyH-Nf for pgsql-hackers@arkaria.postgresql.org; Sun, 31 Mar 2024 13:34:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rqvKT-00CaBN-I0 for pgsql-hackers@arkaria.postgresql.org; Sun, 31 Mar 2024 13:34:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rqvKT-00CaB5-71 for pgsql-hackers@lists.postgresql.org; Sun, 31 Mar 2024 13:34:33 +0000 Received: from dd25110.kasserver.com ([85.13.146.49]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rqvKL-007oUG-Or for pgsql-hackers@postgresql.org; Sun, 31 Mar 2024 13:34:32 +0000 Received: from [192.168.0.101] (ip-037-201-153-175.um10.pools.vodafone-ip.de [37.201.153.175]) by dd25110.kasserver.com (Postfix) with ESMTPSA id 3EDA2E1A0154; Sun, 31 Mar 2024 15:34:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=technowledgy.de; s=kas202308201259; t=1711892064; bh=JDu6tM6nQq3+S1+gSSbMEmo0NtUW1tQwG0oza/I1dLs=; h=Date:From:Subject:To:References:Cc:In-Reply-To:From; b=pIStzTa6O0IhNq6ipMQtR4V51dKpGUiIPiU9ywKvn/MHu+L0DF8SrVWM1olVs9YR3 6KmhXI1U+/IhQzXYHiBe8TEZoLAL4J30GoRHWwEGgNFfALsjWos5+TxT3y8UeQsSBV plafxekxJKBUHXX2USRYnln5q4QBZOaOGjxH5IkwWrfKIvQMbsWgszGnc9j8xsh1Rq 1X2XLYMYs+5Exme3Ogw7koNGC/jlLYMM7mkXa3SGKf103X9ZoExDh3LXfSZRQRmtqX uOHehWccinZaI9G5/WHrRmKQVHtoJzWSNk7YKgMgdGMoFkaovkZ1WJKsnlNSfHczWo Iz6/RpKrSzHiA== Content-Type: multipart/mixed; boundary="------------cOsTK4bKWYzNi3e9tfgwckEg" Message-ID: Date: Sun, 31 Mar 2024 15:34:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: walther@technowledgy.de Subject: Re: Building with musl in CI and the build farm Content-Language: en-US To: Andres Freund References: <4093813.1710899588@sss.pgh.pa.us> <4095435.1710900216@sss.pgh.pa.us> <477fa513-6bf0-456d-8d24-1e22a19df671@technowledgy.de> <20240322001948.atp2eetusylgjyw2@awork3.anarazel.de> <40543180-a0a2-495b-8d34-23b46c28f533@technowledgy.de> <20240326001447.wcatfvx45tkmizji@awork3.anarazel.de> <0a48d551-50e1-4bd3-8d46-8421e3b1b724@technowledgy.de> Cc: PostgreSQL-development In-Reply-To: <0a48d551-50e1-4bd3-8d46-8421e3b1b724@technowledgy.de> X-Spamd-Bar: - List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------cOsTK4bKWYzNi3e9tfgwckEg Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit About building one of the CI tasks with musl: Andres Freund: > I'd rather adapt one of the existing tasks, to avoid increasing CI costs unduly. I looked into this and I think the only task that could be changed is the SanityCheck. This is because this builds without any additional features enabled. I guess that makes sense, because otherwise those dependencies would first have to be built with musl-gcc as well. > FWIW, except for one small issue, building postgres against musl works on debian and the tests pass if I install first. After the fix for LD_LIBRARY_PATH this now works as expected without installing first. I confirmed it works on debian with CC=musl-gcc. > The small problem mentioned above is that on debian linux/fs.h isn't available > when building with musl, which in turn causes src/bin/pg_upgrade/file.c to > fail to compile. According to [1], this can be worked around by linking some folders: ln -s /usr/include/linux /usr/include/x86_64-linux-musl/ ln -s /usr/include/asm-generic /usr/include/x86_64-linux-musl/ ln -s /usr/include/x86_64-linux-gnu/asm /usr/include/x86_64-linux-musl/ Please find a patch to use musl-gcc in SanityCheck attached. Logs from the CI run are in [2]. It has this in the configure phase: [13:19:52.712] Using 'CC' from environment with value: 'ccache musl-gcc' [13:19:52.712] C compiler for the host machine: ccache musl-gcc (gcc 10.2.1 "cc (Debian 10.2.1-6) 10.2.1 20210110") [13:19:52.712] C linker for the host machine: musl-gcc ld.bfd 2.35.2 [13:19:52.712] Using 'CC' from environment with value: 'ccache musl-gcc' So meson picks up musl-gcc properly. I also double checked that without the links above, the build does indeed fail with the linux/fs.h error. I assume the installation of musl-tools should be done in the pg-vm-images repo instead of the additional script here? Best, Wolfgang [1]: https://debian-bugs-dist.debian.narkive.com/VlFkLigg/bug-789789-musl-fails-to-compile-stuff-that-depends-on-kernel-headers [2]: https://cirrus-ci.com/task/5741892590108672 --------------cOsTK4bKWYzNi3e9tfgwckEg Content-Type: text/x-patch; charset=UTF-8; name="0001-Build-SanityCheck-against-musl.patch" Content-Disposition: attachment; filename="0001-Build-SanityCheck-against-musl.patch" Content-Transfer-Encoding: base64 RnJvbSA0YTY5ZDk4NTFlN2JiZDdjZDUyMWQyMzY4NDdhZjllYmY1ZTYyNTNiIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBXb2xmZ2FuZyBXYWx0aGVyIDx3YWx0aGVyQHRlY2hu b3dsZWRneS5kZT4KRGF0ZTogU3VuLCAzMSBNYXIgMjAyNCAxNToxNzo0MyArMDIwMApTdWJq ZWN0OiBbUEFUQ0hdIEJ1aWxkIFNhbml0eUNoZWNrIGFnYWluc3QgbXVzbAoKLS0tCiAuY2ly cnVzLnRhc2tzLnltbCB8IDkgKysrKysrKysrCiAxIGZpbGUgY2hhbmdlZCwgOSBpbnNlcnRp b25zKCspCgpkaWZmIC0t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