0

I am building an autotools application that links to two shared libraries, libA.so and libB.so. Both of them in turn comprise of shared libraries and static (yes, against recommendation static) libraries. The static library, libmetis is contained in both of libA and libB, but unfortunately, different versions.

Say libA.so has libA1.so, libA2.so.... libmetis5.a

Say libB.so has libB1.so, libB2.so.... libmetis4.a

On machine 1, running Ubuntu, the link line for the final application looks like

libtool mode=link application.c -lA -lB -o application

On machine 2, running CentOS, the link line for the final application looks like

libtool mode=link application.c -lA -lA1 -lA2... -lmetis5 -lB -lB1 -lB2... -lmetis4 -o application

Since both libA and libB are relinked from their contituent libraries in machine 2, I end up getting both libA and libB having one and the same version of libmetis, which causes the application to crash.

How can I control or where is the setting that prohibits Libtool from relinking already good to go libraries? I have tried not using autotools only for the application, manually giving the link line, but the behaviour is the same.

Thanks for your help,

Elan

Elan
  • 443
  • 5
  • 14

1 Answers1

0

If you were actually pulling in metris[45] into lib[AB] on CentOS machine 2, then they would not show up on the link line (like they don't under Ubuntu machine 1).

Robert Boehne
  • 271
  • 3
  • 11
  • They shouldn't, but they do. lib[AB] is completely built and exists, which means metis[45] has been incorporated. Then when an application tries to link to lib[AB], lib[AB] is linked again from its constituent object files, unnecessarily. – Elan Nov 12 '12 at 15:22