June 2017
Intermediate to advanced
478 pages
13h 14m
English
Static linking is useful in a few circumstances. For example, if you are building a small system which consists of only BusyBox and some script files, it is simpler to link BusyBox statically and avoid having to copy the runtime library files and linker. It will also be smaller because you only link in the code that your application uses rather than supplying the entire C library. Static linking is also useful if you need to run a program before the filesystem that holds the runtime libraries is available.
You tell to link all the libraries statically by adding -static to the command line:
$ arm-cortex_a8-linux-gnueabihf-gcc -static helloworld.c -o helloworld-static
You will note that the size of the binary increases dramatically: ...
Read now
Unlock full access