bug-guix
[Top][All Lists]
Advanced

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

bug#31221: Cross compiling perl with guix pack fails


From: Chris Marusich
Subject: bug#31221: Cross compiling perl with guix pack fails
Date: Sat, 21 Apr 2018 14:23:18 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Hi Raphaël,

Thank you for the information!

Raphaël Mélotte <address@hidden> writes:

> starting phase `remove-extra-references'
> ...
> In unknown file:
>            1 (string-append "incpth='" #f "/include'\n")
> ...
> In procedure string-append: Wrong type (expecting string): #f

The Perl package definition contains the following:

  (add-after 'install 'remove-extra-references
    (lambda* (#:key inputs outputs #:allow-other-keys)
      (let* ((out     (assoc-ref outputs "out"))
             (libc    (assoc-ref inputs "libc"))
             (config1 (car (find-files (string-append out "/lib/perl5")
                                       "^Config_heavy\\.pl$")))
             (config2 (find-files (string-append out "/lib/perl5")
                                  "^Config\\.pm$")))
        ;; Force the library search path to contain only libc because
        ;; it is recorded in Config.pm and Config_heavy.pl; 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
          (("^incpth=.*$")
           (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
                                      "/lib',\n"))))
                  config2)
        #t)))

It seems likely that (assoc-ref inputs "libc") is evaluating to #f
during the build.  You can check if this is the case by using Guile's
undocumented "pk" procedure ("pk" is short for "peek stuff").  For
example, change this line

             (libc    (assoc-ref inputs "libc"))

to this:

             (libc    (pk (assoc-ref inputs "libc")))

Assuming that's the problem, the next question is: why is it happening?
Probably, something about the cross-compilation is causing "libc" to be
removed from the inputs.

After looking around in places like guix/packages.scm,
guix/build-system/gnu.scm, and guix/build/gnu-build-system.scm, it looks
like maybe what we need to do is check to see if we're cross-compiling,
and then try to get "cross-libc" instead of "libc" from the inputs.

It turns out that we already do this for some packages, like the shadow
package.  We probably just need to do the same kind of thing shadow is
doing in its "set-nscd-file-name" phase, which looks like this:

  (add-before 'build 'set-nscd-file-name
    (lambda* (#:key inputs #:allow-other-keys)
      ;; Use the right file name for nscd.
      (let ((libc (assoc-ref inputs
                             ,(if (%current-target-system)
                                  "cross-libc"
                                  "libc"))))
        (substitute* "lib/nscd.c"
          (("/usr/sbin/nscd")
           (string-append libc "/sbin/nscd"))))))

I would make a patch and test this myself for Perl, but I recently ran
Guix pull, so it's taking me hours to build anything.  I'll have to get
back to you later with a fix because of that delay.  Please feel free to
try making the change yourself in the meantime!

-- 
Chris

Attachment: signature.asc
Description: PGP signature


reply via email to

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