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
- get a list of .a libraries, which are needed for distibution (don't add here system installed libs, like libc.a)
- compile all .a staticly, but with -fPIC enabled
- link all .a into one .so
- 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.
精彩评论