Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a sysroot exactly and how do I create one ?

Tags:

linux

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 ?

like image 397
Teee Avatar asked Oct 07 '16 15:10

Teee


People also ask

What is a Sysroot?

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.

What is Sysroot in yocto?

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.

What is Sysroot in GCC?

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.


Video Answer


1 Answers

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.

like image 79
John Zwinck Avatar answered Sep 21 '22 20:09

John Zwinck