unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Chris Marusich <cmmarusich@gmail.com>
To: "Raphaël Mélotte" <raphael.melotte@gmail.com>
Cc: 31221@debbugs.gnu.org
Subject: bug#31221: Cross compiling perl with guix pack fails
Date: Sat, 21 Apr 2018 14:23:18 -0700	[thread overview]
Message-ID: <8736zouud5.fsf@gmail.com> (raw)
In-Reply-To: <CA+68scui5_yMhvJyus8Na0ou3nevNPQVQB8Lc1gbGCJz5VWR4g@mail.gmail.com> ("Raphaël Mélotte"'s message of "Thu, 19 Apr 2018 22:58:49 +0200")

[-- Attachment #1: Type: text/plain, Size: 3374 bytes --]

Hi Raphaël,

Thank you for the information!

Raphaël Mélotte <raphael.melotte@gmail.com> 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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2018-04-21 21:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-19 20:58 bug#31221: Cross compiling perl with guix pack fails Raphaël Mélotte
2018-04-21 21:23 ` Chris Marusich [this message]
2018-04-22 19:53 ` Ludovic Courtès
2018-06-20  8:45 ` Raphaël Mélotte

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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8736zouud5.fsf@gmail.com \
    --to=cmmarusich@gmail.com \
    --cc=31221@debbugs.gnu.org \
    --cc=raphael.melotte@gmail.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).