Native linking failed: duplicate symbols, how to solve?

RomanKaganRomanKagan USMember ✭✭

Hi,

I have two 3rd parties libraries, each of one using SDWebImage library. In test projects each library works well, but when I put them together in one main project, I can't link it, because duplicate symbol error.
What is the best way to solve it?

Thanks a lot,
Roman

Posts

  • If you can't modify the third party libraries, you do have another option.

    The names are colliding because both native libraries must be force-loaded into the app by the native linker. If you didn't force load either, then there wouldn't be a collision, but then the app wouldn't be able to find them at run-time.

    To skip force loading the libraries while still being able to find their symbols, you can create a thin shim for each API you need. Create a small native library for each of your dependencies that one-for-one exposes the API entry points you use and then force load those shims. The native linker, then, is free dead-strip and remove duplicate symbols from the dependencies while still ensuring that the symbols in the shim are findable at run-time.

  • AkashThambiranAkashThambiran USMember

    Thank you RolfBjarneKvinge. The --registrar:static flag worked for me like a charm.

  • JenalynParagadosJenalynParagados USMember ✭✭

    I also encountered same error after I add the Xamarin.InAppPurchase Component. How to fix this?

  • DominicShawDominicShaw USMember ✭✭

    Had this installing Mobile Centre because I already am using Xamarin Insights and HockeyApp - the symbols clash. I have to pick just one of these!

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai

    I'm closing this post to prevent further comments because it's > 6 months old and additional comments are not relevant to the original post.

    If you have a similar issue, please post a new question with specifics about your problem. Thanks!

This discussion has been closed.