Subject: Exception in validate-runpath phase

From: Julien Lepiller <[email-masked]>
Date: Mon, 01 Oct 2018 14:53:51 +0200

Hi,

I'm trying to create a new package for openjdk versions we don't have 
yet. While building openjdk 10 on top of core-updates (because gcc on 
master has a bug that prevents building openjdk 9 and 10), I get a 
stacktrace at the end of the validate-runpath phase:

starting phase `validate-runpath'
validating RUNPATH of 74 binaries in 
"/gnu/store/bdgbs6nsb1kzxpqmcxajjkvvkmk5kn72-openjdk-10+46/lib"...
Backtrace:
           11 (primitive-load "/gnu/store/cyxf063m59nb288xnpy94gr4chq…")
In ice-9/eval.scm:
    191:35 10 (_ _)
In srfi/srfi-1.scm:
    863:16  9 (every1 #<procedure 77aaa0 at /gnu/store/p9wwyq2jfq2pi…> …)
In 
/gnu/store/p9wwyq2jfq2piwyc01qgsxm3hsxg2bnv-module-import/guix/build/gnu-build-system.scm:
    799:28  8 (_ _)
    557:16  7 (validate-runpath #:validate-runpath? _ # _ #:outputs _)
In 
/gnu/store/p9wwyq2jfq2piwyc01qgsxm3hsxg2bnv-module-import/guix/build/utils.scm:
    536:23  6 (every* #<procedure validate (directory)> _)
    536:23  5 (every* #<procedure validate-needed-in-runpath (file #…> …)
In ice-9/boot-9.scm:
     829:9  4 (catch srfi-34 #<procedure 1023d40 at /gnu/store/p9wwy…> …)
In 
/gnu/store/p9wwyq2jfq2piwyc01qgsxm3hsxg2bnv-module-import/guix/build/gremlin.scm:
    305:26  3 (_)
In unknown file:
            2 (remove #<procedure libc-library? (lib)> (#))
            1 (find #<procedure 1023b80 at /gnu/store/p9wwyq2jfq2piw…> …)
            0 (string-prefix? "libanl.so" 3659183287175258 #<undefin…> …)

ERROR: In procedure string-prefix?:
In procedure string-prefix?: Wrong type argument in position 2 
(expecting string): 3659183287175258

I tried to investigate the issue and I have found that that running 
(validate-needed-in-runpath "/gnu/...") sometimes fails on some files. 
More specifically, it always succeeds on *.so files and on most 
*.debuginfo files, but it fails on these files:

/gnu/store/bdgbs6nsb1kzxpqmcxajjkvvkmk5kn72-openjdk-10+46/lib/libjsound.debuginfo
/gnu/store/bdgbs6nsb1kzxpqmcxajjkvvkmk5kn72-openjdk-10+46/lib/libjimage.debuginfo
/gnu/store/bdgbs6nsb1kzxpqmcxajjkvvkmk5kn72-openjdk-10+46/lib/libjaas_unix.debuginfo
/gnu/store/bdgbs6nsb1kzxpqmcxajjkvvkmk5kn72-openjdk-10+46/lib/libawt_xawt.debuginfo

with the following backtrace:

scheme@(guix build gremlin)> (validate-needed-in-runpath 
"/gnu/store/bdgbs6nsb1kzxpqmcxajjkvvkmk5kn72-openjdk-10+46/lib/libjsound.debuginfo")
ERROR: In procedure string-prefix?:
In procedure string-prefix?: Wrong type argument in position 2 
(expecting string): 1

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guix build gremlin) [1]> ,bt
In ice-9/boot-9.scm:
     829:9  4 (catch srfi-34 #<procedure 374dd40 at 
guix/build/gremlin.scm:285:2 ()> #<procedure 374dd20 at 
guix/build/gremlin.scm:285:2 (key c)> _)
In guix/build/gremlin.scm:
    305:26  3 (_)
In unknown file:
            2 (remove #<procedure libc-library? (lib)> (1))
            1 (find #<procedure 374db80 at guix/build/gremlin.scm:251:8 
(libc-lib)> ("libanl.so" "libcrypt.so" "libc.so" "libdl.so" "libm.so" 
"libnsl.so" "libp?" ?))
            0 (string-prefix? "libanl.so" 1 #<undefined> #<undefined> 
#<undefined> #<undefined>)

Similarly for libawt_xawt, with the following error message:

In procedure string-prefix?: Wrong type argument in position 2 
(expecting string): 3659183287175258

Then, running:

(elf-dynamic-info (call-with-input-file "libjsoundalsa.debuginfo" 
(compose parse-elf get-bytevector-all)))
$79 = #<<elf-dynamic-info> soname: #f needed: () rpath: () runpath: ()>

(elf-dynamic-info (call-with-input-file "libjsound.debuginfo" (compose 
parse-elf get-bytevector-all)))
$80 = #<<elf-dynamic-info> soname: #f needed: (1) rpath: () runpath: ()>

(elf-dynamic-info (call-with-input-file "libawt_xawt.debuginfo" (compose 
parse-elf get-bytevector-all)))
$81 = #<<elf-dynamic-info> soname: #f needed: (3659183287175258) rpath: 
() runpath: ()>

shows that the number in the exception comes from the needed field. I 
think it should be empty. You can find these three files for comparison 
at:

http://89.234.186.109/guix/libawt_xawt.debuginfo
http://89.234.186.109/guix/libjsoundalsa.debuginfo
http://89.234.186.109/guix/libjsound.debuginfo

Thank you.