unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#31221: Cross compiling perl with guix pack fails
@ 2018-04-19 20:58 Raphaël Mélotte
  2018-04-21 21:23 ` Chris Marusich
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Raphaël Mélotte @ 2018-04-19 20:58 UTC (permalink / raw)
  To: 31221

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

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

[-- Attachment #2: Type: text/html, Size: 2716 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#31221: Cross compiling perl with guix pack fails
  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
  2018-04-22 19:53 ` Ludovic Courtès
  2018-06-20  8:45 ` Raphaël Mélotte
  2 siblings, 0 replies; 4+ messages in thread
From: Chris Marusich @ 2018-04-21 21:23 UTC (permalink / raw)
  To: Raphaël Mélotte; +Cc: 31221

[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#31221: Cross compiling perl with guix pack fails
  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
@ 2018-04-22 19:53 ` Ludovic Courtès
  2018-06-20  8:45 ` Raphaël Mélotte
  2 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2018-04-22 19:53 UTC (permalink / raw)
  To: Raphaël Mélotte; +Cc: 31221

Hello,

Raphaël Mélotte <raphael.melotte@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’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#31221: Cross compiling perl with guix pack fails
  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
  2018-04-22 19:53 ` Ludovic Courtès
@ 2018-06-20  8:45 ` Raphaël Mélotte
  2 siblings, 0 replies; 4+ messages in thread
From: Raphaël Mélotte @ 2018-06-20  8:45 UTC (permalink / raw)
  To: 31221

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

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.

[-- Attachment #2: Type: text/html, Size: 868 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-06-20  8:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2018-04-22 19:53 ` Ludovic Courtès
2018-06-20  8:45 ` Raphaël Mélotte

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).