perl build commencment

  • Open
  • quality assurance status badge
One participant
Submitted by
T wrote on 30 Mar 2021 18:52
(name . .
I am trying to build a updated skeleton version of perl in a GUIX_PACKAGE-PATH folder, tweaking as necessary. I set up an inferior to add necessary packages. When I try to bulid the package,  i get this error
            :~/.config/guix/local$ guix build -f perl_barebones.scm -K
Updating channel 'guix' from Git repository at ''...
gnu/packages/commencement.scm:2932:30: error: perl: unbound variable
hint: Did you forget `(use-modules (gnu packages perl))'?
 i Have tried to modify the perl_barebones file so that that doesn't happen but it Appears there isn't a way to make perl available to the commencement file to build the bootstrap perl to build perl. It appears there is a flaw in the commencement file. I tried updating guix, and checking with repl to see if it was something else.
I've checked, r/GUIX the IRC and mailing list archives, so i'm pretty sure this a bug, or at least not a known issue. I apologize in advance if this a problem with what i did.
perl_barebone.scm full text:

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <>
;;; Copyright © 2013, 2019, 2020 Andreas Enge <>
;;; Copyright © 2015, 2016, 2017, 2019, 2021 Ricardo Wurmus <>
;;; Copyright © 2015, 2016, 2017, 2019, 2020 Eric Bavier <>
;;; Copyright © 2015 Eric Dvorsak <>
;;; Copyright © 2016, 2018 Mark H Weaver <>
;;; Copyright © 2016 Jochem Raat <>
;;; Copyright © 2016, 2017, 2018, 2019, 2020 Efraim Flashner <>
;;; Copyright © 2016 Nikita <>
;;; Copyright © 2016 Alex Sassmannshausen <>
;;; Copyright © 2016, 2018, 2020 Roel Janssen <>
;;; Copyright © 2016 Ben Woodcroft <>
;;; Copyright © 2016, 2020 Jan (janneke) Nieuwenhuizen <>
;;; Copyright © 2017 Raoul J.P. Bonnal <>
;;; Copyright © 2017, 2018 Marius Bakke <>
;;; Copyright © 2017 Adriano Peluso <>
;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <>
;;; Copyright © 2017 Leo Famulari <>
;;; Copyright © 2017 Christopher Allan Webber <>
;;; Copyright © 2018, 2019 Oleg Pykhalov <>
;;; Copyright © 2018, 2019 Pierre Neidhardt <>
;;; Copyright © 2018 Kei Kebreau <>
;;; Copyright © 2019 Alex Griffin <>
;;; Copyright © 2019 Mathieu Othacehe <>
;;; Copyright © 2019 Stephen J. Scheck <>
;;; Copyright © 2020 Vincent Legoll <>
;;; Copyright © 2020 Paul Garlick <>
;;; Copyright © 2020 Nicolas Goaziou <>
;;; Copyright © 2020 Malte Frank Gerdes <>
;;; Copyright © 2021 Maxim Cournoyer <>
;;; 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
;;; 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
;;; Test version to have updated package refrences

(define-module (gnu packages perl)
  #:use-module (guix inferior)
  #:use-module (guix channels)
  #:use-module (gnu packages package-management)
  ;; #:use-module (gnu packages perl)
  #:use-module (srfi srfi-1)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (gnu packages)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix utils)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system perl)
  #:use-module (gnu packages base)
  #:use-module (gnu packages bash)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages fontutils)
  #:use-module (gnu packages freedesktop)
  #:use-module (gnu packages gd)
  #:use-module (gnu packages gl)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages hurd)
  #:use-module (gnu packages image)
  #:use-module (gnu packages less)
  #:use-module (gnu packages ncurses)
  #:use-module (gnu packages perl-check)
  #:use-module (gnu packages perl-compression)
  #:use-module (gnu packages perl-web)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages readline)
  #:use-module (gnu packages sdl)
  #:use-module (gnu packages textutils)
  #:use-module (gnu packages video)
  #:use-module (gnu packages web)
  #:use-module (gnu packages xorg))

;;; Please: Try to add new module packages in alphabetic order.

;;; In order to make this work outside of the primary channel We need to create a inferior for the channel packages we need.
;;; First we need to define the channel(s)

(define channels
    (list (channel
        (name `guix)
        (commit "414fc58cef4eb9c2cc18a381629d17c5adf76210")
(use-modules (gnu packages perl))

(define inferior
    (inferior-for-channels channels)
    (list (first (lookup-inferior-packages inferior "perl")
    (lookup-inferior-packages inferior "readline")
    (lookup-inferior-packages inferior "bash")

(define-public perl
  ;; Yeah, Perl...  It is required early in the bootstrap process by Linux.
    (name "perl")
    (version "5.32.1")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://cpan/src/5.0/perl-"
                                 version ".tar.gz"))
             (patches (search-patches
    (build-system gnu-build-system)
     `(#:tests? #f
       (let ((out  (assoc-ref %outputs "out"))
             (libc (assoc-ref %build-inputs "libc")))
          (string-append "-Dprefix=" out)
          (string-append "-Dman1dir=" out "/share/man/man1")
          (string-append "-Dman3dir=" out "/share/man/man3")
          "-de" "-Dcc=gcc"
          (string-append "-Dlocincpth=" libc "/include")
          (string-append "-Dloclibpth=" libc "/lib")
       (modify-phases %standard-phases
         (add-before 'configure 'setup-configure
           (lambda _
             ;; Use the right path for `pwd'.
             ;; TODO: use coreutils from INPUTS instead of 'which'
             ;; in next rebuild cycle, see fixup below.
             (substitute* "dist/PathTools/"
                (which "pwd")))

             ;; Build in GNU89 mode to tolerate C++-style comment in libc's
             ;; <bits/string3.h>.
             (substitute* "cflags.SH"
         ,@(if (%current-target-system)
               `((add-after 'unpack 'unpack-cross
                   (lambda* (#:key native-inputs inputs #:allow-other-keys)
                     (let ((cross-checkout
                            (assoc-ref native-inputs "perl-cross"))
                            (assoc-ref native-inputs "perl-cross-patch")))
                       (rename-file "Artistic" "Artistic.perl")
                       (rename-file "Copying" "Copying.perl")
                       (copy-recursively cross-checkout ".")
                       (format #t "Applying ~a\n" cross-patch)
                       (invoke "patch" "-p1" "-i" cross-patch))
                     (let ((bash (assoc-ref inputs "bash")))
                       (substitute* '("Makefile.config.SH"
                         (("! */bin/sh") (string-append "! " bash "/bin/bash"))
                         ((" /bin/sh") (string-append bash "/bin/bash")))
                       (substitute* '("ext/Errno/Errno_pm.PL")
                         (("\\$cpp < errno.c") "$Config{cc} -E errno.c")))
                 (replace 'configure
                   (lambda* (#:key configure-flags outputs inputs #:allow-other-keys)
                     (let* ((out (assoc-ref outputs "out"))
                            (store-directory (%store-directory))
                              ;; `perl-cross' confuses target and host
                              (string-append "--target=" ,(%current-target-system))
                              (string-append "--prefix=" out)
                              (string-append "-Dcc=" ,(%current-target-system) "-gcc")
                              (filter (negate
                                       (lambda (x) (or (string-prefix? "-d" x)
                                                       (string-prefix? "-Dcc=" x))))
                            (bash (assoc-ref inputs "bash"))
                            (coreutils (assoc-ref inputs "coreutils")))
                       (format (current-error-port)
                               "running ./configure ~a\n" (string-join configure-flags))
                       (apply invoke (cons "./configure" configure-flags))
                       (substitute* ""
                         (((string-append store-directory "/[^/]*-bash-[^/]*"))
                       (substitute* '("config.h")
                         (("^#define SH_PATH .*")
                          (string-append  "#define SH_PATH \"" bash "/bin/bash\"\n")))
                       ;;TODO: fix this in setup-configure next rebuild cycle
                       (substitute* "dist/PathTools/"
                         (((string-append store-directory "/[^/]*-coreutils-[^/]*"))
                 (add-after 'build 'touch-non-built-files-for-install
                   (lambda _
                     ;; `make install' wants to install these although they do
                     ;; not get built...
                     (with-directory-excursion "cpan"
                       (mkdir-p "Pod-Usage/blib/script")
                       (mkdir-p "Pod-Parser/blib/script")
                       (for-each (lambda (file)
                                   (call-with-output-file file
                                     (lambda (port) (display "" port))))
               `((replace 'configure
                   (lambda* (#:key configure-flags #:allow-other-keys)
                     (format #t "Perl configure flags: ~s~%" configure-flags)
                     (apply invoke "./Configure" configure-flags)))))
         (add-after 'install 'remove-extra-references
           (lambda* (#:key inputs outputs #:allow-other-keys)
             (let* ((out     (assoc-ref outputs "out"))
                    (libc    (assoc-ref inputs
                                        ,(if (%current-target-system)
                                             "cross-libc" "libc")))
                    (config1 (car (find-files (string-append out "/lib/perl5")
                    (config2 (find-files (string-append out "/lib/perl5")
               ;; Force the library search path to contain only libc because
               ;; it is recorded in and; we don't
               ;; want to keep a reference to everything that's in
               ;; $LIBRARY_PATH at build time (GCC, Binutils, bzip2, file,
               ;; etc.)
               (substitute* config1
                  (string-append "incpth='" libc "/include'\n"))
                 (("^(libpth|plibpth|libspath)=.*$" _ variable)
                  (string-append variable "='" libc "/lib'\n")))

               (for-each (lambda (file)
                           (substitute* config2
                             (("libpth => .*$")
                              (string-append "libpth => '" libc
     (if (%current-target-system)
         `(("bash" ,bash-minimal)
           ("coreutils" ,coreutils))
     (if (%current-target-system)
               (method git-fetch)
               (uri (git-reference
                     (url "")
                     (commit "1.3.5")))
               (file-name (git-file-name "perl-cross" "1.3.5"))
                (base32 "09ggs8m8qya92klmjqs5z6c0q2rqfyv60ip1zvaczz4r5dmnzili"))))
           ("perl-cross-patch" ,@(search-patches "perl-cross.patch")))
    (native-search-paths (list (search-path-specification
                                (variable "PERL5LIB")
                                (files '("lib/perl5/site_perl")))))
    (synopsis "Implementation of the Perl programming language")
     "Perl is a general-purpose programming language originally developed for
text manipulation and now used for a wide range of tasks including system
administration, web development, network programming, GUI development, and
    (home-page "")
    (license license:gpl1+)))                          ; or "Artistic"
(define-public perl-ipc-system-simple
    (name "perl-ipc-system-simple")
    (version "1.30")
    (source (origin
              (method url-fetch)
              (uri (string-append
                    version ".tar.gz"))
    (build-system perl-build-system)
    (synopsis "Run commands simply, with detailed diagnostics")
    (description "Calling Perl's in-built @code{system} function is easy,
determining if it was successful is hard.  Let's face it, @code{$?} isn't the
nicest variable in the world to play with, and even if you do check it,
producing a well-formatted error string takes a lot of work.

@code{IPC::System::Simple} takes the hard work out of calling external
    (license (package-license perl))))
Attachment: file
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to

To respond to this issue using the mumi CLI, first switch to it
mumi current 47502
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch