GNU bug report logs - #31221
Cross compiling perl with guix pack fails

Previous Next

Package: guix;

Reported by: Raphaël Mélotte <raphael.melotte <at> gmail.com>

Date: Thu, 19 Apr 2018 21:08:01 UTC

Severity: normal

Merged with 27149

Done: Jan Nieuwenhuizen <janneke <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 31221 in the body.
You can then email your comments to 31221 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#31221; Package guix. (Thu, 19 Apr 2018 21:08:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Raphaël Mélotte <raphael.melotte <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Thu, 19 Apr 2018 21:08:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Raphaël Mélotte <raphael.melotte <at> gmail.com>
To: bug-guix <at> gnu.org
Subject: Cross compiling perl with guix pack fails
Date: Thu, 19 Apr 2018 22:58:49 +0200
[Message part 1 (text/plain, inline)]
Hello,

I'm trying to make a wireshark package for an old 32bit system where I
cannot install guix but it always fails with the same error. This is the
command I'm using:
guix pack -S /opt/gnu/bin=bin --target=i686-pc-linux-gnu wireshark

And this is the error I get:

starting phase `remove-extra-references'
Backtrace:
          13 (primitive-load "/gnu/store/304qy7gcwfsfsfxi9x98j5kw7i2…")
In ice-9/eval.scm:
   191:35 12 (_ _)
In srfi/srfi-1.scm:
   863:16 11 (every1 #<procedure a40380 at /gnu/store/71d3rwa514j7v…> …)
In
/gnu/store/71d3rwa514j7vy5l4vfivf68g5yxibvl-module-import/guix/build/gnu-build-system.scm:
   711:27 10 (_ _)
In ice-9/eval.scm:
    619:8  9 (_ #(#(#(#(#(#(#<directory (guile-user)…>) …) …) …) …) …))
In ice-9/boot-9.scm:
    841:4  8 (with-throw-handler _ _ _)
In ice-9/ports.scm:
   444:17  7 (call-with-input-file _ _ #:binary _ #:encoding _ # _)
In
/gnu/store/71d3rwa514j7vy5l4vfivf68g5yxibvl-module-import/guix/build/utils.scm:
   610:26  6 (_ _)
   636:26  5 (_ #<input: /gnu/store/fvlb30v6gvm5k8hdmqz7c4g8vaaqvxr…> …)
In srfi/srfi-1.scm:
   466:18  4 (fold #<procedure 7ffff4385530 at /gnu/store/71d3rwa51…> …)
In ice-9/eval.scm:
   202:51  3 (_ #(#(#(#(#(#(#<directory (guile-user)…> …)) …) …) …) …))
    163:9  2 (_ #(#(#(#(#(#(#<directory (guile-user)…> …)) …) …) …) …))
In unknown file:
           1 (string-append "incpth='" #f "/include'\n")
In ice-9/boot-9.scm:
   752:25  0 (dispatch-exception _ _ _)

ice-9/boot-9.scm:752:25: In procedure dispatch-exception:
In procedure string-append: Wrong type (expecting string): #f
builder for `/gnu/store/szkpdjdxalwb793kkbfjibvhxki33x8l-perl-5.26.2.drv'
failed with exit code 1
guix pack: error: build failed: build of
`/gnu/store/szkpdjdxalwb793kkbfjibvhxki33x8l-perl-5.26.2.drv' failed

Since it seems related to perl, I tried running the same guix pack command
for perl only, and it fails with the same error.

I found a reference in the IRC logs about the same kind of error with
another package, but I can't tell if it's really related or not. I'll still
paste that reference here just in case:
https://gnunet.org/bot/log/guix/2015-07-14#T699278

Any clue on how I could debug that ?

Thanks
[Message part 2 (text/html, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#31221; Package guix. (Sat, 21 Apr 2018 21:24:01 GMT) Full text and rfc822 format available.

Message #8 received at 31221 <at> debbugs.gnu.org (full text, mbox):

From: Chris Marusich <cmmarusich <at> gmail.com>
To: Raphaël Mélotte <raphael.melotte <at> gmail.com>
Cc: 31221 <at> debbugs.gnu.org
Subject: Re: bug#31221: Cross compiling perl with guix pack fails
Date: Sat, 21 Apr 2018 14:23:18 -0700
[Message part 1 (text/plain, inline)]
Hi Raphaël,

Thank you for the information!

Raphaël Mélotte <raphael.melotte <at> 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
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#31221; Package guix. (Sun, 22 Apr 2018 19:54:01 GMT) Full text and rfc822 format available.

Message #11 received at 31221 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Raphaël Mélotte <raphael.melotte <at> gmail.com>
Cc: 31221 <at> debbugs.gnu.org
Subject: Re: bug#31221: Cross compiling perl with guix pack fails
Date: Sun, 22 Apr 2018 21:53:51 +0200
Hello,

Raphaël Mélotte <raphael.melotte <at> gmail.com> skribis:

> I'm trying to make a wireshark package for an old 32bit system where I
> cannot install guix but it always fails with the same error. This is the
> command I'm using:
> guix pack -S /opt/gnu/bin=bin --target=i686-pc-linux-gnu wireshark

The analysis of Chris looks correct.

In the meantime, note that if you’re on x86_64, you do not need to
cross-compile to produce i686 binaries.  Instead, you can simply run:

  guix pack … -s i686-linux wireshark

This is because x86_64 can run i686 code just fine, and so guix-daemon
will arrange to make an i686 container.

HTH,
Ludo’.




Merged 27149 31221. Request was from Ricardo Wurmus <rekado <at> elephly.net> to control <at> debbugs.gnu.org. (Mon, 23 Apr 2018 07:53:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#31221; Package guix. (Wed, 20 Jun 2018 08:47:01 GMT) Full text and rfc822 format available.

Message #16 received at 31221 <at> debbugs.gnu.org (full text, mbox):

From: Raphaël Mélotte <raphael.melotte <at> gmail.com>
To: 31221 <at> debbugs.gnu.org
Subject: Re: bug#31221: Cross compiling perl with guix pack fails
Date: Wed, 20 Jun 2018 10:45:37 +0200
[Message part 1 (text/plain, inline)]
Many thanks to both of you to have answered so quickly.

(Sorry I didn't give any news, I have been busy with exams for almost two
month and I didn't even take the time to reply back, but your answers have
been valuable to me.)

It seems you where right: when trying to build with "(pk ...)", I had the
following output: ;;; (#f)

As suggested, I tried using the exact same procedure as in the shadow
package, and the build was successful !

However, I could not really "test" the resulting build, as I only tried
with perl and it took a really long time to cross-compile.

Do you want me to send a patch with the modifications ? I'm not really sure
which branch it should go to.
[Message part 2 (text/html, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 08 Sep 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 202 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.