Why do we need a static option to compile native Android applications

I tried to create my own Android application. When I tried to start it, I have an error, this file does not exist. With a little google, I found that I need to put the -static option in compilation. I did it and it worked. But I wonder why these parameters are required? Is this related to cross compilation?

thank

+3
source share
1 answer

The parameter -staticcreates statically linked binary code without any dependencies on shared libraries. This is done if the system on which the connection is being used uses different libraries as the system on which the binary file will work. In most cases, this is a hack to avoid problems with incompatible libraries. The disadvantage of a statically linked binary is that it is much larger than the common linked, and it uses a lot more memory. As a general rule, it’s best to create the right build environment that allows you to dynamically link shared libraries.

+1
source

All Articles