unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Sarah Morgensen <iskarian@mgsn.dev>
To: Liliana Prikler <liliana.prikler@gmail.com>
Cc: 47006@debbugs.gnu.org, 39480@debbugs.gnu.org,
	maximedevos@telenet.be, efraim@flashner.co.il
Subject: [bug#47006] [WIP PATCH v2 2/2] gnu: Add zig.
Date: Sat, 11 Sep 2021 12:24:39 -0700	[thread overview]
Message-ID: <86wnnmnceg.fsf@mgsn.dev> (raw)
In-Reply-To: <aa1961beb099e50fd87a41bcfd7f26010f8eaec6.1631226695.git.liliana.prikler@gmail.com> (Liliana Prikler's message of "Thu, 9 Sep 2021 15:32:22 +0200 (2 days, 5 hours, 3 minutes ago)")

[-- Attachment #1: Type: text/plain, Size: 1592 bytes --]

All,

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

Liliana,

Liliana Prikler <liliana.prikler@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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: build tetris --]
[-- Type: text/x-patch, Size: 3224 bytes --]

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;
 

  parent reply	other threads:[~2021-09-11 19:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <a1922b0a2ec237d217af54ed3ff7065e360d994c.camel@gmail.com>
2021-09-09  1:43 ` [bug#50449] [PATCH] Add zig Andrew Patterson
2021-09-09 13:32 ` [bug#47006] [PATCH 1/2] gnu: lld: Update to 12.0.0 Liliana Prikler
2021-09-09 13:32 ` [bug#47006] [PATCH 2/2] gnu: Add zig Liliana Prikler
2021-09-09 16:31   ` [bug#50449] " Sarah Morgensen
2021-09-09 18:18     ` Liliana Marie Prikler
2021-09-09 18:49       ` [bug#47006] [bug#50449] " Sarah Morgensen
2021-09-09 13:32         ` [bug#47006] [WIP PATCH v2 " Liliana Prikler
     [not found]           ` <0f6c5b692df8d06a0d7adddc9e5abf93894a366f.1631226695.git.liliana.prikler@gmail.com>
2021-09-11  9:52             ` iskarian
2021-09-11 19:24           ` Sarah Morgensen [this message]
2021-09-11 20:01             ` [bug#39480] " Liliana Marie Prikler
2021-09-12  4:42               ` Sarah Morgensen
2021-09-12  7:32                 ` Liliana Marie Prikler
2021-09-12  7:39                   ` Liliana Marie Prikler
2021-09-12 22:40                   ` Sarah Morgensen
2021-09-14 16:17                     ` Liliana Marie Prikler
2021-09-24  0:17                       ` [bug#50449] " Sarah Morgensen
2021-09-09 13:32                         ` [bug#50449] [PATCH v5] " Liliana Prikler
2021-10-31  8:06                           ` [bug#47006] " Liliana Marie Prikler

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=86wnnmnceg.fsf@mgsn.dev \
    --to=iskarian@mgsn.dev \
    --cc=39480@debbugs.gnu.org \
    --cc=47006@debbugs.gnu.org \
    --cc=efraim@flashner.co.il \
    --cc=liliana.prikler@gmail.com \
    --cc=maximedevos@telenet.be \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).