GNU bug report logs - #39480
[PATCH] gnu: Add zig compiler

Previous Next

Package: guix-patches;

Reported by: Simon Nielsen <tauoverpi <at> yandex.com>

Date: Fri, 7 Feb 2020 13:49:03 UTC

Severity: normal

Tags: patch

Merged with 47006, 50449

Done: Liliana Marie Prikler <liliana.prikler <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 39480 in the body.
You can then email your comments to 39480 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#39480; Package guix-patches. (Fri, 07 Feb 2020 13:49:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Simon Nielsen <tauoverpi <at> yandex.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 07 Feb 2020 13:49:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Simon Nielsen <tauoverpi <at> yandex.com>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: Add zig compiler
Date: Fri, 07 Feb 2020 13:40:41 +0100
[Message part 1 (text/plain, inline)]
Hi,

Adds the zig compiler as a new file in `gnu/packages/`

- Simon
[0001-gnu-Add-zig-0.5.0-compiler.patch (text/x-diff, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#39480; Package guix-patches. (Fri, 21 Feb 2020 18:08:02 GMT) Full text and rfc822 format available.

Message #8 received at 39480 <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: Simon Nielsen <tauoverpi <at> yandex.com>
Cc: 39480 <at> debbugs.gnu.org
Subject: Re: [bug#39480] [PATCH] gnu: Add zig compiler
Date: Fri, 21 Feb 2020 13:07:50 -0500
On Fri, Feb 07, 2020 at 01:40:41PM +0100, Simon Nielsen wrote:
> Hi,
> 
> Adds the zig compiler as a new file in `gnu/packages/`

Thanks! Please add it to 'gnu/local.mk'.

> +(define-public zig-0.5.0

We can name it 'zig' until there are multiple versions in Guix.

> +     `(#:tests? #f

Why are the tests disabled? Is it because there is no test suite? Or
something else? Please add a brief code comment explaining it.

> +       #:phases
> +       (modify-phases %standard-phases
> +         (add-before 'build 'fix-build
> +           (lambda _ (setenv "HOME" "/tmp") #t)))))

I guess that the build tries to access $HOME?

> +    (description
> +      "Programming languaged designed for robustness, optimality, and clarity")

Can you try to make a more detailed description here? At least it should
be a complete sentence.

> +    (synopsis
> +      "Programming languaged designed for robustness, optimality, and clarity")

Typo: languaged




Information forwarded to guix-patches <at> gnu.org:
bug#39480; Package guix-patches. (Fri, 20 Nov 2020 20:39:01 GMT) Full text and rfc822 format available.

Message #11 received at 39480 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: Simon Nielsen <tauoverpi <at> yandex.com>
Cc: 39480 <at> debbugs.gnu.org
Subject: Re: [bug#39480] [PATCH] gnu: Add zig compiler
Date: Fri, 20 Nov 2020 20:38:23 +0000
[Message part 1 (text/plain, inline)]
Leo Famulari <leo <at> famulari.name> writes:

> On Fri, Feb 07, 2020 at 01:40:41PM +0100, Simon Nielsen wrote:
>> Hi,
>> 
>> Adds the zig compiler as a new file in `gnu/packages/`
>
> Thanks! Please add it to 'gnu/local.mk'.
>
>> +(define-public zig-0.5.0
>
> We can name it 'zig' until there are multiple versions in Guix.
>
>> +     `(#:tests? #f
>
> Why are the tests disabled? Is it because there is no test suite? Or
> something else? Please add a brief code comment explaining it.
>
>> +       #:phases
>> +       (modify-phases %standard-phases
>> +         (add-before 'build 'fix-build
>> +           (lambda _ (setenv "HOME" "/tmp") #t)))))
>
> I guess that the build tries to access $HOME?
>
>> +    (description
>> +      "Programming languaged designed for robustness, optimality, and clarity")
>
> Can you try to make a more detailed description here? At least it should
> be a complete sentence.
>
>> +    (synopsis
>> +      "Programming languaged designed for robustness, optimality, and clarity")
>
> Typo: languaged

It's been a few months, is this patch still relevant?

Thanks,

Chris
[signature.asc (application/pgp-signature, inline)]

Merged 39480 47006. Request was from Leo Prikler <leo.prikler <at> student.tugraz.at> to control <at> debbugs.gnu.org. (Mon, 31 May 2021 07:02:01 GMT) Full text and rfc822 format available.

Merged 39480 47006 50449. Request was from Liliana Marie Prikler <liliana.prikler <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 08 Sep 2021 22:17:01 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#39480; Package guix-patches. (Sat, 11 Sep 2021 19:25:02 GMT) Full text and rfc822 format available.

Message #18 received at 39480 <at> debbugs.gnu.org (full text, mbox):

From: Sarah Morgensen <iskarian <at> mgsn.dev>
To: Liliana Prikler <liliana.prikler <at> gmail.com>
Cc: 47006 <at> debbugs.gnu.org, 39480 <at> debbugs.gnu.org, maximedevos <at> telenet.be,
 efraim <at> flashner.co.il
Subject: Re: [bug#47006] [WIP PATCH v2 2/2] gnu: Add zig.
Date: Sat, 11 Sep 2021 12:24:39 -0700
[Message part 1 (text/plain, inline)]
All,

Apologies for the empty email earlier.  That shows me for trying to send
from mobile!

Liliana,

Liliana Prikler <liliana.prikler <at> gmail.com> writes:

> I've added a patch to use explicit search paths rather than whatever Zig used
> before and tried fixing some (syntactic) errors with the tests, but was
> unsuccesful, as there appear to be failing tests in the suite itself.  Could
> you have a look at the revised patch and check what flags you could add to
> the check phase to make it meaningful?
>
> Btw. I haven't checked whether my cosmetic changes to #:configure-flags break
> things or not.  The end of the build phase puts a large amount of stress onto
> my system that I'd like to avoid at this hour.

I'm still working through the tests, but I did find one issue that has
cropped up either from your patch or from the 0.7.1 -> 0.8.1 upgrade.
This is from attempting to build tetris [0] (though I had to make a few
syntax fixes, attached below, to build with 0.8.1):

--8<---------------cut here---------------start------------->8---
Zig attempted to find the path to native system libc headers by executing this command:
cc -E -Wp,-v -xc /dev/null
error: unable to create compilation: UnableToSpawnCCompiler
--8<---------------cut here---------------end--------------->8---

No combination of ZIG_LIB_DIRS and ZIG_INCLUDE_DIRS seems to fix
it.  Neither does --search-prefix.

If I set CC=gcc, it works fine.  But I think something changed such that
it now has to fall back to this method of detection.  I have no idea
why.

[0] https://github.com/andrewrk/tetris

--
Sarah

[build-tetris.patch (text/x-patch, inline)]
diff --git a/src/all_shaders.zig b/src/all_shaders.zig
index a855bba..fb7eac8 100644
--- a/src/all_shaders.zig
+++ b/src/all_shaders.zig
@@ -107,7 +107,7 @@ pub const ShaderProgram = struct {
     pub fn attribLocation(sp: ShaderProgram, name: [*]const u8) c.GLint {
         const id = c.glGetAttribLocation(sp.program_id, name);
         if (id == -1) {
-            panic("invalid attrib: {}\n", .{name});
+            panic("invalid attrib: {*}\n", .{name});
         }
         return id;
     }
@@ -115,7 +115,7 @@ pub const ShaderProgram = struct {
     pub fn uniformLocation(sp: ShaderProgram, name: [*]const u8) c.GLint {
         const id = c.glGetUniformLocation(sp.program_id, name);
         if (id == -1) {
-            panic("invalid uniform: {}\n", .{name});
+            panic("invalid uniform: {*}\n", .{name});
         }
         return id;
     }
@@ -169,7 +169,7 @@ pub const ShaderProgram = struct {
         c.glGetProgramiv(sp.program_id, c.GL_INFO_LOG_LENGTH, &error_size);
         const message = try c_allocator.alloc(u8, @intCast(usize, error_size));
         c.glGetProgramInfoLog(sp.program_id, error_size, &error_size, message.ptr);
-        panic("Error linking shader program: {}\n", .{message.ptr});
+        panic("Error linking shader program: {*}\n", .{message.ptr});
     }
 
     pub fn destroy(sp: *ShaderProgram) void {
@@ -205,5 +205,5 @@ fn initGlShader(source: []const u8, name: [*]const u8, kind: c.GLenum) !c.GLuint
 
     const message = try c_allocator.alloc(u8, @intCast(usize, error_size));
     c.glGetShaderInfoLog(shader_id, error_size, &error_size, message.ptr);
-    panic("Error compiling {} shader:\n{}\n", .{ name, message.ptr });
+    panic("Error compiling {*} shader:\n{*}\n", .{ name, message.ptr });
 }
diff --git a/src/debug_gl.zig b/src/debug_gl.zig
index 2fdcda0..543202b 100644
--- a/src/debug_gl.zig
+++ b/src/debug_gl.zig
@@ -2,7 +2,7 @@ const c = @import("c.zig");
 const std = @import("std");
 const os = std.os;
 const panic = std.debug.panic;
-const builtin = @import("builtin");
+const builtin = std.builtin;
 
 pub const is_on = if (builtin.mode == builtin.Mode.ReleaseFast) c.GL_FALSE else c.GL_TRUE;
 
diff --git a/src/main.zig b/src/main.zig
index fd83f8a..fa5f264 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -19,7 +19,7 @@ var static_geometry: StaticGeometry = undefined;
 var font: Spritesheet = undefined;
 
 fn errorCallback(err: c_int, description: [*c]const u8) callconv(.C) void {
-    panic("Error: {}\n", .{@as([*:0]const u8, description)});
+    panic("Error: {s}\n", .{@as([*:0]const u8, description)});
 }
 
 fn keyCallback(win: ?*c.GLFWwindow, key: c_int, scancode: c_int, action: c_int, mods: c_int) callconv(.C) void {
@@ -95,9 +95,10 @@ pub fn main() !void {
     defer font.deinit();
 
     var seed_bytes: [@sizeOf(u64)]u8 = undefined;
-    std.crypto.randomBytes(seed_bytes[0..]) catch |err| {
-        panic("unable to seed random number generator: {}", .{err});
-    };
+    std.crypto.random.bytes(seed_bytes[0..]);
+// catch {
+//        panic("unable to seed random number generator", .{});
+//    };
     t.prng = std.rand.DefaultPrng.init(std.mem.readIntNative(u64, &seed_bytes));
     t.rand = &t.prng.random;
 

Information forwarded to guix-patches <at> gnu.org:
bug#39480; Package guix-patches. (Sat, 11 Sep 2021 20:02:02 GMT) Full text and rfc822 format available.

Message #21 received at 39480 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Sarah Morgensen <iskarian <at> mgsn.dev>
Cc: 47006 <at> debbugs.gnu.org, 39480 <at> debbugs.gnu.org, maximedevos <at> telenet.be,
 efraim <at> flashner.co.il
Subject: Re: [bug#47006] [WIP PATCH v2 2/2] gnu: Add zig.
Date: Sat, 11 Sep 2021 22:01:31 +0200
Hi Sarah,

Am Samstag, den 11.09.2021, 12:24 -0700 schrieb Sarah Morgensen:
> All,
> 
> Apologies for the empty email earlier.  That shows me for trying to
> send from mobile!
Curse those mobile applications with their small buttons amirite? :P

> Liliana,
> 
> Liliana Prikler <liliana.prikler <at> gmail.com> writes:
> 
> > I've added a patch to use explicit search paths rather than
> > whatever Zig used
> > before and tried fixing some (syntactic) errors with the tests, but
> > was
> > unsuccesful, as there appear to be failing tests in the suite
> > itself.  Could
> > you have a look at the revised patch and check what flags you could
> > add to
> > the check phase to make it meaningful?
> > 
> > Btw. I haven't checked whether my cosmetic changes to #:configure-
> > flags break
> > things or not.  The end of the build phase puts a large amount of
> > stress onto
> > my system that I'd like to avoid at this hour.
> 
> I'm still working through the tests, but I did find one issue that
> has cropped up either from your patch or from the 0.7.1 -> 0.8.1
> upgrade.  This is from attempting to build tetris [0] (though I had
> to make a few syntax fixes, attached below, to build with 0.8.1):
W.r.t. the syntax fixes, that is probably an upstream issue or perhaps
an incompatibility introduced by zig itself.  (Maybe already from 0.7.1
to 0.8.0?)

> --8<---------------cut here---------------start------------->8---
> Zig attempted to find the path to native system libc headers by
> executing this command:
> cc -E -Wp,-v -xc /dev/null
> error: unable to create compilation: UnableToSpawnCCompiler
> --8<---------------cut here---------------end--------------->8---
It appears zig tries to execute @command{cc}.  Note, that this command
does not exist in Guix unless you install a symlink, so it will always
fail.  We might want to investigate the source of this error to check
whether spawning a C compiler is indeed the right choice for what
they're claiming to try or whether our hard coding already takes care
of that.

> No combination of ZIG_LIB_DIRS and ZIG_INCLUDE_DIRS seems to fix
> it.  Neither does --search-prefix.
> 
> If I set CC=gcc, it works fine.  But I think something changed such
> that it now has to fall back to this method of detection.  I have no
> idea why.
Thanks for the info.  I'll let you know once I find out more. 





bug closed, send any further explanations to 47006 <at> debbugs.gnu.org and Leo Prikler <leo.prikler <at> student.tugraz.at> Request was from Liliana Marie Prikler <liliana.prikler <at> gmail.com> to control <at> debbugs.gnu.org. (Sun, 31 Oct 2021 08:21:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 28 Nov 2021 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 149 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.