Boost logo

Boost-Build :

Subject: Re: [Boost-build] gcc.jam broken on 64-bit FreeBSD
From: Vladimir Prus (ghost_at_[hidden])
Date: 2009-08-17 02:01:36


On Saturday 25 July 2009 Vladimir Prus wrote:

> On Monday 20 July 2009 Steve M. Robbins wrote:
>
> > > > It appears that I have to get rid of the lib32 stuff, to get the linker
> > > > to do the right thing, otherwise I get lots of these messages:
> > > >
> > > > /libexec/ld-elf.so.1: /usr/lib32/libm.so.5: unsupported file layout
> > > >
> > > > This is an obvious build/run problem with the LD_RUN_PATH; FreeBSD
> > > > 64-bit binaries cannot dynamically link with 32-bit binaries,
> > > > unless they use some form of explicit thunk. FreeBSD's rtld will
> > > > not thunk on its own.
> > >
> > > Do you happen to know why Linux does not have any problems on 64-bit
> > > platforms? Is there some fundamental difference in behaviour, or
> > > something else?
> >
> > I'm reasonably certain that Linux will have the same problem, *if* the
> > 32-bit libs are installed. I don't have them installed, for example,
> > so the "Debian-Sid" regression testing works [1].
>
> This does not match my experiments. I have tries with an install of a custom
> compiler, and got this:
>
> ike1:x$ echo $LD_LIBRARY_PATH
> /home/gcc/install/sourceryg++/4.3-177/i386-linux/i686-pc-linux-gnu/lib:/home/gcc/install/sourceryg++/4.3-177/i386-linux/i686-pc-linux-gnu/lib64
>
> ike1:x$ ldd a32
> ...
> libstdc++.so.6 => /home/gcc/install/sourceryg++/4.3-177/i386-linux/i686-pc-linux-gnu/lib/libstdc++.so.6 (0xf7e4c000)
> ...
> ike1:x$ ldd a64
> ...
> libstdc++.so.6 => /home/gcc/install/sourceryg++/4.3-177/i386-linux/i686-pc-linux-gnu/lib64/libstdc++.so.6 (0x00007f17ad5f1000)
> .../lib/ld-linux.so.2
>
> So, it looks like Linux dynamic loader will ignore 32-bit libraries when the application is 64-bit. Note that
> while the toolchain is custom, the binaries use the system-wide loader, /lib/ld-linux.so.2, so
> this behaviour is not something we've changed.
>
> This behaviour seems perfectly sane to me. If I install custom toolchain with 32-bit and 64-bit
> libraries, I probably want to set LD_LIBRARY_PATH once, and have the binaries work whether
> I build them with -m32 or -m64 -- which naturally requires that dynamic linker ignores
> libraries of wrong bitness.
>
> Therefore, it appears this behaviour is FreeBSD-specific pecularity, and, presumably,
> should have FreeBSD-specific fix.

Steve,

do you have any comments on my experiments above. I still believe that the best
solution is to have an option to 'using gcc' that controls automatic addition
of LD_LIBRARY_PATH, but it would be ideal (including for deciding default behaviour),
to understand if BSD different from Linux here.

Thanks,
Volodya


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk