views:

74

answers:

1

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 libmysqlclient 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++.

+2  A: 

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.

osgx
basically not that straight forward as others, especially with a rather complicated slackware mysql package, which combines all ( headers, static libs, dynamic libs, server and client ) into one super package.
CodeMedic
Can you use custom (dynamic) libmysqlclient? Just move all custom libs to another path.
osgx
Thanks osgx; I possibly can, but not viable to keep it that way in build environment and so on.
CodeMedic