Broken SO due to dropped dependencies

Ian Lance Taylor iant@google.com
Fri Mar 29 14:02:00 GMT 2013


On Fri, Mar 29, 2013 at 6:18 AM, Miguel Guedes
<miguel.a.guedes@gmail.com> wrote:

> I'm come across a very strange issue concerning building a shared library
> with GCC.
>
> This issue affects a c++ project I'm currently working on, in particular
> an SO component. If I compile this SO using GCC [0] the library
> dependencies are totally different than when compiling the same SO with
> clang [1] using the exact same parameters.
>
> I became aware of this issue when I compiled the SO in question with GCC
> and realised it has broken dependencies; it fails with an `undefined
> symbol' error:
>
> out/src/omnis: symbol lookup error: /home/guedesm/prj/omnis/sh/../out/
> sources/clank/libclank.so: undefined symbol: clang_createIndex
>
> I imagine it's something to do with parameter order; can an enlightened
> guru please shed some light on this?

Are you using the -flto option?

If not, when generating a shared library, GCC and presumably clang
largely defer to the linker.  So, what linker are you using?  Are you
using the same linker with both GCC and clang?

What system are you on?

In the pastebin links you provided, I don't see any clang shared
libraries at all.  Where is clang_createIndex supposed to be defined?

You may simply need to use the -rdynamic option with GCC.

Ian



More information about the Gcc-help mailing list