On 16 Apr 2020, at 00:16, Константин Аладышев aladyshev22@gmail.com wrote:
Hello! I know, this is probably a very stupid question, but I couldn't find an answer for it. On the page https://releases.linaro.org/components/toolchain/binaries/latest-5/arm-linux... there are 3 major download components: gcc/sysroot/runtime.
This is a good question. Googling “sysroot vs runtime” I’ve found this presentation, worth taking a look to learn about cross-toolchains (which Linaro toolchains are).
https://elinux.org/images/1/15/Anatomy_of_Cross-Compilation_Toolchains.pdf
BTW, gcc-5 is ancient, and hasn’t been support for a long time. Consider switching to a toolchain based on GCC-9.
I download 'gcc', add 'gcc-linaro-.../bin' to my PATH and cross compile my apps. On my target system, I need 'libc', and it is present in the 'sysroot-linaro-...'. Do I need to copy all of the contents of 'sysroot-linaro-...' folder to my target?
The runtime is a subset of sysroot. You need to copy runtime to your target /if you use dynamic linking/. You can use “ldd” utility to identify libraries that your application depends on and only copy those (i.e., no need to copy libpthread.so for single-threaded application or libstc++.so for C application).
'linaro-sysroot' folder is kinda big. 'libc.so' library is 13MB.
Yes, glibc is big. If you have a single application, you could try statically linking, which will bring in only the parts of libraries that your application depends on. However if your application consists of 2-3 binaries, then using shared libraries gives more disk and RAM savings than static linking.
If there is a way to decrease its size, if I want to use Linaro compiled programs on an embedded target? And what is a purpose of 'runtime-linaro-..." component?
Regards,
-- Maxim Kuvyrkov https://www.linaro.org