1

I'm trying to integrate 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. This is normally an easy task and I have done it before without any issue.

The problem I'm facing with this particular Xamarin.iOS application comes with the package Xamarin.SDWebImage is already in use for similar image functionality. When those two NuGet packages are added and referenced, the linker shows a lot of "Duplicate symbol"-errors. I found out that the errors are related to WebP, which seems to be a binding which the two packages use (from different sources) which are causing conflicts.

So a general question is, what can I do when two distinct native libraries define the same symbols?

This particular error message is described here: https://learn.microsoft.com/en-us/xamarin/ios/troubleshooting/mtouch-errors#mt5212-native-linking-failed-duplicate-symbol- and I believe I'm facing "Two distinct native libraries happen to define the same symbols." 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 tried with adding [assembly: LinkWith (..., SmartLink = true)] statements in the AssemblyInfo.cs (or .csproj file). Those haven't helped though.

Unfortunately, I'm not allowed to share my source code but 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 simple 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 of showing a lot of errors like:

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 could be the reason behind these errors? Is it "Two distinct native libraries define the same symbols." as I suspect or is it something else? And what can I do about it?

The two packages in question:

Further information:

  • Xamarin.iOS Version: 13.16.0.13 (Visual Studio Community)
  • Xcode 11.4

Thanks, Rafael

Federico Navarrete
  • 3,069
  • 5
  • 41
  • 76
Rafael
  • 11
  • 1

1 Answers1

0

There seems to be incompatibility between the two packages as you can see here, developers have opened issues in both GitHub repositories a while ago, notifying them of the issue, without any resolution so far. So you can't have both in your app at the same time.

You would have to use only one of the two, I would recommend FFImageLoading.

halfer
  • 19,824
  • 17
  • 99
  • 186
Saamer
  • 4,687
  • 1
  • 13
  • 55