Subject: bug#20102: closed (Re: bug#20102: Problem with ld.so RUNPATH on armhf)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 14 Jul 2015 13:33:04 +0000

Your bug report

#20102: Problem with ld.so RUNPATH on armhf

which was filed against the guix package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
20102: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20102
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#20102: Problem with ld.so RUNPATH on armhf
From: [email-masked] (Ludovic Courtès)
To: Mark H Weaver <[email-masked]>
Cc: [email-masked]
Date: Tue, 14 Jul 2015 15:32:36 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

[email-masked] (Ludovic Courtès) skribis:

> It happens on x86_64 as well.  Namely, the glibc that is built with
> glibc-final and gcc-final has extra RUNPATH entries:
>
> $ ./pre-inst-env guix build -e '(@ (gnu packages base) glibc)' -K
> [...]
> /gnu/store/pxi61vv6qj325y3zs5qpcy2shykgxdar-glibc-2.21
> /gnu/store/m3qidd4gx7ry3wxagsrd9cwlykq90yi7-glibc-2.21-debug
> $ /gnu/store/pxi61vv6qj325y3zs5qpcy2shykgxdar-glibc-2.21/bin/gencat 
> Inconsistency detected by ld.so: get-dynamic-info.h: 142: elf_get_dynamic_info: Assertion `info[29] == ((void *)0)' failed!
> $ objdump -x /gnu/store/pxi61vv6qj325y3zs5qpcy2shykgxdar-glibc-2.21/bin/gencat |grep PATH
>   RUNPATH              /gnu/store/2bq2qaaajar2f3dbxrrwssxfrfi0k9zr-gcc-4.9.2/libexec/gcc/x86_64-unknown-linux-gnu/4.9.2
>
> After a bit of investigation, I found that the problem came from:
>
>   -plugin /gnu/store/2bq2qaaajar2f3dbxrrwssxfrfi0k9zr-gcc-4.9.2/libexec/gcc/x86_64-unknown-linux-gnu/4.9.2/liblto_plugin.so.0
>
> which led ld-wrapper to add a -rpath flag for that directory.
>
> I’m testing the patch below and will commit tomorrow if everything goes
> well.

The patch was applied as b5616bc a while back, so I’m closing this bug.

Ludo’.

Subject: Problem with ld.so RUNPATH on armhf
From: Mark H Weaver <[email-masked]>
To: [email-masked]
Date: Fri, 13 Mar 2015 14:56:46 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

I recently tried rebuilding Guix on armhf, specifically master since the
recent core-updates merge, and have run into a snag.  I'm able to build
a lot of stuff, including our full 'emacs' package (with Gtk+), but I'm
unable to build 'glibc-utf8-locales', which means I can't build any
profiles at all, because the ca-certificates-bundle uses
glibc-utf8-locales.

Here's what happens when I try to build 'glibc-utf8-locales' manually:

--8<---------------cut here---------------start------------->8---
mhw@novena:~$ guix build -K glibc-utf8-locales
The following derivation will be built:
   /gnu/store/14kf28i9qkzrdjn5m150zk6dxijssk2k-glibc-utf8-locales-2.21.drv
warning: failed to install locale: Invalid argument
@ build-started /gnu/store/14kf28i9qkzrdjn5m150zk6dxijssk2k-glibc-utf8-locales-2.21.drv - armhf-linux /var/log/guix/drvs/14//kf28i9qkzrdjn5m150zk6dxijssk2k-glibc-utf8-locales-2.21.drv.bz2
Inconsistency detected by ld.so: get-dynamic-info.h: 142: elf_get_dynamic_info: Assertion `info[29] == ((void *)0)' failed!
note: keeping build directory `/tmp/nix-build-glibc-utf8-locales-2.21.drv-0'
builder for `/gnu/store/14kf28i9qkzrdjn5m150zk6dxijssk2k-glibc-utf8-locales-2.21.drv' failed with exit code 1
@ build-failed /gnu/store/14kf28i9qkzrdjn5m150zk6dxijssk2k-glibc-utf8-locales-2.21.drv - 1 builder for `/gnu/store/14kf28i9qkzrdjn5m150zk6dxijssk2k-glibc-utf8-locales-2.21.drv' failed with exit code 1
killing process 1498
guix build: error: build failed: build of `/gnu/store/14kf28i9qkzrdjn5m150zk6dxijssk2k-glibc-utf8-locales-2.21.drv' failed
--8<---------------cut here---------------end--------------->8---

The key line being:

Inconsistency detected by ld.so: get-dynamic-info.h: 142: elf_get_dynamic_info: Assertion `info[29] == ((void *)0)' failed!

Here's the relevant bit of code from glibc-2.21/elf/get-dynamic-info.h:

--8<---------------cut here---------------start------------->8---
#ifdef RTLD_BOOTSTRAP
  /* Only the bind now flags are allowed.  */
  assert (info[VERSYMIDX (DT_FLAGS_1)] == NULL
	  || (info[VERSYMIDX (DT_FLAGS_1)]->d_un.d_val & ~DF_1_NOW) == 0);
  assert (info[DT_FLAGS] == NULL
	  || (info[DT_FLAGS]->d_un.d_val & ~DF_BIND_NOW) == 0);
  /* Flags must not be set for ld.so.  */
  assert (info[DT_RUNPATH] == NULL);
  assert (info[DT_RPATH] == NULL);
--8<---------------cut here---------------end--------------->8---

"assert (info[DT_RUNPATH] == NULL)" is the assertion that fails here.

This happens while trying to run 'localedef' from the 'glibc' that's an
input to 'glibc-utf8-locales'.  Interestingly, 'bash' works from the
same store item:

--8<---------------cut here---------------start------------->8---
mhw@novena:/gnu/store/l2bkyclkm0lph48mfs6jbndj9p0y41g8-glibc-2.21/bin$ ./bash 
I have no name!@novena:/gnu/store/l2bkyclkm0lph48mfs6jbndj9p0y41g8-glibc-2.21/bin$ exit
mhw@novena:/gnu/store/l2bkyclkm0lph48mfs6jbndj9p0y41g8-glibc-2.21/bin$ ./localedef 
Inconsistency detected by ld.so: get-dynamic-info.h: 142: elf_get_dynamic_info: Assertion `info[29] == ((void *)0)' failed!
--8<---------------cut here---------------end--------------->8---

readelf reveals that indeed, the ld.so used by localedef,

  /gnu/store/l2bkyclkm0lph48mfs6jbndj9p0y41g8-glibc-2.21/lib/ld-linux-armhf.so.3

does have RUNPATH set:  (excerpt of "readelf -a" output)

--8<---------------cut here---------------start------------->8---
Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  EXIDX          0x01681c 0x0001681c 0x0001681c 0x00098 0x00098 R   0x4
  LOAD           0x000000 0x00000000 0x00000000 0x168b4 0x168b4 R E 0x10000
  LOAD           0x016c80 0x00026c80 0x00026c80 0x00c00 0x00cc8 RW  0x10000
  DYNAMIC        0x016f3c 0x00026f3c 0x00026f3c 0x000c0 0x000c0 RW  0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x10
  GNU_RELRO      0x016c80 0x00026c80 0x00026c80 0x00380 0x00380 R   0x1

 Section to Segment mapping:
  Segment Sections...
   00     .ARM.exidx
   01     .hash .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_d .rel.dyn .rel.plt .plt .text .rodata .ARM.extab .ARM.exidx 
   02     .data.rel.ro .dynamic .got .data .bss
   03     .dynamic
   04
   05     .data.rel.ro .dynamic

Dynamic section at offset 0x16f3c contains 20 entries:
  Tag        Type                         Name/Value
 0x0000000e (SONAME)                     Library soname: [ld-linux-armhf.so.3]
 0x0000001d (RUNPATH)                    Library runpath: [/gnu/store/fbdjazgwy3zyx8qc5z4ag0j78k2d7raw-glibc-2.21/lib]
--8<---------------cut here---------------end--------------->8---

Any ideas what went wrong here?

      Mark