开发者

Linux application - minimize the dependencies

I am trying to minimize the dependencies caused by the shared library mysql++. I know it sounds strange; but I am struggling to solve a platform limitation on Slamd64 ( with 32bit compatibility installed ), where it natively doesn't have certain libraries. I am in a situation where I cannot alter the setup of libmysq开发者_Python百科lclient due to dependencies to other applications.

Instructions to make mysql++ library link statically to it dependencies, that's what I am trying to do. NOT trying to link statically my application to mysql++; I still want to link dynamically to mysql++.


This is not very easy. You will need to

  1. get a list of .a libraries, which are needed for distibution (don't add here system installed libs, like libc.a)
  2. compile all .a staticly, but with -fPIC enabled
  3. link all .a into one .so
  4. check, can you ldd this .so and load it into application

There can be a workaround with using ENV LD_LIBRARY_PATH and LD_PRELOAD. They can help you to mask out system-wide library and point application to your libs. Just google for this variables.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜