I think you are making this more complicated than it needs to be.

First, if we start asking how often is it needed... I doubt often, but
I never ever needed stdbuf before and now it doesnt work for 100% of
my needs.
A bugreport shouldnt be the place to discuss this, but its a
limitation of a tool that IMHO isnt necessary.

To your solution:
LD_PRELOAD_{32,64} is not an option since its not supported on debian
(Jessie atleast). A elegant soluton would be to drop the path and
install the libraries to
the correct multilib locations:

/usr/lib/i386-linux-gnu/libstdbuf.so
/usr/lib/x86_64-linux-gnu/libstdbuf.so

This would naturally extend to further architectures (x32?, even
cross-emulation one day?)

Also I wouldnt even bother with even cross-compiling.

Just split the library to its own "libstdbuf" package, and add this as
dependency for coreutils.
Then change the stdbuf tool to set LD_PRELOAD=libstdbuf.so

Installing coreutils will only install the native (64bit) library,
after installing libstdbuf:i386 (or x32) the tool will
automatically pick the right dll for all architectures.

coreutils:amd64
/usr/lib/i386-linux-gnu/libstdbuf.so (libstdbuf:i386)
/usr/lib/x86_64-linux-gnu/libstdbuf.so (libstdbuf:amd64)

Doesnt sound like a big deal to me, and this is pretty much a packaging thing.
Doubt you need to change a single bit in autotools.

2016-07-28 16:53 GMT+02:00 Pádraig Brady <p...@draigbrady.com>:
> On 28/07/16 15:20, Norbert Lange wrote:
>> Package: coreutils
>> Version: 8.25-2
>> Severity: normal
>>
>> Dear Maintainer,
>>
>> I am trying to use stdbuf tool on a 32bit Binary, this will result
>> in a failure:
>>
>> ERROR: ld.so: object '/usr/lib/x86_64-linux-gnu/coreutils/libstdbuf.so' from 
>> LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
>>
>> To make this work seemlessly,
>> LD_PRELOAD would need to be used with the plain library libstdbuf.so
>> and the library would need to be installed in the proper locations
>> for 64 and 32bit.
>>
>> Likely this would mean using a seperate binary package for the library to
>> allow co-installing both?
>
> Notes on this upstream at http://bugs.gnu.org/8960
>
> Stuff I noted previously...
>
> You can't install coreutils 32 bit and 64 bit together,
> so to support this the libs would need to be separated out to a separate 
> package.
> I.E. one would have a coreutils package that depended on
> coreutils-lib.i686 and coreutils-lib.x86_64, which would
> install to /usr/lib{,64}/coreutils/libstbuf.so respectively.
> Then you would have the flexibility to set both LD_PRELOAD_{32,64}
>
> Currently we don't support separate (per arch) libs because of:
> http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=e23f1795
> So we'd have to revert that essentially as automake
> is too restrictive here and may support the orig var in newer versions?
>
> We might also have to adjust setting of PKGLIBEXECDIR at build time?
>
> Is this complexity worth it? How often does 64 bit coreutils
> need to control buffering for 32 bit programs?
> We've not been asked for that flexibility at present.
>

Reply via email to