help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with channel build system and package


From: Jesse Millwood
Subject: Re: Help with channel build system and package
Date: Thu, 7 Mar 2024 21:35:11 -0500
User-agent: Mozilla Thunderbird

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 via email to

[Prev in Thread] Current Thread [Next in Thread]