* [bug#47006] [PATCH v2 0/1] gnu: Add zig.
2021-03-08 13:11 [bug#47006] [PATCH] gnu: Add zig Leo Prikler
@ 2021-03-15 14:20 ` Léo Le Bouter via Guix-patches via
2021-03-15 14:20 ` [bug#47006] [PATCH v2 1/1] " Léo Le Bouter via Guix-patches via
2021-03-16 12:57 ` [bug#47006] [PATCH] " Efraim Flashner
` (5 subsequent siblings)
6 siblings, 1 reply; 11+ messages in thread
From: Léo Le Bouter via Guix-patches via @ 2021-03-15 14:20 UTC (permalink / raw)
To: 47006; +Cc: Léo Le Bouter
I attempted to add tests, Zig has an unconventional way of requiring tests to be
run after installation so I added a 'check phase after the 'install phase which
works but then after lots of tests succeeded there is a FileNotFound error cause
by some 'test' binary failing to run.
I found out by running:
$ ./pre-inst-env guix build --keep-failed zig
$ cd /tmp/guix-build-zig-0.7.1.drv-0/source
$ env -i $(which bash)
$ source ../environment-variables
$ /run/current-system/profile/bin/strace -f -e trace=file /gnu/store/1cmjgdiim452bqkzgp53d0kw4fi4gfar-zig-0.7.1/bin/zig build test
...
[pid 25896] execve("/tmp/guix-build-zig-0.7.1.drv-0/source/zig-cache/o/25718f52ae311b1dafdba7de4a338f12/test", ["/tmp/guix-build-zig-0.7.1.drv-0/"...], 0x4e42bb0 /* 27 vars */) = -1 ENOENT (No such file or directory)
[pid 25896] +++ exited with 1 +++
[pid 25885] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=25896, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
error: FileNotFound
...
$ ldd /tmp/guix-build-zig-0.7.1.drv-0/source/zig-cache/o/25718f52ae311b1dafdba7de4a338f12/test
linux-vdso.so.1 (0x00007ffd22d1d000)
libc.so.6 => /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib/libc.so.6 (0x00007fea82162000)
libm.so.6 => /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib/libm.so.6 (0x00007fea82021000)
libpthread.so.0 => /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib/libpthread.so.0 (0x00007fea82000000)
libdl.so.2 => /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib/libdl.so.2 (0x00007fea81ffb000)
librt.so.1 => /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib/librt.so.1 (0x00007fea81ff1000)
/lib64/ld-linux-x86-64.so.2 => /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib/ld-linux-x86-64.so.2 (0x00007fea82321000)
libutil.so.1 => /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib/libutil.so.1 (0x00007fea81fec000)
$ file /tmp/guix-build-zig-0.7.1.drv-0/source/zig-cache/o/25718f52ae311b1dafdba7de4a338f12/test
/tmp/guix-build-zig-0.7.1.drv-0/source/zig-cache/o/25718f52ae311b1dafdba7de4a338f12/test: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.0.0, with debug_info, not stripped
The issue here is that this binary should work fine already according to the
output of ldd and file. We would need a way to get verbose debugging errors of
execve somehow.
Leo Prikler (1):
gnu: Add zig.
gnu/local.mk | 1 +
gnu/packages/zig.scm | 76 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 77 insertions(+)
create mode 100644 gnu/packages/zig.scm
--
2.30.2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [bug#47006] [PATCH v2 1/1] gnu: Add zig.
2021-03-15 14:20 ` [bug#47006] [PATCH v2 0/1] " Léo Le Bouter via Guix-patches via
@ 2021-03-15 14:20 ` Léo Le Bouter via Guix-patches via
0 siblings, 0 replies; 11+ messages in thread
From: Léo Le Bouter via Guix-patches via @ 2021-03-15 14:20 UTC (permalink / raw)
To: 47006; +Cc: Léo Le Bouter, Leo Prikler
From: Leo Prikler <leo.prikler@student.tugraz.at>
* gnu/packages/zig.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it here.
Co-authored-by: Léo Le Bouter <lle-bout@zaclys.net>
---
gnu/local.mk | 1 +
gnu/packages/zig.scm | 76 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 77 insertions(+)
create mode 100644 gnu/packages/zig.scm
diff --git a/gnu/local.mk b/gnu/local.mk
index cf8849cf59..ffa8005533 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -586,6 +586,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/xdisorg.scm \
%D%/packages/xorg.scm \
%D%/packages/xfce.scm \
+ %D%/packages/zig.scm \
%D%/packages/zile.scm \
%D%/packages/zwave.scm \
\
diff --git a/gnu/packages/zig.scm b/gnu/packages/zig.scm
new file mode 100644
index 0000000000..adc4c3e1e0
--- /dev/null
+++ b/gnu/packages/zig.scm
@@ -0,0 +1,76 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2021 Leo Prikler <leo.prikler@student.tugraz.at>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages zig)
+ #:use-module (guix packages)
+ #:use-module (guix git-download)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix build-system cmake)
+ #:use-module (gnu packages)
+ #:use-module (gnu packages llvm))
+
+(define-public zig
+ (package
+ (name "zig")
+ (version "0.7.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/ziglang/zig.git")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1z6c4ym9jmga46cw2arn7zv2drcpmrf3vw139gscxp27n7q2z5md"))))
+ (build-system cmake-build-system)
+ (native-inputs
+ `(("clang" ,clang-11)
+ ("lld" ,lld)
+ ("llvm" ,llvm-11)))
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'save-unpack-dir
+ (lambda _
+ ;; HACK: Passing unpacked source directory to 'check phase.
+ (setenv "ZIG_UNPACK_DIR" (getcwd))
+ #t))
+ (add-after 'configure 'set-home
+ (lambda _
+ (setenv "HOME" (getcwd)) ; zig writes to $HOME/.cache
+ #t))
+ (delete 'check)
+ (add-after 'install 'check
+ (lambda* (#:key outputs #:allow-other-keys)
+ (with-directory-excursion (getenv "ZIG_UNPACK_DIR")
+ (invoke (string-append (assoc-ref outputs "out") "/bin/zig")
+ "build" "test"))
+ #t)))))
+ (synopsis "General purpose programming language and toolchain")
+ (description "Zig is a general-purpose programming language and
+toolchain. Among other features it provides
+@itemize
+@item an Optional type instead of null pointers,
+@item manual memory management,
+@item generic data structures and functions,
+@item compile-time reflection and compile-time code execution,
+@item integration with C using zig as a C compiler, and
+@item concurrency via async functions.
+@end itemize")
+ (home-page "https://github.com/ziglang/zig")
+ (license license:expat)))
--
2.30.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [bug#47006] [PATCH] gnu: Add zig.
2021-03-08 13:11 [bug#47006] [PATCH] gnu: Add zig Leo Prikler
2021-03-15 14:20 ` [bug#47006] [PATCH v2 0/1] " Léo Le Bouter via Guix-patches via
@ 2021-03-16 12:57 ` Efraim Flashner
2021-03-16 13:09 ` Leo Prikler
2021-03-17 7:05 ` Léo Le Bouter via Guix-patches via
` (4 subsequent siblings)
6 siblings, 1 reply; 11+ messages in thread
From: Efraim Flashner @ 2021-03-16 12:57 UTC (permalink / raw)
To: Leo Prikler; +Cc: 47006
[-- Attachment #1: Type: text/plain, Size: 3918 bytes --]
On Mon, Mar 08, 2021 at 02:11:56PM +0100, Leo Prikler wrote:
> * gnu/packages/zig.scm: New file.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it here.
> ---
> gnu/local.mk | 1 +
> gnu/packages/zig.scm | 65 ++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 66 insertions(+)
> create mode 100644 gnu/packages/zig.scm
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index fb3b395852..abcf86fb7e 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -586,6 +586,7 @@ GNU_SYSTEM_MODULES = \
> %D%/packages/xdisorg.scm \
> %D%/packages/xorg.scm \
> %D%/packages/xfce.scm \
> + %D%/packages/zig.scm \
> %D%/packages/zile.scm \
> %D%/packages/zwave.scm \
> \
> diff --git a/gnu/packages/zig.scm b/gnu/packages/zig.scm
> new file mode 100644
> index 0000000000..caf0a5e21a
> --- /dev/null
> +++ b/gnu/packages/zig.scm
> @@ -0,0 +1,65 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2021 Leo Prikler <leo.prikler@student.tugraz.at>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify it
> +;;; under the terms of the GNU General Public License as published by
> +;;; the Free Software Foundation; either version 3 of the License, or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public License
> +;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
> +
> +(define-module (gnu packages zig)
> + #:use-module (guix packages)
> + #:use-module (guix git-download)
> + #:use-module ((guix licenses) #:prefix license:)
> + #:use-module (guix build-system cmake)
> + #:use-module (gnu packages)
> + #:use-module (gnu packages llvm))
> +
> +(define-public zig
> + (package
> + (name "zig")
> + (version "0.7.1")
> + (source
> + (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/ziglang/zig.git")
> + (commit version)))
> + (file-name (git-file-name name version))
> + (sha256
> + (base32 "1z6c4ym9jmga46cw2arn7zv2drcpmrf3vw139gscxp27n7q2z5md"))))
> + (build-system cmake-build-system)
> + (native-inputs
> + `(("clang" ,clang-11)
> + ("lld" ,lld)
> + ("llvm" ,llvm-11)))
Does it work to replace these three with clang-toolchain-11?
> + (arguments
> + `(#:tests? #f ; no check target
> + #:phases
> + (modify-phases %standard-phases
> + (add-after 'configure 'set-home
> + (lambda _
> + (setenv "HOME" (getcwd)) ; zig writes to $HOME/.cache
> + #t)))))
> + (synopsis "General purpose programming language and toolchain")
> + (description "Zig is a general-purpose programming language and
> +toolchain. Among other features it provides
> +@itemize
> +@item an Optional type instead of null pointers,
> +@item manual memory management,
> +@item generic data structures and functions,
> +@item compile-time reflection and compile-time code execution,
> +@item integration with C using zig as a C compiler, and
> +@item concurrency via async functions.
> +@end itemize")
> + (home-page "https://github.com/ziglang/zig")
> + (license license:expat)))
> --
> 2.30.1
>
>
>
>
--
Efraim Flashner <efraim@flashner.co.il> אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* [bug#47006] [PATCH] gnu: Add zig.
2021-03-16 12:57 ` [bug#47006] [PATCH] " Efraim Flashner
@ 2021-03-16 13:09 ` Leo Prikler
0 siblings, 0 replies; 11+ messages in thread
From: Leo Prikler @ 2021-03-16 13:09 UTC (permalink / raw)
To: Efraim Flashner; +Cc: 47006
Am Dienstag, den 16.03.2021, 14:57 +0200 schrieb Efraim Flashner:
> On Mon, Mar 08, 2021 at 02:11:56PM +0100, Leo Prikler wrote:
> > + (native-inputs
> > + `(("clang" ,clang-11)
> > + ("lld" ,lld)
> > + ("llvm" ,llvm-11)))
>
> Does it work to replace these three with clang-toolchain-11?
You can replace clang+llvm by clang-toolchain, but IIUC we prefer the
explicit style in Guix. Correct me if I'm wrong.
Regards,
Leo
^ permalink raw reply [flat|nested] 11+ messages in thread
* [bug#47006] [PATCH] gnu: Add zig.
2021-03-08 13:11 [bug#47006] [PATCH] gnu: Add zig Leo Prikler
2021-03-15 14:20 ` [bug#47006] [PATCH v2 0/1] " Léo Le Bouter via Guix-patches via
2021-03-16 12:57 ` [bug#47006] [PATCH] " Efraim Flashner
@ 2021-03-17 7:05 ` Léo Le Bouter via Guix-patches via
2021-04-09 22:17 ` [bug#47006] (No Subject) terramorpha--- via Guix-patches via
` (3 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Léo Le Bouter via Guix-patches via @ 2021-03-17 7:05 UTC (permalink / raw)
To: 47006
[-- Attachment #1: Type: text/plain, Size: 212 bytes --]
Another patch submission for Zig was sent:
https://issues.guix.gnu.org/47206 (I closed and directed them here for
cooperation instead). But still have a look there for any improvements
to the current patch.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* [bug#47006] (No Subject)
2021-03-08 13:11 [bug#47006] [PATCH] gnu: Add zig Leo Prikler
` (2 preceding siblings ...)
2021-03-17 7:05 ` Léo Le Bouter via Guix-patches via
@ 2021-04-09 22:17 ` terramorpha--- via Guix-patches via
2021-04-11 21:04 ` [bug#47006] [PATCH] gnu: Add zig Maxime Devos
` (2 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: terramorpha--- via Guix-patches via @ 2021-04-09 22:17 UTC (permalink / raw)
To: 47006@debbugs.gnu.org
[-- Attachment #1: Type: text/plain, Size: 131 bytes --]
Hi, are there any issues left preventing this patch from being merged? If so, I can help. I would love to see Zig packaged in guix.
[-- Attachment #2: Type: text/html, Size: 142 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* [bug#47006] [PATCH] gnu: Add zig.
2021-03-08 13:11 [bug#47006] [PATCH] gnu: Add zig Leo Prikler
` (3 preceding siblings ...)
2021-04-09 22:17 ` [bug#47006] (No Subject) terramorpha--- via Guix-patches via
@ 2021-04-11 21:04 ` Maxime Devos
2021-05-30 9:32 ` [bug#47006] Zig question Sharlatan Hellseher
2021-09-11 0:01 ` [bug#47006] [PATCH] gnu: Add zig András Vöröskői
6 siblings, 0 replies; 11+ messages in thread
From: Maxime Devos @ 2021-04-11 21:04 UTC (permalink / raw)
To: 47006
[-- Attachment #1: Type: text/plain, Size: 1235 bytes --]
One comment below.
> + (native-inputs
> + `(("clang" ,clang-11)
> + ("lld" ,lld)
> + ("llvm" ,llvm-11)))
This looks rather suspicious from a cross-compilation perspective.
IIUC, lld and llvm are used for two purposes:
* for compiling the "zig" compiler --> native-inputs is ok
(or is GCC used to compile the zig compiler?)
* as a run-time dependency of "zig" --> should be 'inputs'
Therefore, shouldn't "lld" and "llvm" be added to "inputs" as well?
TODO to self: define a variant of disallowed-references
disallowed-references/native that refers to the package in 'native-inputs'
instead of 'inputs'.
Perhaps explicitely whitelist some inputs (llvm, lld, maybe some implicit
libc inputs?).
Note: according to me, *all* inputs in native-inputs should be added
to disallowed-references *by default* when cross-compiling.
Alternatively, I guess ‘we’ could simply add a comment
;; Cross-compilation is currently unsupported.
and leave cross-compilation for later. My comments are mostly about
‘giving the good example’ on how to use inputs & native-inputs and avoid
giving ‘bad examples’ of package definitions without marking them as such.
Greetings,
Maxime.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* [bug#47006] Zig question
2021-03-08 13:11 [bug#47006] [PATCH] gnu: Add zig Leo Prikler
` (4 preceding siblings ...)
2021-04-11 21:04 ` [bug#47006] [PATCH] gnu: Add zig Maxime Devos
@ 2021-05-30 9:32 ` Sharlatan Hellseher
2021-09-11 0:01 ` [bug#47006] [PATCH] gnu: Add zig András Vöröskői
6 siblings, 0 replies; 11+ messages in thread
From: Sharlatan Hellseher @ 2021-05-30 9:32 UTC (permalink / raw)
To: 47006
[-- Attachment #1: Type: text/plain, Size: 394 bytes --]
Hi Guix team.
There is an open issue from 2020 adding zig
https://issues.guix.gnu.org/39480
it probably could be linked to this one #47006
Zig has it's own build system:
zig build
it will be usefully to have a guix native build system as well when
compiler is merged.
https://ziglang.org/learn/overview/#zig-build-system
It also has a language server https://github.com/zigtools/zls
[-- Attachment #2: Type: text/html, Size: 1414 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* [bug#47006] [PATCH] gnu: Add zig.
2021-03-08 13:11 [bug#47006] [PATCH] gnu: Add zig Leo Prikler
` (5 preceding siblings ...)
2021-05-30 9:32 ` [bug#47006] Zig question Sharlatan Hellseher
@ 2021-09-11 0:01 ` András Vöröskői
2021-09-11 18:45 ` András Vöröskői
6 siblings, 1 reply; 11+ messages in thread
From: András Vöröskői @ 2021-09-11 0:01 UTC (permalink / raw)
To: 47006
Hi,
I have also spent some time with zig, having hard time with tests too.
I can reproduce the "FileNotFound" error :-) I have a rpi4 running
guix on top of Alpine and the failing test was aarch64-linux-gnu.
After disabling it I got an other LLD related error and gave up.
Now, I am trying -Dskip-non-native=true, so far so good, but I also
want to try if -Dskip-libc.
BTW I would not recommend skipping ReleaseFast builds, maybe
ReleaseSmall is the least interesting one.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [bug#47006] [PATCH] gnu: Add zig.
2021-09-11 0:01 ` [bug#47006] [PATCH] gnu: Add zig András Vöröskői
@ 2021-09-11 18:45 ` András Vöröskői
0 siblings, 0 replies; 11+ messages in thread
From: András Vöröskői @ 2021-09-11 18:45 UTC (permalink / raw)
To: 47006
Hi,
So zig testing result is the following:
-Dskip-libc does not work, my best result is with -Dskip-non-native.
-Dskip-non-native fails with "libc headers note" test from
`compile_errors.zig` (I had to comment it around line 2750) and std
library tests also fails instantaneously.
So I suggest the following test command for now: `zig build
-Dskip-non-native test-toolchain` with a patch to disable that failing
test. This will test everything except the std library and docs.
^ permalink raw reply [flat|nested] 11+ messages in thread