From patchwork Sat Oct 16 17:06:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon South X-Patchwork-Id: 33906 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 07DC227BBE3; Sat, 16 Oct 2021 18:08:30 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id EA01A27BBE1 for ; Sat, 16 Oct 2021 18:08:28 +0100 (BST) Received: from localhost ([::1]:58998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbnAZ-0005Yv-WA for patchwork@mira.cbaines.net; Sat, 16 Oct 2021 13:08:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59616) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbnAB-0005Xn-M5 for guix-patches@gnu.org; Sat, 16 Oct 2021 13:08:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59661) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mbnAB-0007p0-BP for guix-patches@gnu.org; Sat, 16 Oct 2021 13:08:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mbnAB-0002af-5q for guix-patches@gnu.org; Sat, 16 Oct 2021 13:08:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#51241] [PATCH 1/1] gnu: ragel: Fix build of knot on aarch64-linux. Resent-From: Simon South Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 16 Oct 2021 17:08:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51241 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51241@debbugs.gnu.org Received: via spool by 51241-submit@debbugs.gnu.org id=B51241.16344040329838 (code B ref 51241); Sat, 16 Oct 2021 17:08:03 +0000 Received: (at 51241) by debbugs.gnu.org; 16 Oct 2021 17:07:12 +0000 Received: from localhost ([127.0.0.1]:42958 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mbn9L-0002Yc-QE for submit@debbugs.gnu.org; Sat, 16 Oct 2021 13:07:12 -0400 Received: from mailout.easymail.ca ([64.68.200.34]:34250) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mbn9J-0002YN-Jt for 51241@debbugs.gnu.org; Sat, 16 Oct 2021 13:07:10 -0400 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id B8EFEA94EE for <51241@debbugs.gnu.org>; Sat, 16 Oct 2021 17:07:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at emo04-pco.easydns.vpn Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo04-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2EWHH_Yvp79O for <51241@debbugs.gnu.org>; Sat, 16 Oct 2021 17:07:03 +0000 (UTC) Received: from localhost.localdomain (unknown [108.162.141.208]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id 747D9A8DDA for <51241@debbugs.gnu.org>; Sat, 16 Oct 2021 17:07:03 +0000 (UTC) From: Simon South Date: Sat, 16 Oct 2021 13:06:39 -0400 Message-Id: <8d3c7556a41b12a899c52181a5f6689111f036b4.1634402642.git.simon@simonsouth.net> X-Mailer: git-send-email 2.25.2 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Make explicit Ragel's assumption of the "char" type being signed on both its build and target platforms, allowing the current version of Knot and perhaps other dependent packages to build successfully on aarch64-linux where "char" is unsigned by default. * gnu/packages/patches/ragel-specify-char-signedness.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/ragel.scm (ragel)[source]: Apply it. --- gnu/local.mk | 1 + .../ragel-specify-char-signedness.patch | 58 +++++++++++++++++++ gnu/packages/ragel.scm | 4 +- 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/ragel-specify-char-signedness.patch diff --git a/gnu/local.mk b/gnu/local.mk index d1803e7f59..a4dd01a40f 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1716,6 +1716,7 @@ dist_patch_DATA = \ %D%/packages/patches/quassel-qt-514-compat.patch \ %D%/packages/patches/quickswitch-fix-dmenu-check.patch \ %D%/packages/patches/qtwebkit-pbutils-include.patch \ + %D%/packages/patches/ragel-specify-char-signedness.patch \ %D%/packages/patches/randomjungle-disable-static-build.patch \ %D%/packages/patches/rapicorn-isnan.patch \ %D%/packages/patches/rapidjson-gcc-compat.patch \ diff --git a/gnu/packages/patches/ragel-specify-char-signedness.patch b/gnu/packages/patches/ragel-specify-char-signedness.patch new file mode 100644 index 0000000000..fccb79d432 --- /dev/null +++ b/gnu/packages/patches/ragel-specify-char-signedness.patch @@ -0,0 +1,58 @@ +Ragel assumes C and C++'s "char" type is signed by default but this is not +true for every architecture gcc supports. Prevent build failures of dependent +packages (on architectures such as AArch64 where "char" is normally unsigned) +by making explicit Ragel's assumption of character signedness. + +This is functionally very similar to upstream commit e2650a7, "common: Fix +ambiguous CHAR_MIN/MAX definition", which is also meant to address this issue. +However this patch applies to Ragel version 6 and it removes altogether the +ambiguous "char" type from generated C code, causing Ragel to instead specify +"signed char" or "unsigned char" as appropriate. + +diff --git a/ragel/common.cpp b/ragel/common.cpp +index 8e9f8ed0..649f388c 100644 +--- a/ragel/common.cpp ++++ b/ragel/common.cpp +@@ -27,7 +27,7 @@ + + HostType hostTypesC[] = + { +- { "char", 0, "char", true, true, false, CHAR_MIN, CHAR_MAX, 0, 0, sizeof(char) }, ++ { "signed", "char", "char", true, true, false, SCHAR_MIN, SCHAR_MAX, 0, 0, sizeof(signed char) }, + { "unsigned", "char", "uchar", false, true, false, 0, 0, 0, UCHAR_MAX, sizeof(unsigned char) }, + { "short", 0, "short", true, true, false, SHRT_MIN, SHRT_MAX, 0, 0, sizeof(short) }, + { "unsigned", "short", "ushort", false, true, false, 0, 0, 0, USHRT_MAX, sizeof(unsigned short) }, +@@ -66,7 +66,7 @@ HostType hostTypesC[] = + + HostType hostTypesD[] = + { +- { "byte", 0, "byte", true, true, false, CHAR_MIN, CHAR_MAX, 0, 0, 1 }, ++ { "byte", 0, "byte", true, true, false, SCHAR_MIN, SCHAR_MAX, 0, 0, 1 }, + { "ubyte", 0, "ubyte", false, true, false, 0, 0, 0, UCHAR_MAX, 1 }, + { "char", 0, "char", false, true, false, 0, 0, 0, UCHAR_MAX, 1 }, + { "short", 0, "short", true, true, false, SHRT_MIN, SHRT_MAX, 0, 0, 2 }, +@@ -93,7 +93,7 @@ HostType hostTypesGo[] = + + HostType hostTypesJava[] = + { +- { "byte", 0, "byte", true, true, false, CHAR_MIN, CHAR_MAX, 0, 0, 1 }, ++ { "byte", 0, "byte", true, true, false, SCHAR_MIN, SCHAR_MAX, 0, 0, 1 }, + { "short", 0, "short", true, true, false, SHRT_MIN, SHRT_MAX, 0, 0, 2 }, + { "char", 0, "char", false, true, false, 0, 0, 0, USHRT_MAX, 2 }, + { "int", 0, "int", true, true, false, INT_MIN, INT_MAX, 0, 0, 4 }, +@@ -102,13 +102,13 @@ HostType hostTypesJava[] = + /* What are the appropriate types for ruby? */ + HostType hostTypesRuby[] = + { +- { "char", 0, "char", true, true, false, CHAR_MIN, CHAR_MAX, 0, 0, 1 }, ++ { "char", 0, "char", true, true, false, SCHAR_MIN, SCHAR_MAX, 0, 0, 1 }, + { "int", 0, "int", true, true, false, INT_MIN, INT_MAX, 0, 0, 4 }, + }; + + HostType hostTypesCSharp[] = + { +- { "sbyte", 0, "sbyte", true, true, false, CHAR_MIN, CHAR_MAX, 0, 0, 1 }, ++ { "sbyte", 0, "sbyte", true, true, false, SCHAR_MIN, SCHAR_MAX, 0, 0, 1 }, + { "byte", 0, "byte", false, true, false, 0, 0, 0, UCHAR_MAX, 1 }, + { "short", 0, "short", true, true, false, SHRT_MIN, SHRT_MAX, 0, 0, 2 }, + { "ushort", 0, "ushort", false, true, false, 0, 0, 0, USHRT_MAX, 2 }, diff --git a/gnu/packages/ragel.scm b/gnu/packages/ragel.scm index 1d9b67a6e0..e3fc980bd7 100644 --- a/gnu/packages/ragel.scm +++ b/gnu/packages/ragel.scm @@ -34,7 +34,9 @@ (define-public ragel version ".tar.gz")) (sha256 (base32 - "0gvcsl62gh6sg73nwaxav4a5ja23zcnyxncdcdnqa2yjcpdnw5az")))) + "0gvcsl62gh6sg73nwaxav4a5ja23zcnyxncdcdnqa2yjcpdnw5az")) + (patches + (search-patches "ragel-specify-char-signedness.patch")))) (build-system gnu-build-system) (home-page "https://www.colm.net/open-source/ragel/") (synopsis "State machine compiler")