sysroot and lib-path

Alan Modra amodra@gmail.com
Fri Nov 9 00:16:00 GMT 2018


On Thu, Nov 08, 2018 at 08:23:25AM +0100, Christer Solskogen wrote:
> Hi!
> 
> I'm a bit confused on how binutils (or really ld.bfd / gold)  works when
> building a cross compiler.
> For instance, if I build binutils like this:
> --target=arm-linux-gnueabihf
> --with-sysroot=/opt/cross/sysroot.arm-linux-gnueabihf
> 
>  /opt/cross/bin/arm-linux-gnueabihf-ld --verbose | grep SEAR
> SEARCH_DIR("=/opt/cross/arm-linux-gnueabihf/lib");
> SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");

You don't get the first SEARCH_DIR line you show if you are using the
FSF binutils sources with the configure options you state.  I suspect
you also configured with --prefix=/opt/cross.

> Why is directories on the host in SEARCH_DIR? And not
> $sysroot/lib:$sysroot:usr/lib ?

But these are all in the sysroot.  The sysroot is substituted for the
'=' in the search paths by ld.  This allows ld's configure time
sysroot to be overridden on the ld command line with --sysroot=.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list