On 2014-04-25 16:07 -0400, Frédéric Brière wrote:

> Package: fakeroot
> Version: 1.20-3
> Followup-For: Bug #636192
>
> Forgive me if I'm mistaken, but fakeroot still does not appear to work
> across architectures (at least the i386 version):
>
>   $ dpkg -s fakeroot | grep ^Arch
>   Architecture: i386
>   $ dpkg -s ascii | grep ^Arch
>   Architecture: amd64
>   $ fakeroot-sysv ascii -v
>   ERROR: ld.so: object 'libfakeroot-sysv.so' from LD_PRELOAD cannot be 
> preloaded: ignored.
>   ascii 3.14
>
>
> Maybe I'm wrong, but I think that the invocation of find in the
> assignment to $PATH was meant to be at runtime, but was instead done at
> compile-time.

Indeed, that is the problem.

> Replacing the hardcoded path list with the `find` command
> from Hilko's patch did the trick for me:
>
>   $ fakeroot-sysv ascii -v
>   ascii 3.14

To recap on that patch:

On 2013-05-20 16:52 +0200, Hilko Bengen wrote:

> The attached set of patches splits off the shared libraries into
> libfakeroot which is made Multi-Arch: same. A change to the fakeroot
> script causes all paths of the co-installed libfakeroot libraries to be
> found and put into the LD_LIBRARY_PATH.
>
> I have successfully tested that this works correctly on an amd64 system
> with both i386 and amd64 binaries. (With version 1.19-2, the i386
> binaries would not get fakerooted.)
>
> With my patch, this is how fakeroot finds the different multiarch paths:
>
>     find /usr/lib -mindepth 1 -maxdepth 1 -type d -name '*-*-gnu*'| sed 
> 's,$,/libfakeroot,' | tr '\n' ':'

Clint's objection was that running find could be rather expensive.

> I consider this to be somewhat of a hack. Perhaps something along the
> lines of
>
>     ( dpkg --print-architecture; dpkg --print-foreign-architectures ) |\
>         xargs -i dpkg-architecture -a{} -qDEB_HOST_MULTIARCH
>
> would be more appropriate...

Well, it would make fakeroot depend on dpkg-dev which is rather
undesirable.

I think the solution is for each libfakeroot:$ARCH to add its directory
to fakeroot's search path via a configuration file.  Actually, those
already exist, namely the /etc/ld.so.conf.d/fakeroot-*.conf files.  So
how about the patch below?

>From 603feb8d60d41f0eb0f80dfba684051e12bb8129 Mon Sep 17 00:00:00 2001
From: Sven Joachim <svenj...@gmx.de>
Date: Wed, 15 Aug 2018 10:14:13 +0200
Subject: [PATCH] Make fakeroot multi-arch aware

Each libfakeroot:$ARCH package already adds an entry to
/etc/ld.so.conf.d/, reuse that for fakeroot's own search path.

Remove the lib{64,32}/fakeroot directories from the search path, since
those do not exist anymore.

Closes: #636192
---
 scripts/fakeroot.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/fakeroot.in b/scripts/fakeroot.in
index eaf3f56..b740b4a 100755
--- a/scripts/fakeroot.in
+++ b/scripts/fakeroot.in
@@ -35,7 +35,7 @@ FAKEROOT_BINDIR=@bindir@
 
 USEABSLIBPATH=@LDPRELOADABS@
 LIB=lib@fakeroot_transformed@@DLSUFFIX@
-PATHS=@libdir@:${FAKEROOT_PREFIX}/lib64/libfakeroot:${FAKEROOT_PREFIX}/lib32/libfakeroot
+PATHS=@libdir@:$(echo $(grep -h ^/ /etc/ld.so.conf.d/fakeroot-*.conf) | sed -e 's/ /:/g')
 FAKED=${FAKEROOT_BINDIR}/@faked_transformed@
 
 FAKED_MODE="unknown-is-root"
-- 
2.18.0

I have left the directory for the native architecture at the front which
causes a duplicate entry.  That should be harmless, but if it is
considered undesirable, it would also be possible to drop @libdir@: from
$PATHS.  In that case fakeroot could even become an arch:all package.

Cheers,
       Sven

Reply via email to