Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How can I use both FFImageLoading and SDWebImage in a Xamarin.iOS project without the linker breakin

$
0
0

I'm trying to bring some Native Forms pages to an existing Xamarin.iOS application so that those pages can be shared between several platforms. I would like to use Xamarin.FFImageLoading for images on those Native Forms pages. That much is easy and I have done before without issue. The difficulty comes because this particular Xamarin.iOS application already uses Xamarin.SDWebImage for similar image functionality. When those two Nuget packages are brought in and referenced, the linker begins to choke with numerous reports of "Duplicate symbol". I believe (but I'm not sure) the cause is related to WebP and what I believe to be its bindings which the two packages use (from different sources) which are colliding. So maybe more generally the question is, what can I do when two distinct native libraries happen to define the same symbols? (if that is the problem here)

This particular error message is described here: https://docs.microsoft.com/en-us/xamarin/ios/troubleshooting/mtouch-errors#mt5212-native-linking-failed-duplicate-symbol- and I believe I'm encountering "Two distinct native libraries happen to define the same symbols." specifically, but that page doesn't mention at all what to do about that specific cause.

I've tried adding mtouch arguments that I thought would help, such as "--registrar:static" and "-gcc_flags -dead_strip" and I also played around with adding "[assembly: LinkWith (..., SmartLink = true)]" statements in the assemblyinfo.cs. Those haven't helped though and I'm beginning to think both the packages are hard forcing in their bindings/symbols in ways I can't adjust after the fact. I'm not sure if that's true though and I'm not sure how to tell.

I have an extremely simple project which recreates the problem right here but I'm not sure how to share it. However, it can be very easily recreated by just making a brand new Xamarin.iOS project and bringing in the two packages, and then calling out to them both with some garbage method call in AppDelegate.cs (just to make sure neither are completely stripped out during linking), for example:

new FFImageLoading.ImageService();
new SDWebImage.FLAnimatedImageView();

I expect the project to build, but the project does not build, instead spitting out numerous errors of this sort:

Native linking failed, duplicate symbol: '_WebPAllocateDecBuffer'.
Duplicate symbol in: /.../liblibwebp.a(buffer_dec.o) (Location related to previous error)
Duplicate symbol in: /.../WebP.a(libwebpdspdecode_neon_la-alpha_processing_neon.o) (Location related to previous error)

So what is breaking here? Is it "Two distinct native libraries happen to define the same symbols." as I suspect or is it something else? What can I do about it?

The two packages in question:

https://github.com/luberda-molinet/FFImageLoading

https://github.com/xamarin/XamarinComponents/tree/master/iOS/SDWebImage


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>