[CMake] Linking problem

Salvatore Iovene salvatore.iovene+cmake at googlemail.com
Wed Nov 7 03:59:45 EST 2007


On 11/7/07, Brandon Van Every <bvanevery at gmail.com> wrote:
> On Nov 7, 2007 2:12 AM, Salvatore Iovene
> <salvatore.iovene+cmake at googlemail.com> wrote:
> > Hi,
> > I'm not 100% sure this is really a CMake related question, but I'll
> > fire it up anyway:
> >
> > I'm building a series of static libraries, name them liba.a, libb.a
> > and libc.a, and linking them into a shared library libfoo.so.
> >
> > Then I'm building libx.a liby.a and libz.a and linking them into the
> > shared libbar.so.
> >
> > Then I have an executable whatever.exe that's linked to to libfoo.so
> > and libbar.so. The linking of the executable fails complaining of
> > certain missing simbols. Some symbols from liba.a are missing in
> > libbar.so.
>
> I'm not a linking expert, but why should static symbols that you
> embedded in libfoo.so be visible to libbar.so?

Because libbar uses libfoo.

> > So far I have "fixed" the issue by linking one of the libs of
> > libfoo.so (say libx.a) to libbar.so. But this smells of nasy
> > workaround.
>
> Why should it be?  You're saying you really don't want those
> underlying static libs to know about each other.  If you want symbols
> from "a" to be visible to everyone, you should be making it a dynamic
> liba.so.

My assumption here is that linking all the static libs liba.a, libb.a
and libc.a in libfoo.so, the symbols in liba, libb and libc will be
visible from libraries that link against libfoo. Maybe this is the
problem?


More information about the CMake mailing list