From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 17 11:22:24 2023 Received: (at submit) by debbugs.gnu.org; 17 Sep 2023 15:22:24 +0000 Received: from localhost ([127.0.0.1]:51179 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhtbL-0000fO-SW for submit@debbugs.gnu.org; Sun, 17 Sep 2023 11:22:24 -0400 Received: from lists.gnu.org ([2001:470:142::17]:38074) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhtbJ-0000eR-6z for submit@debbugs.gnu.org; Sun, 17 Sep 2023 11:22:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhtb5-00061R-11 for guix-patches@gnu.org; Sun, 17 Sep 2023 11:22:07 -0400 Received: from magnesium.8pit.net ([2001:19f0:6c01:4ae:5400:ff:fe66:af9d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhtb2-0003ea-Oc; Sun, 17 Sep 2023 11:22:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=opensmtpd; bh=fp6dfzRq/g DQwuotX9I6Gg0Qbx07ZXvPoJC7op9GSNY=; h=references:in-reply-to:date: subject:cc:to:from; d=soeren-tempel.net; b=eRt7HdBoTKhChsmVgUrkYG2FLCx fo5r0JrT79aSqzMf5a9StKHP27qENvNcmOpy+CM+A4ZE5784/vx/soNhWKOmboDlMsHTsq Y/61IGX2Odk+LEu5bOTzFlTj1N2zYZY6/sj7fx3p0L3sdX+dsR01iIE1GmnwRsDGWxfc/K /Nog= Received: from localhost (ip-078-094-021-002.um19.pools.vodafone-ip.de [78.94.21.2]) by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 64276c78 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); Sun, 17 Sep 2023 17:21:56 +0200 (CEST) From: soeren@soeren-tempel.net To: guix-patches@gnu.org Subject: [PATCH v3] syscalls: Add support for musl libc Date: Sun, 17 Sep 2023 17:21:49 +0200 Message-ID: <20230917152149.8587-2-soeren@soeren-tempel.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230917152149.8587-1-soeren@soeren-tempel.net> References: <87il89yugy.fsf@gnu.org> <20230917152149.8587-1-soeren@soeren-tempel.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2001:19f0:6c01:4ae:5400:ff:fe66:af9d; envelope-from=soeren@soeren-tempel.net; helo=magnesium.8pit.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit Cc: 65486@debbugs.gnu.org, ludo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) From: Sören Tempel This commit allows using Guix on a foreign distro which uses musl libc, for example, Alpine Linux. Usage of musl libc is detected via a new musl-libc? variable using the Guile %host-type. Using the new musl-libc? variable, we can now implement musl-specific quirks. The two compatibility problems I encountered in this regard are that musl dose not export a readdir64 and statfs64 symbol. On musl, these two functions are implemented as CPP macros that expand to readdir/statfs. To workaround that, a case-distinction was added. The existing linux? variable has been modified to return true if the %host-system contains "linux-" in order to ensure it is true for both linux-gnu as well as linux-musl host systems. The patch has been tested on Alpine Linux and is already used for the downstream Guix package shipped in Alpine Linux's package repository. * guix/build/syscalls.scm (musl-libc?): New variable. * guix/build/syscalls.scm (linux?): Truth value on any linux system. * guix/build/syscalls.scm (readdir-procedure): Support musl libc. * guix/build/syscalls.scm (statfs): Support musl libc. Signed-off-by: Sören Tempel --- guix/build/syscalls.scm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index c9c0bf594d..b845b8aab9 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -836,7 +836,8 @@ (define-record-type (define-syntax fsword ;fsword_t (identifier-syntax long)) -(define linux? (string-contains %host-type "linux-gnu")) +(define musl-libc? (string-contains %host-type "linux-musl")) +(define linux? (string-contains %host-type "linux-")) (define-syntax define-statfs-flags (syntax-rules (linux hurd) @@ -905,7 +906,7 @@ (define-c-struct %statfs ; (spare (array fsword 4))) (define statfs - (let ((proc (syscall->procedure int "statfs64" '(* *)))) + (let ((proc (syscall->procedure int (if musl-libc? "statfs" "statfs64") '(* *)))) (lambda (file) "Return a data structure describing the file system mounted at FILE." @@ -1232,7 +1233,7 @@ (define closedir* (define (readdir-procedure name-field-offset sizeof-dirent-header read-dirent-header) - (let ((proc (syscall->procedure '* "readdir64" '(*)))) + (let ((proc (syscall->procedure '* (if musl-libc? "readdir" "readdir64") '(*)))) (lambda* (directory #:optional (pointer->string pointer->string/utf-8)) (let ((ptr (proc directory))) (and (not (null-pointer? ptr)) From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 13 11:54:01 2023 Received: (at control) by debbugs.gnu.org; 13 Oct 2023 15:54:02 +0000 Received: from localhost ([127.0.0.1]:47215 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qrKUD-0007eK-Ec for submit@debbugs.gnu.org; Fri, 13 Oct 2023 11:54:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59850) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qrKUB-0007dr-SQ for control@debbugs.gnu.org; Fri, 13 Oct 2023 11:54:00 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qrKTj-0006v9-H8 for control@debbugs.gnu.org; Fri, 13 Oct 2023 11:53:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:Subject:From:To:Date:in-reply-to: references; bh=tuZgiQNRmYrryLTkJGWhLf9hR5R5CCjYxL/XgQr/9Y4=; b=NngGJu/UCVR2n0 349ekwkTv+Ex0+0GUW8pukYoEklMt+1pUmJ3o/2smdpQ7s5ZQxF8S4Rr4OIWB0ch9hLvSuFw4RIhS CPkdFQMv9Sny0Dim9sge/CHAfPl+cScDFWSRW9DapmnSHyzmlTn9uBumkn3wC1ja4bWEgthGXAQXd xu3lb9b48TuTmZEmzNBrkq0FHOZFQKF1bWH3eEsY4mSHs8ohh2OLjC7mS1T9ud3yHesLRRk6ISwYF J46kPm8Trg3ajoCI0Nu0XxK3gHOIjFprcqINebB6dtT8UReOUj8UNLVLM8rZ9vbobnj7j6K2MZrAb sjL1oEWc3d/yO2ZVMEpw==; Date: Fri, 13 Oct 2023 17:53:25 +0200 Message-Id: <87v8baikne.fsf@gnu.org> To: control@debbugs.gnu.org From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: control message for bug #66055 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) block 66055 by 66525 quit From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 23 06:12:28 2023 Received: (at control) by debbugs.gnu.org; 23 Oct 2023 10:12:28 +0000 Received: from localhost ([127.0.0.1]:49121 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qurv9-0005wE-Ut for submit@debbugs.gnu.org; Mon, 23 Oct 2023 06:12:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53526) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qurv8-0005vz-As for control@debbugs.gnu.org; Mon, 23 Oct 2023 06:12:26 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qurua-0004di-4W for control@debbugs.gnu.org; Mon, 23 Oct 2023 06:11:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:Subject:From:To:Date:in-reply-to: references; bh=+GSL1FfgY0ddpOuBH2pc1RGkglOzMQFmdvLg8x9OPvU=; b=CHufQeQ/2sKLGu 7kGA+xTzfZnugBJEHzHLYYEPdcY9LEr+Xxq1UK5Fi2FNG6149w2/Hk6D13YlFgf05S939y8xiHXej KZleSLgy/PXjwU2l1Q4dnNA5tiU4EUbEhDjttt6ZL4QkfIiievV2ilP2RbfjzhMC/bS0Ket9500yM sV1kCj+0xFhKjsgkfw4cuvtv84r1II2Xv4i/D/DjaubHV1z2h3WQE2LlC80Vt+SOoaWVB4KdNq75X fbHtHpGaG/ONdPob4HK276/DclZOfoqMjowM8yQzT/d5U5TVOb4jA9r2e5OxefeiU0CzZDpfNxC2+ jIs2t+Lmi2fUS5Ou9NgQ==; Date: Mon, 23 Oct 2023 12:11:50 +0200 Message-Id: <87edhlhcm1.fsf@gnu.org> To: control@debbugs.gnu.org From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: control message for bug #66055 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 66055 quit From unknown Sat Jun 21 12:20:38 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 20 Nov 2023 12:24:09 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator