开发者

Why do we need -static option to compile native android applications

I was trying to build a native android application. When I tried to run it, I got an error this file d开发者_StackOverflow社区oes not exist. With little bit google, I found I need put -static option in compilation. I did so and it worked. But I wonder why is this options is required? Is it anything to do with cross compilation?

Thanks


The option -static produces a statically linked binary without any dependencies to shared libraries. This is done if the system on which the linking takes place uses different libraries as the system on which the binary will run. 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 bigger than a shared linked one and it uses much more memory. Generally it is better to create a proper build environment, which makes it possible to dynamically link the shared libraries.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜