I'm working with QT and embedded devices and in many documentation items ( like here) they are talking about sysroots. I've searched the web but I couldn't find anything about what a sysroot is. I have a cross-compiler-toolchain though. What's a sysroot and how do I create one ?
A sysroot is a scaled down version of your target's filesystem, it need only contain the libraries and headers which you will compile/link against. There are many ways to set up a sysroot, one is to copy the /usr and /lib directories from your target to somewhere on your host filesystem.
Sysroot¶ The matching target sysroot contains needed headers and libraries for generating binaries that run on the target architecture. The sysroot is based on the target root filesystem image that is built by the OpenEmbedded build system and uses the same Metadata configuration used to build the cross-toolchain.
The –sysroot=<dir> option tells the compiler to prepend both header and library default directories with <dir>. This option affects the linker too since it also changes the search location for libraries. Then, the linker also has to support this option.
A sysroot is a directory which is considered to be the root directory for the purpose of locating headers and libraries. So for example if your build toolchain wants to find /usr/include/foo.h
but you are cross-compiling and the appropriate foo.h
is in /my/other/place/usr/include/foo.h
, you would use /my/other/place
as your sysroot.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With