all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: pukkamustard <pukkamustard@posteo.net>
To: Ekaitz Zarraga <ekaitz@elenq.tech>
Cc: 62105@debbugs.gnu.org
Subject: [bug#62105] [PATCH] gnu: zig: make zig build for a baseline cpu
Date: Sat, 11 Mar 2023 10:10:42 +0000	[thread overview]
Message-ID: <865yb7k325.fsf@posteo.net> (raw)
In-Reply-To: <p6IABBvdY4_SnsvsI-2ozXIgqJMjTtJ3wrf6OqqiC5farcCvbjxUDdiaBYGljH5k4rJ0bWFzrYNUTDkvyNO9KlU2JuVZLzBmehTDpAO3C98=@elenq.tech>


I managed to build Zig with your patch applied. From what I understand
this is a good fix to the issue.

lgtm and thanks!

-pukkamustard


Ekaitz Zarraga <ekaitz@elenq.tech> writes:

> 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@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.





      parent reply	other threads:[~2023-03-11 10:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-10 22:01 [bug#62105] [PATCH] gnu: zig: make zig build for a baseline cpu Ekaitz Zarraga
2023-03-10 21:52 ` [bug#62105] [PATCH v2] gnu: zig: Build against a baseline CPU Ekaitz Zarraga
2023-03-12 10:01   ` Ekaitz Zarraga
2023-03-19  8:28     ` bug#62105: " Liliana Marie Prikler
2023-03-11 10:10 ` pukkamustard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=865yb7k325.fsf@posteo.net \
    --to=pukkamustard@posteo.net \
    --cc=62105@debbugs.gnu.org \
    --cc=ekaitz@elenq.tech \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.