Currently I have a setup where there is a 3rd-party supplied shared library, libfoo.so
. Internally this links in (without using something like --whole-archive
) a static library (specifically Intel performance primitives) ipps.a
. This is third party so cannot be modified.
I then build a separate shared library, libbar.so
, which also statically links ipps.a
. These two libraries are eventually (along with some others) linked into a plugin, plugin.so
, which is then loaded at runtime.
Unfortunately this (sometimes) causes runtime issues (I've seen both hanging in the initialization function called when IPP starts up, as well as corrupted data) due to the fact that there are functions from ipps.a
that exist in both libbar.so
and libfoo.so
.
What are the options to deal with this, given that I can't modify the third-party library?
CodePudding user response:
What are the options to deal with this, given that I can't modify the third-party library?
Both you and the 3rd party developer have committed a sin -- you are exposing symbols from ipps.a
in your own interface (this is the default on UNIX).
You should hide these symbols instead, using e.g. a linker version script. Example.
If you hide all the ipps.a
symbols in libbar.so
, then the fact that libfoo.so
was also linked with ipps.a
should become irrelevant.