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: Thu, 7 Mar 2024 21:35:11 -0500	[thread overview]
Message-ID: <b7dcaa02-4ba6-4e23-a002-698aa6e42ba4@fastmail.com> (raw)
In-Reply-To: <71333165-cb1a-40b2-aee0-70eb68ded67a@millwood.earth>

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.

When I search for unbound variable: gexp I do find some posts that refer 
to unbound variable: ungexp like here 
https://lists.gnu.org/archive/html/help-guix/2019-06/msg00073.html

It seems to be associated with making a file during the build phase. I 
do have this in my package:

(define-public ct-ng-riscv64-unknown-elf
   (package
     (name "ct-ng-riscv64-unknown-elf")
     (source (plain-file "defconfig" "\
CT_CONFIG_VERSION=\"4\"\n
CT_EXPERIMENTAL=y\n
CT_ARCH_RISCV=y\n
# CT_DEMULTILIB is not set\n
CT_ARCH_USE_MMU=y\n
CT_ARCH_64=y\n
CT_DEBUG_GDB=y\n
# CT_GDB_CROSS_PYTHON is not set\n"
))
     (version "1.26.0")
     (build-system crosstool-ng-build-system)
     (synopsis "A crosstool-ng based riscv64 unknown elf toolchain")
     (description "A crosstool-ng based riscv64 unknown elf toolchain")
     (home-page "https://crosstool-ng.github.io/docs/")
     (license (list gpl2 gpl2+ gpl3+ lgpl2.1 lgpl3+))
     ))

I'm wondering if the "plain-file" part is not used properly. I did read 
in the guix docs that "source"

> An object telling how the source code for the package should be 
> acquired. Most of the time, this is an |origin| object, which denotes 
> a file fetched from the Internet (see |origin| Reference 
> <https://guix.gnu.org/manual/en/guix.html#origin-Reference>). It can 
> also be any other “file-like” object such as a |local-file|, which 
> denotes a file from the local file system (see |local-file| 
> <https://guix.gnu.org/manual/en/guix.html#G_002dExpressions>). 
I couldn't find any examples using a "plain-file" but it should be a 
file-like object I think.

If anything sticks out to anyone please send a message,

Jesse

On 2/15/24 08:23, Jesse wrote:
>> About the warnings of invalid argument list: comment out the argument 
>> lists in
>> the toolchain packages (I do not remember fully the names, I do not 
>> have acces
>> to the big computer right now for easy reference). See how the change 
>> effects
>> the build.
>>
>> I learned a lot by intentionally breaking code and reading the errors.
>>
> I ended up trying that, removing the arguments from the package, but I 
> did not get any change in the output.
>
> One thing I did try is trying to build with the repl. I made this 
> script, named build-repl.scm:
>
> (use-modules
>  (guix store)
>  (guix derivations)
>  (guix packages)
>  ;;(embedded-dev packages)
>  )
>
> (define (build-packages packages)
>   (with-store store
>     (let ((builds (map (lambda (package)
>                          (package-derivation store package))
>                        packages)))
>       (build-derivations store builds))))
> (define (build-package package)
>   (build-packages (list package)))
>
> Which i got from here: 
> https://lists.gnu.org/archive/html/help-guix/2020-06/msg00173.html
>
> I don't seem to be able to use my channel here for some reason but I 
> think I got around that later.
>
> For context, this is my directory layout:
>
> embedded-dev-chan
> ├── build-repl.scm
> ├── .guix-channel
> └── embedded-dev
>     ├── build
>     │   └── crosstool-ng-build-system.scm
>     ├── build-system
>     │   └── crosstool-ng.scm
>     └── packages
>         └── crosstool-ng.scm
>
> My understanding is that by adding embedded-dev-chan to the load path 
> I should be able to use the guile files inside with something like 
> (use-modules embedded-dev packages crosstool-ng).
>
> I invoked the repl: guix repl -L /home/jesse/Code/embedded-dev-chan
>
> Then I loaded the "build-repl.scm" script and tried to build my package:
>
> scheme@(guix-user)> ,load 
> /home/jesse/Code/embedded-dev-chan/build-repl.scm
> scheme@(guix-user) [2]> (use-modules (embedded-dev packages 
> crosstool-ng))
> While compiling expression:
> Syntax error:
> unknown location: lambda*: invalid argument list in subform ((phases 
> (quote %standard-phases)) (outputs (quote ("out"))) (search-paths 
> (quote ())) (system (%current-system)) (guile #f) (imported-modules 
> %crosstool-ng-build-system-modules) (modules (quote ((embedded-dev 
> build crosstool-ng-build-system) (guix build utils))))) of (name 
> inputs (phases (quote %standard-phases)) (outputs (quote ("out"))) 
> (search-paths (quote ())) (system (%current-system)) (guile #f) 
> (imported-modules %crosstool-ng-build-system-modules) (modules (quote 
> ((embedded-dev build crosstool-ng-build-system) (guix build utils)))))
>
> This seems like it is giving me a little more to go off of. I 
> pretified the output a bit:
>
> ((phases
>   (quote %standard-phases))
>  (outputs (quote ("out")))
>  (search-paths (quote ()))
>  (system (%current-system))
>  (guile #f)
>  (imported-modules %crosstool-ng-build-system-modules)
>  (modules
>   (quote ((embedded-dev build crosstool-ng-build-system)
>           (guix build utils)))))
>
> of
>
> (name
>  inputs
>  (phases (quote %standard-phases))
>  (outputs (quote ("out")))
>  (search-paths (quote ()))
>  (system (%current-system))
>  (guile #f)
>  (imported-modules %crosstool-ng-build-system-modules)
>  (modules (quote ((embedded-dev build crosstool-ng-build-system)
>                   (guix build utils)))))
>
>
> I'm not quite sure what this is trying to tell me. It seems like it is 
> an issue around here in embedded-dev/build-system/crosstool-ng.scm:
>
> (define* (crosstool-ng-build name inputs
>                              (phases '%standard-phases)
>                              (outputs '("out"))
>                              (search-paths '())
>                              (system (%current-system))
>                              (guile #f)
>                              (imported-modules 
> %crosstool-ng-build-system-modules)
>                              (modules '((embedded-dev build 
> crosstool-ng-build-system)
>                                         (guix build utils)))
>                              )
>   "Build Crosstool-ng toolchain"
>
>   (define build
>     #~(begin
>         (use-modules #$@(sexp->gexp modules))
>
>         #$(with-build-variables inputs outputs
>             #~(crosstool-ng-build #:name #$name
>                                   #:source #+source
>                                   #:system #$system
>                                   #:phases #$(if (pair? phases)
>                                                  (sexp->gexp phases)
>                                                  phases)
>                                   #:outputs %outputs
>                                   #:search-paths '#$(sexp->gexp
>                                                      (map
> search-path-specification->sexp
> search-paths))
>                                   #:inputs %build-inputs))))
>
>   (mlet %store-monad ((guile (package->derivation (or guile 
> (default-guile))
>                                                   system #:graft? #f)))
>     (gexp->derivation name build
>                       #:system system
>                       #:target #f
>                       #:modules imported-modules
>                       #:guile-for-build guile)))
>
>
> My first thought was that there was a mismatch between the arguments 
> of crosstool-ng-build -> build -> gexp->derivation. But the arguments 
> all seem to match up. I compared to build-system/ruby.scm and that 
> part seems really close to that as well except for some arguments that 
> seem like they are ruby specific.
>
> There must be some nuance that I'm missing here.
>
> Jesse

  reply	other threads:[~2024-03-08  2:35 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 [this message]
2024-03-08 10:43               ` Marek Paśnikowski
2024-03-09 14:44                 ` Jesse Millwood
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=b7dcaa02-4ba6-4e23-a002-698aa6e42ba4@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.