GNU bug report logs -
#62105
[PATCH] gnu: zig: make zig build for a baseline cpu
Previous Next
Reported by: Ekaitz Zarraga <ekaitz <at> elenq.tech>
Date: Fri, 10 Mar 2023 22:02:02 UTC
Severity: normal
Tags: patch
Done: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Sun, 19 Mar 2023 09:28:12 +0100
with message-id <d419e18f738d55b38ed510e649910b627784af90.camel <at> gmail.com>
and subject line Re: [PATCH v2] gnu: zig: Build against a baseline CPU.
has caused the debbugs.gnu.org bug report #62105,
regarding [PATCH] gnu: zig: make zig build for a baseline cpu
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
62105: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62105
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
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 <ekaitz <at> elenq.tech>
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(+)
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.
--
2.39.1
[Message part 3 (message/rfc822, inline)]
Am Sonntag, dem 12.03.2023 um 10:01 +0000 schrieb Ekaitz Zarraga:
> Thank you Liliana, and sorry for the inconvenience.
No problem.
Pushed.
This bug report was last modified 2 years and 68 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.