GNU bug report logs - #73979
validate-runpath phases fails when binaries linked to package's own libraries

Previous Next

Package: guix;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Thu, 24 Oct 2024 06:03:02 UTC

Severity: normal

Tags: notabug

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: bug#73979: closed (Re: bug#73979: validate-runpath phases fails
 when binaries linked to package's own libraries)
Date: Thu, 19 Dec 2024 05:12:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#73979: validate-runpath phases fails when binaries linked to package's own libraries

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 73979 <at> debbugs.gnu.org.

-- 
73979: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73979
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 73979-done <at> debbugs.gnu.org
Subject: Re: bug#73979: validate-runpath phases fails when binaries linked
 to package's own libraries
Date: Thu, 19 Dec 2024 14:10:21 +0900
Hi Ludovic,

Ludovic Courtès <ludo <at> gnu.org> writes:

> Hi,
>
> Maxim Cournoyer <maxim.cournoyer <at> gmail.com> skribis:
>
>> There's a common pattern in packages where the validate-runpath phases
>> fail, which is when a binary is linked to libraries provided by the same
>> package.  In this case, our ld-wrapper script appears to not bake the
>> required runpath, which then fails the validate-runpath phase.
>>
>> When this happens, the common workaround is adding link directives such
>> as (string-append "-Wl,-rpath=" #$output "/lib/subdir") to LDFLAGS (see
>> for example the 'dmraid' package definition).
>
> I believe this is the exception, not the rule, and I see that as a bug
> in the build system of those packages.  (As a counterexample, any
> package built with Automake/Libtool is fine.)

Interesting.  I had not considered that point of view (that the build
system/usage of it could be at cause) enough; I think you are right.

[...]

>> One idea could be to allow creating rpaths to %BUILD-DIRECTORY prefixed
>> libraries, and have these entries refined in a phase that would run
>> after the package is installed, before the validate-runpath phase runs.
>> It could be called e.g. 'sanitize-runpath' and proceed along those
>> lines:
>>
>> Scan for RUNPATH entries being prefixed by %BUILD-DIRECTORY; attempt to
>> have them rewritten to libraries (.so) found under the package's own
>> libdir library prefix (at any depth), including a potential "lib"
>> output.  In case it couldn't, it would error.
>>
>> Does that sound feasible?
>
> It might be feasible, but I think it’s the wrong approach.  The problem
> here is in the build system itself; Guix is “not at fault”, so to speak.
>
> Nevertheless, from a practical viewpoint, whether or not Guix is at
> fault is largely irrelevant.  So the question becomes: how widespread is
> this issue?  If it’s widespread, can it be solved at a (guix
> build-system …) level?  (For instance, I think ‘cmake-build-system’ and
> ‘meson-build-system’ do the right things in that regard.)

I think CMake nowadays doesn't relink but uses some ELF-patching code to
patch the installed binaries in place (which is faster than relinking);
that would mean our ld-wrapper doesn't get involved in these case and we
depend on RPATH being enabled in the CMake build system, which it
normally is unless the package set CMAKE_SKIP_RPATH to false.  I guess
Meson is also patching binaries for speed.

> If it’s a per-package issue, which seems to be the case given what you
> describe, then I would fix it locally in this package, for instance by
> passing ‘-Wl,-rpath=$ORIGIN/../lib’ or whatever is convenient.

There doesn't seem to be so many occurrences; grepping for
'-Wl,-rpath.*output' I find 73 problematic packages.  I've found one
place where this happens is for Cythonized shared objects; this produced
shared objects linked to a library of the build directory, and is not
concerned with installing so nothing rewrites the runpath entries to
their correct installed location.  One such example is openpmix; the
issue was dismissed as "we expect people to set LD_LIBRARY_PATH" [0].

[0]  https://github.com/openpmix/openpmix/issues/3457

Anyway, sorry for the wall of text.  Closing!

-- 
Thanks,
Maxim

[Message part 3 (message/rfc822, inline)]
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: bug-guix <bug-guix <at> gnu.org>
Subject: validate-runpath phases fails when binaries linked to package's own
 libraries
Date: Thu, 24 Oct 2024 15:01:11 +0900
Hi,

There's a common pattern in packages where the validate-runpath phases
fail, which is when a binary is linked to libraries provided by the same
package.  In this case, our ld-wrapper script appears to not bake the
required runpath, which then fails the validate-runpath phase.

When this happens, the common workaround is adding link directives such
as (string-append "-Wl,-rpath=" #$output "/lib/subdir") to LDFLAGS (see
for example the 'dmraid' package definition).

Here's a recent example, attempting to build TORCS:

--8<---------------cut here---------------start------------->8---
starting phase `validate-runpath'
validating RUNPATH of 32 binaries in "/gnu/store/q25qb3r6kzhn9w7mac9i9gn4gg45c7v1-torcs-1.3.7/lib"...
/gnu/store/q25qb3r6kzhn9w7mac9i9gn4gg45c7v1-torcs-1.3.7/lib/torcs/accc-bin: error: depends on 'libtgf.so', which cannot be found in RUNPATH ("/gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/lib" "/gnu/store/zzpbp6rr43smwxzvzd4qd317z5j7qblj-gcc-11.4.0-lib/lib" "/gnu/store/9lp5m2znnqizy6qmp8zjm9gbb9ymvdf5-openal-1.23.1/lib" "/gnu/store/jy396n8qkdlh4cwzjk4avwrppdm2mmiw-freealut-1.1.0/lib" "/gnu/store/vfijqdrwz8yv3kk3k2609q94n3icpf8f-libvorbis-1.3.7/lib" "/gnu/store/3nqlh3kjqybdz3mbzmvsm0piv66ny738-freeglut-3.4.0/lib" "/gnu/store/bi3haj8fvqf6hzd869rl8hk0nf8w3ga0-glu-9.0.2/lib" "/gnu/store/2p06ia11gyldx3icmha2hf3dq1qwkz0k-mesa-24.0.4/lib" "/gnu/store/qj9jhgqn2b9g7yxdhyw6ki1vz241apkd-libpng-1.6.39/lib" "/gnu/store/1prv14v6jfnzzg7szm57690b7fr6sx33-zlib-1.3/lib" "/gnu/store/mf7d6fvd8nvzic48w9f52fx66gyarjg8-libxrandr-1.5.2/lib" "/gnu/store/c5w905pbjn95pwq2c4saz3n1yznin3lz-libxrender-0.9.10/lib" "/gnu/store/51fnk9g8zki9nrwsjrzfr0xjifp3h1hd-libxxf86vm-1.1.4/lib" "/gnu/store/ky3706gprafiahyn1yqdq087chxjacq3-libxmu-1.1.3/lib" "/gnu/store/70l83y7s875fgvavlw4w5hfgq4av94jl-libxi-1.7.10/lib" "/gnu/store/sf1wl7rqra4yd362x8jg8zx60d4vbfbc-libxt-1.2.1/lib" "/gnu/store/4fm7z0h1vzznvli671gy1w4md0jbb4f0-libsm-1.2.3/lib" "/gnu/store/p8h3d3ayrrhwlnp0k88zmmzvbncvvba2-libice-1.1.1/lib" "/gnu/store/bqk5b108p6wxd5iwmn080zjcfav48wmr-libxext-1.3.4/lib" "/gnu/store/4775wjc2972kiwfsq710fv5pfzyc5laq-libx11-1.8.7/lib" "/gnu/store/zzpbp6rr43smwxzvzd4qd317z5j7qblj-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0/../../..")
/gnu/store/q25qb3r6kzhn9w7mac9i9gn4gg45c7v1-torcs-1.3.7/lib/torcs/accc-bin: error: depends on 'libtxml.so', which cannot be found in RUNPATH ("/gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/lib" "/gnu/store/zzpbp6rr43smwxzvzd4qd317z5j7qblj-gcc-11.4.0-lib/lib" "/gnu/store/9lp5m2znnqizy6qmp8zjm9gbb9ymvdf5-openal-1.23.1/lib" "/gnu/store/jy396n8qkdlh4cwzjk4avwrppdm2mmiw-freealut-1.1.0/lib" "/gnu/store/vfijqdrwz8yv3kk3k2609q94n3icpf8f-libvorbis-1.3.7/lib" "/gnu/store/3nqlh3kjqybdz3mbzmvsm0piv66ny738-freeglut-3.4.0/lib" "/gnu/store/bi3haj8fvqf6hzd869rl8hk0nf8w3ga0-glu-9.0.2/lib" "/gnu/store/2p06ia11gyldx3icmha2hf3dq1qwkz0k-mesa-24.0.4/lib" "/gnu/store/qj9jhgqn2b9g7yxdhyw6ki1vz241apkd-libpng-1.6.39/lib" "/gnu/store/1prv14v6jfnzzg7szm57690b7fr6sx33-zlib-1.3/lib" "/gnu/store/mf7d6fvd8nvzic48w9f52fx66gyarjg8-libxrandr-1.5.2/lib" "/gnu/store/c5w905pbjn95pwq2c4saz3n1yznin3lz-libxrender-0.9.10/lib" "/gnu/store/51fnk9g8zki9nrwsjrzfr0xjifp3h1hd-libxxf86vm-1.1.4/lib" "/gnu/store/ky3706gprafiahyn1yqdq087chxjacq3-libxmu-1.1.3/lib" "/gnu/store/70l83y7s875fgvavlw4w5hfgq4av94jl-libxi-1.7.10/lib" "/gnu/store/sf1wl7rqra4yd362x8jg8zx60d4vbfbc-libxt-1.2.1/lib" "/gnu/store/4fm7z0h1vzznvli671gy1w4md0jbb4f0-libsm-1.2.3/lib" "/gnu/store/p8h3d3ayrrhwlnp0k88zmmzvbncvvba2-libice-1.1.1/lib" "/gnu/store/bqk5b108p6wxd5iwmn080zjcfav48wmr-libxext-1.3.4/lib" "/gnu/store/4775wjc2972kiwfsq710fv5pfzyc5laq-libx11-1.8.7/lib" "/gnu/store/zzpbp6rr43smwxzvzd4qd317z5j7qblj-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0/../../..")

[...]

/gnu/store/q25qb3r6kzhn9w7mac9i9gn4gg45c7v1-torcs-1.3.7/lib/torcs/trackgen-bin: error: depends on 'libtxml.so', which cannot be found in RUNPATH ("/gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/lib" "/gnu/store/zzpbp6rr43smwxzvzd4qd317z5j7qblj-gcc-11.4.0-lib/lib" "/gnu/store/9lp5m2znnqizy6qmp8zjm9gbb9ymvdf5-openal-1.23.1/lib" "/gnu/store/jy396n8qkdlh4cwzjk4avwrppdm2mmiw-freealut-1.1.0/lib" "/gnu/store/vfijqdrwz8yv3kk3k2609q94n3icpf8f-libvorbis-1.3.7/lib" "/gnu/store/3nqlh3kjqybdz3mbzmvsm0piv66ny738-freeglut-3.4.0/lib" "/gnu/store/bi3haj8fvqf6hzd869rl8hk0nf8w3ga0-glu-9.0.2/lib" "/gnu/store/2p06ia11gyldx3icmha2hf3dq1qwkz0k-mesa-24.0.4/lib" "/gnu/store/qj9jhgqn2b9g7yxdhyw6ki1vz241apkd-libpng-1.6.39/lib" "/gnu/store/1prv14v6jfnzzg7szm57690b7fr6sx33-zlib-1.3/lib" "/gnu/store/mf7d6fvd8nvzic48w9f52fx66gyarjg8-libxrandr-1.5.2/lib" "/gnu/store/c5w905pbjn95pwq2c4saz3n1yznin3lz-libxrender-0.9.10/lib" "/gnu/store/51fnk9g8zki9nrwsjrzfr0xjifp3h1hd-libxxf86vm-1.1.4/lib" "/gnu/store/ky3706gprafiahyn1yqdq087chxjacq3-libxmu-1.1.3/lib" "/gnu/store/70l83y7s875fgvavlw4w5hfgq4av94jl-libxi-1.7.10/lib" "/gnu/store/sf1wl7rqra4yd362x8jg8zx60d4vbfbc-libxt-1.2.1/lib" "/gnu/store/4fm7z0h1vzznvli671gy1w4md0jbb4f0-libsm-1.2.3/lib" "/gnu/store/p8h3d3ayrrhwlnp0k88zmmzvbncvvba2-libice-1.1.1/lib" "/gnu/store/bqk5b108p6wxd5iwmn080zjcfav48wmr-libxext-1.3.4/lib" "/gnu/store/4775wjc2972kiwfsq710fv5pfzyc5laq-libx11-1.8.7/lib" "/gnu/store/zzpbp6rr43smwxzvzd4qd317z5j7qblj-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0/../../..")
validating RUNPATH of 0 binaries in "/gnu/store/q25qb3r6kzhn9w7mac9i9gn4gg45c7v1-torcs-1.3.7/bin"...
error: in phase 'validate-runpath': uncaught exception:
misc-error #f "RUNPATH validation failed" () #f
--8<---------------cut here---------------end--------------->8---

Here's what the link command for the problematic accc-bin binary looks
like, when the GUIX_LD_WRAPPER_DEBUG environment variable is set during
its build:

--8<---------------cut here---------------start------------->8---
g++ mainaccc.o ../../linux/linuxspec.o ac3dload.o ac3dgroup.o -L/tmp/guix-build-torcs-1.3.7.drv-0/torcs-1.3.7/export/lib  -lopenal -lalut -lvorbisfile -L/usr/lib  -ltgf -lplibssg -lplibsg -lplibul -ltxml -lplibjs -lplibssgaux -lplibssg -lplibsm -lplibsl -lplibsg -lplibul -lglut -lGLU -lGL -lpng -lz -ldl -lXrandr -lXrender -lXxf86vm -lXmu -lXi -lXt -lSM -lICE -lXext -lX11 -lm  -o accc-bin

ld-wrapper: library search path: ("/tmp/guix-build-torcs-1.3.7.drv-0/torcs-1.3.7/export/lib" "/usr/lib" "/gnu/store/jy396n8qkdlh4cwzjk4avwrppdm2mmiw-freealut-1.1.0/lib" "/gnu/store/3nqlh3kjqybdz3mbzmvsm0piv66ny738-freeglut-3.4.0/lib" "/gnu/store/p8h3d3ayrrhwlnp0k88zmmzvbncvvba2-libice-1.1.1/lib" "/gnu/store/qj9jhgqn2b9g7yxdhyw6ki1vz241apkd-libpng-1.6.39/lib" "/gnu/store/4fm7z0h1vzznvli671gy1w4md0jbb4f0-libsm-1.2.3/lib" "/gnu/store/vfijqdrwz8yv3kk3k2609q94n3icpf8f-libvorbis-1.3.7/lib" "/gnu/store/70l83y7s875fgvavlw4w5hfgq4av94jl-libxi-1.7.10/lib" "/gnu/store/ky3706gprafiahyn1yqdq087chxjacq3-libxmu-1.1.3/lib" "/gnu/store/mf7d6fvd8nvzic48w9f52fx66gyarjg8-libxrandr-1.5.2/lib" "/gnu/store/c5w905pbjn95pwq2c4saz3n1yznin3lz-libxrender-0.9.10/lib" "/gnu/store/sf1wl7rqra4yd362x8jg8zx60d4vbfbc-libxt-1.2.1/lib" "/gnu/store/2p06ia11gyldx3icmha2hf3dq1qwkz0k-mesa-24.0.4/lib" "/gnu/store/9lp5m2znnqizy6qmp8zjm9gbb9ymvdf5-openal-1.23.1/lib" "/gnu/store/qpnsrgksm6x4r5gna1ys5ndyw6i2702y-plib-1.8.5/lib" "/gnu/store/1prv14v6jfnzzg7szm57690b7fr6sx33-zlib-1.3/lib" "/gnu/store/56aq6sdx35f7rsxq8jq9ypafk0dhd3p3-bzip2-1.0.8/lib" "/gnu/store/544ga5n6nq8y2961ihigra6n6a0r99nn-file-5.45/lib" "/gnu/store/vrl2r0ps24k1a6yap2chjylv5rhbndvr-gawk-5.3.0/lib" "/gnu/store/fbaw0sb21gv02qq7gs9wg5y5wlpdgzih-xz-5.4.5/lib" "/gnu/store/ylgkrq9j1gyfig2y66srmgsbyh9w20d9-binutils-2.41/lib" "/gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/lib" "/gnu/store/vqdiyyqbrv4akp68pfya4j6m3pdbnhca-glibc-2.39-static/lib" "/gnu/store/bi3haj8fvqf6hzd869rl8hk0nf8w3ga0-glu-9.0.2/lib" "/gnu/store/3ifn85jhvw3389fpqpv7dybrgg0l7n1w-libogg-1.3.5/lib" "/gnu/store/q2pikqgf8h5iwxsqs8gqvnn2i55fxz43-libxfixes-6.0.0/lib" "/gnu/store/bqk5b108p6wxd5iwmn080zjcfav48wmr-libxext-1.3.4/lib" "/gnu/store/4775wjc2972kiwfsq710fv5pfzyc5laq-libx11-1.8.7/lib" "/gnu/store/51fnk9g8zki9nrwsjrzfr0xjifp3h1hd-libxxf86vm-1.1.4/lib" "/gnu/store/pwgqamvs69ihaz8637i6l15j12zi1282-libxshmfence-1.3/lib" "/gnu/store/y9xx5ks01hxfn4aqbbn7cix1rbs9040b-libxdamage-1.1.5/lib" "/gnu/store/87yw5bz6mx2ddj97zhgcn2k6lyzi6prr-libvdpau-1.5/lib" "/gnu/store/17p7fhm5p0yh07dsinqnj6q436g6h9yq-libdrm-2.4.120/lib" "/gnu/store/w0mwibxna4hbh8n8cdx5kinsazbm7w5j-util-macros-1.19.3/lib" "/gnu/store/y5a0l9a3z214yar8q7mznqqd4pnw0vvp-libxcb-1.15/lib" "/gnu/store/an3mrydqv3x9kzkv45jcay0jh301v06q-libpciaccess-0.16/lib" "/gnu/store/v712yc2mwkc10m1nzgjz3linnvl5i1dh-libxdmcp-1.1.3/lib" "/gnu/store/wxwv020jwxq9gr070vwy3fh8n028gwqg-libxau-1.0.10/lib" "/gnu/store/v6idf8ad18h01dryqin9r40k1jbhh1lb-libpthread-stubs-0.4/lib" "/gnu/store/zzpbp6rr43smwxzvzd4qd317z5j7qblj-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0" "/gnu/store/zzpbp6rr43smwxzvzd4qd317z5j7qblj-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0/../../.." "/gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/lib" "/gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/lib")

ld-wrapper: libraries linked: ("/gnu/store/9lp5m2znnqizy6qmp8zjm9gbb9ymvdf5-openal-1.23.1/lib/libopenal.so" "/gnu/store/jy396n8qkdlh4cwzjk4avwrppdm2mmiw-freealut-1.1.0/lib/libalut.so" "/gnu/store/vfijqdrwz8yv3kk3k2609q94n3icpf8f-libvorbis-1.3.7/lib/libvorbisfile.so" "/tmp/guix-build-torcs-1.3.7.drv-0/torcs-1.3.7/export/lib/libtgf.so" "/tmp/guix-build-torcs-1.3.7.drv-0/torcs-1.3.7/export/lib/libtxml.so" "/gnu/store/3nqlh3kjqybdz3mbzmvsm0piv66ny738-freeglut-3.4.0/lib/libglut.so" "/gnu/store/bi3haj8fvqf6hzd869rl8hk0nf8w3ga0-glu-9.0.2/lib/libGLU.so" "/gnu/store/2p06ia11gyldx3icmha2hf3dq1qwkz0k-mesa-24.0.4/lib/libGL.so" "/gnu/store/qj9jhgqn2b9g7yxdhyw6ki1vz241apkd-libpng-1.6.39/lib/libpng.so" "/gnu/store/1prv14v6jfnzzg7szm57690b7fr6sx33-zlib-1.3/lib/libz.so" "/gnu/store/mf7d6fvd8nvzic48w9f52fx66gyarjg8-libxrandr-1.5.2/lib/libXrandr.so" "/gnu/store/c5w905pbjn95pwq2c4saz3n1yznin3lz-libxrender-0.9.10/lib/libXrender.so" "/gnu/store/51fnk9g8zki9nrwsjrzfr0xjifp3h1hd-libxxf86vm-1.1.4/lib/libXxf86vm.so" "/gnu/store/ky3706gprafiahyn1yqdq087chxjacq3-libxmu-1.1.3/lib/libXmu.so" "/gnu/store/70l83y7s875fgvavlw4w5hfgq4av94jl-libxi-1.7.10/lib/libXi.so" "/gnu/store/sf1wl7rqra4yd362x8jg8zx60d4vbfbc-libxt-1.2.1/lib/libXt.so" "/gnu/store/4fm7z0h1vzznvli671gy1w4md0jbb4f0-libsm-1.2.3/lib/libSM.so" "/gnu/store/p8h3d3ayrrhwlnp0k88zmmzvbncvvba2-libice-1.1.1/lib/libICE.so" "/gnu/store/bqk5b108p6wxd5iwmn080zjcfav48wmr-libxext-1.3.4/lib/libXext.so" "/gnu/store/4775wjc2972kiwfsq710fv5pfzyc5laq-libx11-1.8.7/lib/libX11.so" "/gnu/store/zzpbp6rr43smwxzvzd4qd317z5j7qblj-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0/../../../libstdc++.so" "/gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/lib/libm.so" "/gnu/store/zzpbp6rr43smwxzvzd4qd317z5j7qblj-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0/../../../libgcc_s.so" "/gnu/store/zzpbp6rr43smwxzvzd4qd317z5j7qblj-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0/../../../libgcc_s.so" "/gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/lib/libc.so" "/gnu/store/zzpbp6rr43smwxzvzd4qd317z5j7qblj-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0/../../../libgcc_s.so")

ld-wrapper: invoking `/gnu/store/ylgkrq9j1gyfig2y66srmgsbyh9w20d9-binutils-2.41/bin/ld' with ("-plugin" "/gnu/store/86fc8bi3mciljxz7c79jx8zr4wsx7xw8-gcc-11.4.0/libexec/gcc/x86_64-unknown-linux-gnu/11.4.0/liblto_plugin.so" "-plugin-opt=/gnu/store/86fc8bi3mciljxz7c79jx8zr4wsx7xw8-gcc-11.4.0/libexec/gcc/x86_64-unknown-linux-gnu/11.4.0/lto-wrapper" "-plugin-opt=-fresolution=/tmp/guix-build-torcs-1.3.7.drv-0/ccPooqSE.res" "-plugin-opt=-pass-through=-lgcc_s" "-plugin-opt=-pass-through=-lgcc" "-plugin-opt=-pass-through=-lgcc_s" "-plugin-opt=-pass-through=-lc" "-plugin-opt=-pass-through=-lgcc_s" "-plugin-opt=-pass-through=-lgcc" "--eh-frame-hdr" "-m" "elf_x86_64" "-dynamic-linker" "/gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/lib/ld-linux-x86-64.so.2" "-o" "accc-bin" "/gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/lib/crt1.o" "/gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/lib/crti.o" "/gnu/store/zzpbp6rr43smwxzvzd4qd317z5j7qblj-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0/crtbegin.o" "-L/tmp/guix-build-torcs-1.3.7.drv-0/torcs-1.3.7/export/lib" "-L/usr/lib" "-L/gnu/store/jy396n8qkdlh4cwzjk4avwrppdm2mmiw-freealut-1.1.0/lib" "-L/gnu/store/3nqlh3kjqybdz3mbzmvsm0piv66ny738-freeglut-3.4.0/lib" "-L/gnu/store/p8h3d3ayrrhwlnp0k88zmmzvbncvvba2-libice-1.1.1/lib" "-L/gnu/store/qj9jhgqn2b9g7yxdhyw6ki1vz241apkd-libpng-1.6.39/lib" "-L/gnu/store/4fm7z0h1vzznvli671gy1w4md0jbb4f0-libsm-1.2.3/lib" "-L/gnu/store/vfijqdrwz8yv3kk3k2609q94n3icpf8f-libvorbis-1.3.7/lib" "-L/gnu/store/70l83y7s875fgvavlw4w5hfgq4av94jl-libxi-1.7.10/lib" "-L/gnu/store/ky3706gprafiahyn1yqdq087chxjacq3-libxmu-1.1.3/lib" "-L/gnu/store/mf7d6fvd8nvzic48w9f52fx66gyarjg8-libxrandr-1.5.2/lib" "-L/gnu/store/c5w905pbjn95pwq2c4saz3n1yznin3lz-libxrender-0.9.10/lib" "-L/gnu/store/sf1wl7rqra4yd362x8jg8zx60d4vbfbc-libxt-1.2.1/lib" "-L/gnu/store/2p06ia11gyldx3icmha2hf3dq1qwkz0k-mesa-24.0.4/lib" "-L/gnu/store/9lp5m2znnqizy6qmp8zjm9gbb9ymvdf5-openal-1.23.1/lib" "-L/gnu/store/qpnsrgksm6x4r5gna1ys5ndyw6i2702y-plib-1.8.5/lib" "-L/gnu/store/1prv14v6jfnzzg7szm57690b7fr6sx33-zlib-1.3/lib" "-L/gnu/store/56aq6sdx35f7rsxq8jq9ypafk0dhd3p3-bzip2-1.0.8/lib" "-L/gnu/store/544ga5n6nq8y2961ihigra6n6a0r99nn-file-5.45/lib" "-L/gnu/store/vrl2r0ps24k1a6yap2chjylv5rhbndvr-gawk-5.3.0/lib" "-L/gnu/store/fbaw0sb21gv02qq7gs9wg5y5wlpdgzih-xz-5.4.5/lib" "-L/gnu/store/ylgkrq9j1gyfig2y66srmgsbyh9w20d9-binutils-2.41/lib" "-L/gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/lib" "-L/gnu/store/vqdiyyqbrv4akp68pfya4j6m3pdbnhca-glibc-2.39-static/lib" "-L/gnu/store/bi3haj8fvqf6hzd869rl8hk0nf8w3ga0-glu-9.0.2/lib" "-L/gnu/store/3ifn85jhvw3389fpqpv7dybrgg0l7n1w-libogg-1.3.5/lib" "-L/gnu/store/q2pikqgf8h5iwxsqs8gqvnn2i55fxz43-libxfixes-6.0.0/lib" "-L/gnu/store/bqk5b108p6wxd5iwmn080zjcfav48wmr-libxext-1.3.4/lib" "-L/gnu/store/4775wjc2972kiwfsq710fv5pfzyc5laq-libx11-1.8.7/lib" "-L/gnu/store/51fnk9g8zki9nrwsjrzfr0xjifp3h1hd-libxxf86vm-1.1.4/lib" "-L/gnu/store/pwgqamvs69ihaz8637i6l15j12zi1282-libxshmfence-1.3/lib" "-L/gnu/store/y9xx5ks01hxfn4aqbbn7cix1rbs9040b-libxdamage-1.1.5/lib" "-L/gnu/store/87yw5bz6mx2ddj97zhgcn2k6lyzi6prr-libvdpau-1.5/lib" "-L/gnu/store/17p7fhm5p0yh07dsinqnj6q436g6h9yq-libdrm-2.4.120/lib" "-L/gnu/store/w0mwibxna4hbh8n8cdx5kinsazbm7w5j-util-macros-1.19.3/lib" "-L/gnu/store/y5a0l9a3z214yar8q7mznqqd4pnw0vvp-libxcb-1.15/lib" "-L/gnu/store/an3mrydqv3x9kzkv45jcay0jh301v06q-libpciaccess-0.16/lib" "-L/gnu/store/v712yc2mwkc10m1nzgjz3linnvl5i1dh-libxdmcp-1.1.3/lib" "-L/gnu/store/wxwv020jwxq9gr070vwy3fh8n028gwqg-libxau-1.0.10/lib" "-L/gnu/store/v6idf8ad18h01dryqin9r40k1jbhh1lb-libpthread-stubs-0.4/lib" "-L/gnu/store/zzpbp6rr43smwxzvzd4qd317z5j7qblj-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0" "-L/gnu/store/zzpbp6rr43smwxzvzd4qd317z5j7qblj-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0/../../.." "-L/gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/lib" "mainaccc.o" "../../linux/linuxspec.o" "ac3dload.o" "ac3dgroup.o" "-lopenal" "-lalut" "-lvorbisfile" "-ltgf" "-lplibssg" "-lplibsg" "-lplibul" "-ltxml" "-lplibjs" "-lplibssgaux" "-lplibssg" "-lplibsm" "-lplibsl" "-lplibsg" "-lplibul" "-lglut" "-lGLU" "-lGL" "-lpng" "-lz" "-ldl" "-lXrandr" "-lXrender" "-lXxf86vm" "-lXmu" "-lXi" "-lXt" "-lSM" "-lICE" "-lXext" "-lX11" "-lstdc++" "-lm" "-lgcc_s" "-lgcc" "-L/gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/lib" "-rpath=/gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/lib" "-rpath=/gnu/store/zzpbp6rr43smwxzvzd4qd317z5j7qblj-gcc-11.4.0-lib/lib" "-lgcc_s" "-lc" "-lgcc_s" "-lgcc" "/gnu/store/zzpbp6rr43smwxzvzd4qd317z5j7qblj-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0/crtend.o" "/gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/lib/crtn.o" "-rpath" "/gnu/store/9lp5m2znnqizy6qmp8zjm9gbb9ymvdf5-openal-1.23.1/lib" "-rpath" "/gnu/store/jy396n8qkdlh4cwzjk4avwrppdm2mmiw-freealut-1.1.0/lib" "-rpath" "/gnu/store/vfijqdrwz8yv3kk3k2609q94n3icpf8f-libvorbis-1.3.7/lib" "-rpath" "/gnu/store/3nqlh3kjqybdz3mbzmvsm0piv66ny738-freeglut-3.4.0/lib" "-rpath" "/gnu/store/bi3haj8fvqf6hzd869rl8hk0nf8w3ga0-glu-9.0.2/lib" "-rpath" "/gnu/store/2p06ia11gyldx3icmha2hf3dq1qwkz0k-mesa-24.0.4/lib" "-rpath" "/gnu/store/qj9jhgqn2b9g7yxdhyw6ki1vz241apkd-libpng-1.6.39/lib" "-rpath" "/gnu/store/1prv14v6jfnzzg7szm57690b7fr6sx33-zlib-1.3/lib" "-rpath" "/gnu/store/mf7d6fvd8nvzic48w9f52fx66gyarjg8-libxrandr-1.5.2/lib" "-rpath" "/gnu/store/c5w905pbjn95pwq2c4saz3n1yznin3lz-libxrender-0.9.10/lib" "-rpath" "/gnu/store/51fnk9g8zki9nrwsjrzfr0xjifp3h1hd-libxxf86vm-1.1.4/lib" "-rpath" "/gnu/store/ky3706gprafiahyn1yqdq087chxjacq3-libxmu-1.1.3/lib" "-rpath" "/gnu/store/70l83y7s875fgvavlw4w5hfgq4av94jl-libxi-1.7.10/lib" "-rpath" "/gnu/store/sf1wl7rqra4yd362x8jg8zx60d4vbfbc-libxt-1.2.1/lib" "-rpath" "/gnu/store/4fm7z0h1vzznvli671gy1w4md0jbb4f0-libsm-1.2.3/lib" "-rpath" "/gnu/store/p8h3d3ayrrhwlnp0k88zmmzvbncvvba2-libice-1.1.1/lib" "-rpath" "/gnu/store/bqk5b108p6wxd5iwmn080zjcfav48wmr-libxext-1.3.4/lib" "-rpath" "/gnu/store/4775wjc2972kiwfsq710fv5pfzyc5laq-libx11-1.8.7/lib" "-rpath" "/gnu/store/zzpbp6rr43smwxzvzd4qd317z5j7qblj-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0/../../.." "-rpath" "/gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/lib" "-rpath" "/gnu/store/zzpbp6rr43smwxzvzd4qd317z5j7qblj-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0/../../.." "-rpath" "/gnu/store/zzpbp6rr43smwxzvzd4qd317z5j7qblj-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0/../../.." "-rpath" "/gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/lib" "-rpath" "/gnu/store/zzpbp6rr43smwxzvzd4qd317z5j7qblj-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0/../../..")
--8<---------------cut here---------------end--------------->8---

So we see that ld-wrapper saw the accc-bin binary being linked against
the package's own
/tmp/guix-build-torcs-1.3.7.drv-0/torcs-1.3.7/export/lib/libtgf.so, but
this is later dismissed for "not being in the store", by this code in
gnu/packages/ld-wrapper.in:

--8<---------------cut here---------------start------------->8---
(define (rpath-arguments library-files)
  ;; Return the `-rpath' argument list for each of LIBRARY-FILES, a list of
  ;; absolute file names.
  (fold-right (lambda (file args)
                ;; Add '-rpath' if and only if FILE is in the store; we don't
                ;; want to add '-rpath' for files under %BUILD-DIRECTORY or
                ;; %TEMPORARY-DIRECTORY because that could leak to installed
                ;; files.
                (cond ((and (not %disable-rpath?)
                            (store-file-name? file))
                       (cons* "-rpath" (dirname file) args))
                      ((or %allow-impurities?
                           (pure-file-name? file))
                       args)
                      (else
                       (begin
                         (format (current-error-port)
                                 "ld-wrapper: error: attempt to use \
library outside of ~a: ~s~%"
                                 %store-directory file)
                         (exit 1)))))
              '()
              library-files))
--8<---------------cut here---------------end--------------->8---

(pure-file-name? x) returns #t (it considers build directory files as
"pure"), but the args is not augmented with -rpath in this case, so the
link directives are simply skipped.

One idea could be to allow creating rpaths to %BUILD-DIRECTORY prefixed
libraries, and have these entries refined in a phase that would run
after the package is installed, before the validate-runpath phase runs.
It could be called e.g. 'sanitize-runpath' and proceed along those
lines:

Scan for RUNPATH entries being prefixed by %BUILD-DIRECTORY; attempt to
have them rewritten to libraries (.so) found under the package's own
libdir library prefix (at any depth), including a potential "lib"
output.  In case it couldn't, it would error.

Does that sound feasible?

-- 
Thanks,
Maxim



This bug report was last modified 157 days ago.

Previous Next


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