From patchwork Fri Mar 10 22:01:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ekaitz Zarraga X-Patchwork-Id: 10860 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 1D44116E86; Fri, 10 Mar 2023 22:02:25 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 18F4716E82 for ; Fri, 10 Mar 2023 22:02:22 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pakoT-0002Uv-U5; Fri, 10 Mar 2023 17:02:09 -0500 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 1pakoN-0002UH-EN for guix-patches@gnu.org; Fri, 10 Mar 2023 17:02:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pakoM-0001Lx-MW for guix-patches@gnu.org; Fri, 10 Mar 2023 17:02:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pakoM-000320-74 for guix-patches@gnu.org; Fri, 10 Mar 2023 17:02:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#62105] [PATCH] gnu: zig: make zig build for a baseline cpu Resent-From: Ekaitz Zarraga Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 10 Mar 2023 22:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62105 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62105@debbugs.gnu.org X-Debbugs-Original-To: "guix-patches@gnu.org" Received: via spool by submit@debbugs.gnu.org id=B.167848570311620 (code B ref -1); Fri, 10 Mar 2023 22:02:02 +0000 Received: (at submit) by debbugs.gnu.org; 10 Mar 2023 22:01:43 +0000 Received: from localhost ([127.0.0.1]:56052 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pako3-00031M-B7 for submit@debbugs.gnu.org; Fri, 10 Mar 2023 17:01:43 -0500 Received: from lists.gnu.org ([209.51.188.17]:57782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pako1-00031E-1P for submit@debbugs.gnu.org; Fri, 10 Mar 2023 17:01:41 -0500 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 1pako0-0002S8-BK for guix-patches@gnu.org; Fri, 10 Mar 2023 17:01:40 -0500 Received: from mail-0201.mail-europe.com ([51.77.79.158]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1paknw-0001GR-CX for guix-patches@gnu.org; Fri, 10 Mar 2023 17:01:39 -0500 Date: Fri, 10 Mar 2023 22:01:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=elenq.tech; s=protonmail; t=1678485681; x=1678744881; bh=4wJY3hlPxZs//vr4Q/DtC23zeNwcS2AbZk5QGVQIyuQ=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=P65TbILXdyn8bX3dSSNI85Sv+EWp3kwz6uVeyTx3in/3NzaanaZIYPPZK6FUkUFwL v9Qc/mMb7WlDokD4/GPEIBn4CxdFDP3JVq0aZDBoeCjVn0HIcVTTkHePMN7betZjID BJ3XLS2gxBNdgZQXI7M43tCeJA01DmRQybhWlbwv6nBJH52HxsH4ZQCR5oM9rLKkC0 ScHPEmhoGor/x08uCdgCFMZRFI4utizHUeCtIPy0svR5WJXWrusQmiW8uu7QG04ggU sK2wSvMiwQi9KJe87sz7HuWKKufCegI+AzVYD90xViKlCaAvOg2kLM+8ZW7uEd/RLE SVE1HHwPIuxRA== From: Ekaitz Zarraga Message-ID: Feedback-ID: 3263582:user:proton MIME-Version: 1.0 Received-SPF: pass client-ip=51.77.79.158; envelope-from=ekaitz@elenq.tech; helo=mail-0201.mail-europe.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches This patch fixes a `Illegal instruction` issue when running Zig. It happens because Zig compiles with optimizations for the current machine, which may add instructions that are not compatible with some target machines. This flag makes it build for a baseline cpu. Tested with: qemu-x86_64 -cpu Broadwell-v2 /gnu/store/zzi23y4mab8zl58hdd740xz3814vy24w-zig-0.10.1/bin/zig build And: qemu-x86_64 -cpu Broadwell-v4 /gnu/store/zzi23y4mab8zl58hdd740xz3814vy24w-zig-0.10.1/bin/zig build It worked. It follows what Arch does: https://github.com/archlinux/svntogit-community/blob/31055e6750a5672ebbd85114fe7a93163f8af575/trunk/PKGBUILD#L30 And NixOS: https://github.com/NixOS/nixpkgs/pull/215994/commits/26b9a2f4a1a53e6763aa83590aad0fce5013a458 Hope this helps. Best, Ekaitz --- From 8dbb801ba7df6cc64c003e8f1739117c8dda6a75 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Fri, 10 Mar 2023 22:52:19 +0100 Subject: [PATCH] gnu: zig: make zig build for a baseline cpu * gnu/packages/zig.scm(zig-0.10): Add -DZIG_TARGET_MCPU=baseline configure flag. --- gnu/packages/zig.scm | 1 + 1 file changed, 1 insertion(+) -- 2.39.1 diff --git a/gnu/packages/zig.scm b/gnu/packages/zig.scm index 5414b5ba6e..2c89343cb1 100644 --- a/gnu/packages/zig.scm +++ b/gnu/packages/zig.scm @@ -56,6 +56,7 @@ (define-public zig-0.10 '(string-append "-DZIG_TARGET_TRIPLE=" (%current-target-system)) '()) + (string-append "-DZIG_TARGET_MCPU=baseline") (string-append "-DZIG_LIB_DIR=" (assoc-ref %outputs "out") "/lib/zig")) #:validate-runpath? #f ; TODO: zig binary can't find ld-linux.