sysroot and lib-path

Christer Solskogen christer.solskogen@gmail.com
Thu Nov 8 07:23:00 GMT 2018


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");

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

/opt/cross/bin/arm-linux-gnueabihf-ld --print-sysroot
/opt/cross/sysroot.arm-linux-gnueabihf

I see that LFS (Linux from scratch) adds --with-lib-path to configure 
their temporary cross compiler, but their way confuses me even more as 
they point their lib-path to somewhere on the host system that will 
contain libraries for the host and not for the target.



More information about the Binutils mailing list