all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jesse Millwood <jesse_m@fastmail.com>
To: help-guix@gnu.org
Subject: Re: Help with channel build system and package
Date: Sat, 9 Mar 2024 09:44:39 -0500	[thread overview]
Message-ID: <32c52408-e111-44b7-a03b-cfa10ab09c15@fastmail.com> (raw)
In-Reply-To: <3564583.iIbC2pHGDl@akashi>

Marek,

Thanks for the detailed response! I really appreciate it.

I responded inline. Is your main source of knowledge the official Guix 
documentation?

On 3/8/24 05:43, Marek Paśnikowski wrote:
> 08.03.2024 03:35:11 CET Jesse Millwood:
>> I'm still trying to get this to work. I tracked some things I forgot and
>> now have my channel hosted at:
>> https://codeberg.org/moonling/guix-embedded-dev
>>
>> When I try to build my toolchain package I get this:
>>
>> ➜ guix build -v 4 -L guix-embedded-dev ct-ng-riscv64-unknown-elf
>> substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0%
>> substitute: updating substitutes from 'https://bordeaux.guix.gnu.org'...
>> 100.0%
>> The following derivation will be built:
>> /gnu/store/wm1jba8npfb9jiqsbzd50gz4c89n3gjm-ct-ng-riscv64-unknown-elf-1.26.0
>> .drv building
>> /gnu/store/wm1jba8npfb9jiqsbzd50gz4c89n3gjm-ct-ng-riscv64-unknown-elf-1.26.0
>> .drv... Backtrace:
>>              3 (primitive-load "/gnu/store/kghq1xz3wyb509944y9jd8vhy0l?")
>> In ice-9/eval.scm:
>>      191:27  2 (_ #f)
>>      223:20  1 (proc #<directory (guile-user) 7ffff77f7c80>)
>> In unknown file:
>>              0 (%resolve-variable (7 . gexp) #<directory (guile-user) ?>)
>>
>> ERROR: In procedure %resolve-variable:
>> Unbound variable: gexp
>> builder for
>> `/gnu/store/wm1jba8npfb9jiqsbzd50gz4c89n3gjm-ct-ng-riscv64-unknown-elf-1.26.
>> 0.drv' failed with exit code 1
>> build of
>> /gnu/store/wm1jba8npfb9jiqsbzd50gz4c89n3gjm-ct-ng-riscv64-unknown-elf-1.26.0
>> .drv failed
>> View build log at
>> '/var/log/guix/drvs/wm/1jba8npfb9jiqsbzd50gz4c89n3gjm-ct-ng-riscv64-unknown-
>> elf-1.26.0.drv.gz'. guix build: error: build of
>> `/gnu/store/wm1jba8npfb9jiqsbzd50gz4c89n3gjm-ct-ng-riscv64-unknown-elf-1.26.
>> 0.drv' failed
>>
>>
>> It seems the issue here is an unbound variable "gexp". I'm a little
>> confused about this because I have #:use-module (guix gexp) included in
>> my package and build-system/crosstool-ng.scm files. The backtrace is a
>> little hard to follow.
> I am self-learning Scheme and yet confident in my skills, so take what I am
> about to write with a dose of healthy scepticism.
I am very much self learning as well. I've been comparing build system 
files and package files in my channel with upstream ones and pouring 
over the documentation. Any tips are very welcome!
> 1. From the error message alone, I do not know whether the unresolved variable
> is actually in the crosstool-ng package file, or anywhere else.
>
> 2. "gexp" or its alias "#~" do not occur in the body of the package module.
> However, the module does depend, among others that I trust to be correct, on
> the crosstool-ng build system.  There is a potential for the unresolved
> variable to live there.
Oh interesting, I didn't know "#~" was an alias for "gexp"! I see that 
now in the G-Expressions section of the manual.
> 3. Upon opening the build-system file, I was quickly drawn to the nested gexp
> in the definition of build procedure.  It took me some reading of the
> documentation to somewhat understand what the #$@(sexp-gexp modules) form is.
> My current understanding is that it brings an externally defined list of
> modules.
Interesting, this is a line that I didn't quite understand and mainly 
took from similar build systems in the guix source.
> 4. The (crosstool-ng-build name inputs _) definition does contain what appears
> to be a "modules" binding to a list of modules.  That list does NOT contain
> (guix gexp), and this in turn makes #~(crosstool-ng-build _) form unreadable
> to the interpreter.  Do mind that at this point the interpreter is not running
> inside the build-system file — it is working on a staged code of #~(begin _).
Oh this is very good information, thanks!
> 5. My proposed solution is to include (guix gexp) in the (define* (crosstool-
> ng-build name inputs _ (modules)) form.  I have tested the change at the last
> minute — guix no longer complains about unresolved variables, but there is a
> new error about "no code for module (guix gexp)".  More work needs to be put
> into the code overall.

Very interesting, thanks for trying that out! I'll incorporate it and 
keep digging!I do wonder why this is not included in other build systems 
in Guix? For example in guix/build-system/ruby.scm:

(define %ruby-build-system-modules ;; Build-side modules imported by 
default. `((guix build ruby-build-system) ,@%gnu-build-system-modules))

...

(define* (ruby-build name inputs #:key source (gem-flags ''()) 
(test-target "test") (tests? #t) (phases '%standard-phases) (outputs 
'("out")) (search-paths '()) (system (%current-system)) (guile #f) 
(imported-modules %ruby-build-system-modules) (modules '((guix build 
ruby-build-system) (guix build utils))))

This is one that I have been basing my crosstool-ng build system on. I 
appreciate your analysis!

> PS: I would appreciate it if someone who feels confident in their Scheme
> knowledge could grade my line of reasoning.  This is my first ever attempt to
> debug completely foreign code.

  reply	other threads:[~2024-03-09 14:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-08  3:27 Help with channel build system and package Jesse
2024-02-08  3:37 ` Carlo Zancanaro
2024-02-08 14:32   ` Jesse
2024-02-08 17:00     ` Marek Paśnikowski
2024-02-08 18:33       ` Jesse Millwood
2024-02-08 18:52         ` Marek Paśnikowski
2024-02-15 13:23           ` Jesse
2024-03-08  2:35             ` Jesse Millwood
2024-03-08 10:43               ` Marek Paśnikowski
2024-03-09 14:44                 ` Jesse Millwood [this message]
2024-03-09  3:39               ` Richard Sent
2024-03-09 15:02                 ` Jesse Millwood
2024-03-16 21:47                   ` Jesse Millwood
2024-03-16 22:50                     ` Jesse Millwood

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=32c52408-e111-44b7-a03b-cfa10ab09c15@fastmail.com \
    --to=jesse_m@fastmail.com \
    --cc=help-guix@gnu.org \
    /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.