Building a Xamarin Forms (currently 4.7.0.1080) project fails when using SkiaSharp 2.80.0.
error MT5209 : Native linking error : framework not found libSkiaSharp
MTOUCH : error MT5202: Native linking failed. Please review the build log.
Steps to reproduce:
new SKCanvasView(); to MainPage.xaml.cs to prevent the Linker from pruning out SkiaSharp.Expected Behavior
App should build and be able to launch.
Actual Behavior
Build for iOS fails with linker errors.
Basic Information
IDE/OS information (click to expand)
Visual Studio Community 2019 for Mac
Version 8.6.5 (build 23)
Installation UUID: 06132a91-56f5-4cdb-afc7-6be5f4773937
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)
Package version: 610000104
Mono Framework MDK
Runtime:
Mono 6.10.0.104 (2019-12/5d03a6fe116) (64-bit)
Package version: 610000104
Roslyn (Language Service)
3.6.0-3.20210.9+4eafdcb1bcbd8d3573f2ba6065e56d9b9ce4f8a3
NuGet
Version: 5.6.0.6591
.NET Core SDK
SDK: /usr/local/share/dotnet/sdk/3.1.301/Sdks
SDK Versions:
3.1.301
3.1.300
3.1.202
3.1.200
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Sdks
.NET Core Runtime
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
3.1.5
3.1.4
3.1.2
2.1.19
2.1.18
2.1.17
2.1.16
Xamarin.Profiler
Version: 1.6.13.11
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
Updater
Version: 11
Apple Developer Tools
Xcode 11.5 (16139)
Build 11E608c
Xamarin.Mac
Version: 6.18.2.1 (Visual Studio Community)
Hash: 29c4ea731
Branch: d16-6
Build date: 2020-05-26 17:03:04-0400
Xamarin.iOS
Version: 13.18.2.1 (Visual Studio Community)
Hash: 29c4ea731
Branch: d16-6
Build date: 2020-05-26 17:03:05-0400
Xamarin Designer
Version: 16.6.0.329
Hash: d4f8bcd13
Branch: remotes/origin/d16-6
Build date: 2020-04-24 02:16:02 UTC
Xamarin.Android
Version: 10.3.1.4 (Visual Studio Community)
Commit: xamarin-android/d16-6/3a10de9
Android SDK: **REMOVED**
Supported Android versions:
None installed
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 29.0.5
SDK Build Tools Version: 29.0.2
Build Information:
Mono: 165f4b0
Java.Interop: xamarin/java.interop/d16-6@2cab35c
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.31.1@49232bc
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-6@bfb66f3
Microsoft OpenJDK for Mobile
Java SDK: **REMOVED**
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
Android SDK Manager
Version: 16.6.0.50
Hash: 5901879
Branch: remotes/origin/d16-6
Build date: 2020-06-10 22:42:50 UTC
Android Device Manager
Version: 16.6.0.96
Hash: 6e8b80b
Branch: remotes/origin/d16-6
Build date: 2020-06-10 22:43:28 UTC
Build Information
Release ID: 806050023
Git revision: 5289d413b99fddfc20b4ecf3e445ccb822213427
Build date: 2020-06-18 12:08:30-04
Build branch: release-8.6
Xamarin extensions: 5289d413b99fddfc20b4ecf3e445ccb822213427
Operating System
Mac OS X 10.15.5
Darwin 19.5.0 Darwin Kernel Version 19.5.0
Tue May 26 20:41:44 PDT 2020
root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64
Looking at the sample, seems that it can't find the native library. It appears that the app is pulling the managed library, but not the framework.
This is probably related to #1296 where the native library is not embedded. This fixes issues with upgrades, but seems to break the case where the skiasharp packages were not also installed into the app project.
I'll have a look at using the buildTransitive folder as well (#1041 and #1057).
But, the easiest and quickest solution is to just install the package into iOS as well.
I had the same problem I fixed it by
Disabling following Build options in the Debug Configuration:
afterwards it worked.
@mattleibow We're seeing a similar issue in our Xamarin.Mac app. After going from 1.68.3 to 2.80.1 we no longer get libSkiaSharp.dylib in the app bundle. Adding the SkiaSharp package to our app project directly does work as a workaround. Do you want a repro?
Hi folks, I think I know what to do for this issue. I'll update with the next release.
But, installing SkiaSharp into the head projects is a good workaround for now.
I have installed 2.80.2-preview19 into ALL my projects.
The line paint = new SKPaint(); throws a type load exception on Android:
"libSkiaSharp.so assembly:
at (wrapper managed-to-native) SkiaSharp.SkiaApi.sk_compatpaint_new()
at SkiaSharp.SKPaint..ctor () [0x00000] in
EDIT: reverting to 1.68.3 makes the problem go away
I had the same problem I fixed it by
Disabling following Build options in the Debug Configuration:
- Enable incremental builds
- Enable device-specific builds
afterwards it worked.
The above is not working for me at all.
"installing SkiaSharp into the head projects is a good workaround for now." solved this.
I had the same problem I fixed it by
Disabling following Build options in the Debug Configuration:
- Enable incremental builds
- Enable device-specific builds
afterwards it worked.
The above is not working for me at all.
"installing SkiaSharp into the head projects is a good workaround for now." solved this.
Yes this is the recommanded workaround, the problem was that I had installed Skia.Sharp already in the head projects and it still didn't work. So the workaround is in addition to installing Skia.Sharp in the head projects
Yes have installed SkiaSharp.Views.Forms in head projects for ok result.
I forget to mention that I installed SkiaSharp and SkiaSharp.Views.Forms in the head projects.
Maybe it is an issue with Svg.Skia (because this I use for Svg Images in Skia). I didn't do a Full investigation why it didn't work.
Only did trial and error until it worked.
Just for future reference, it might be the issue with incremental builds, so we should be _disabling_ them.
Most helpful comment
Hi folks, I think I know what to do for this issue. I'll update with the next release.
But, installing SkiaSharp into the head projects is a good workaround for now.