Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mono v6.x]System.DllNotFoundException: libGLESv2.so #3441

Closed
Huaba93 opened this issue Aug 5, 2019 · 4 comments
Closed

[Mono v6.x]System.DllNotFoundException: libGLESv2.so #3441

Huaba93 opened this issue Aug 5, 2019 · 4 comments

Comments

@Huaba93
Copy link

Huaba93 commented Aug 5, 2019

With the new version of Mono (6.x) it is no longer possible to draw with the graphics card (SkiaSharp--> SKGLView). The app crashes on Android 5 with a System.DllNotFoundException: libGLESv2.so

It works with Android 7 and Android 8. Not tested on Android 6 and Android 9.

Everything works with Mono 5.x.

Steps to Reproduce

  1. Draw something with SkiaSharp (GPU --> SKGLView)
  2. Build in Release and deploy

Sample Project

Expected Behavior

paths to be drawn etc. are drawn

Actual Behavior

App crashes

[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: libGLESv2.so [mono-rt] at (wrapper managed-to-native) SkiaSharp.Views.GlesInterop.Gles.glGetIntegerv(uint,int&) [mono-rt] at SkiaSharp.Views.Android.SKGLDrawable.CreateRenderTarget (System.Int32 bufferWidth, System.Int32 bufferHeight) [0x00000] in <a6c14eed3af3471db7c51e05d420f851>:0 [mono-rt] at SkiaSharp.Views.Android.SKGLTextureViewRenderer.OnDrawFrame (Javax.Microedition.Khronos.Opengles.IGL10 gl) [0x0006c] in <a6c14eed3af3471db7c51e05d420f851>:0 [mono-rt] at SkiaSharp.Views.Android.GLTextureView+GLThread.GuardedRun () [0x003b5] in <a6c14eed3af3471db7c51e05d420f851>:0 [mono-rt] at SkiaSharp.Views.Android.GLTextureView+GLThread.Run () [0x00025] in <a6c14eed3af3471db7c51e05d420f851>:0 [mono-rt] at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in <d4dad3d1234346a6958fbd0477ac495d>:0 [mono-rt] at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <d4dad3d1234346a6958fbd0477ac495d>:0 [mono-rt] at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <d4dad3d1234346a6958fbd0477ac495d>:0 [mono-rt] at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in <d4dad3d1234346a6958fbd0477ac495d>:0 [mono-rt] at System.Threading.ThreadHelper.ThreadStart () [0x00008] in <d4dad3d1234346a6958fbd0477ac495d>:0

Version Information

=== Visual Studio Enterprise 2019 for Mac (Preview) ===

Version 8.3 Preview (8.3 build 867)
Installation UUID: c1b90fcb-caba-451d-9b57-0711422fa543
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 5.16.0.5 (d16-3 / 26f04c54)

Package version: 604000081

=== Mono Framework MDK ===

Runtime:
Mono 6.4.0.81 (2019-06/f55e0a671c0) (64-bit)
Package version: 604000081

=== NuGet ===

Version: 5.2.0.6067

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
2.2.5
2.2.0
SDK: /usr/local/share/dotnet/sdk/2.2.300/Sdks
SDK Versions:
2.2.300
2.2.101
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.4.0/lib/mono/msbuild/Current/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.6.10
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 10.3 (14492.2)
Build 10G8

=== Xamarin.Mac ===

Version: 5.16.0.5 (Visual Studio Enterprise)
Hash: 26f04c54
Branch: d16-3
Build date: 2019-06-28 01:31:14-0400

=== Xamarin.iOS ===

Version: 12.16.0.5 (Visual Studio Enterprise)
Hash: 26f04c54
Branch: d16-3
Build date: 2019-06-28 01:31:14-0400

=== Xamarin Designer ===

Version: 16.3.0.17
Hash: 73f0a446c
Branch: remotes/origin/d16-3-release-8.3-p1
Build date: 2019-07-22 17:05:22 UTC

=== Xamarin.Android ===

Version: 9.5.0.27 (Visual Studio Enterprise)
Commit: xamarin-android/d16-3/16c4494
Android SDK: /Users/christophhuber/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
7.1 (API level 25)
8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 28.0.1
SDK Build Tools Version: 27.0.3

Build Information:
Mono: mono/mono@e6f5369c2d2
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip@b95cf3f
ProGuard: xamarin/proguard@905836d
SQLite: xamarin/sqlite@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

=== Microsoft Mobile OpenJDK ===

Java SDK: /Users/christophhuber/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 1.4.0.8
Hash: 28342d0
Branch: remotes/origin/backport-pr-235-to-d16-3~2
Build date: 2019-07-18 16:54:46 UTC

=== Android Device Manager ===

Version: 1.2.0.75
Hash: bf6d603
Branch: remotes/origin/backport-pr-369-to-d16-3~1
Build date: 2019-07-18 16:55:08 UTC

=== Xamarin Inspector ===

Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 803000867
Git revision: ab4af85ea561e474b545e0eada75c5bfe8a92297
Build date: 2019-07-24 14:13:44+00
Build branch: release-8.3-preview1
Xamarin extensions: 45290013e165bcd2db7acbb310e0c16bfe04f0c3

=== Operating System ===

Mac OS X 10.14.5
Darwin 18.6.0 Darwin Kernel Version 18.6.0
Thu Apr 25 23:16:27 PDT 2019
root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64

=== Enabled user installed extensions ===

LiveXAML 1.3.51

Log File

LogFile

@brendanzagaeski
Copy link
Contributor

Thanks for the report and the sample project!

Given the similarity of this behavior to #3388, it seems likely that the fix for that issue will resolve this issue too. I will leave this bug open separately for now until a candidate fix is available that can be tested against this scenario.

Testing notes from confirming the overlap with #3388

For my convenience in testing, I trimmed out the iOS project and the Android resources. Here's the updated sample project I used: Mono6SkiaDllNotFound.zip

The issue only occurs in the Release configuration.

Devices where the DllNotFoundException occurs

Android 4.1 Jelly Bean (API level 16) armeabi-v7a, LG Optimus L9
Android 6.0 Marshmallow (API level 23) armeabi-v7a, Motorola Moto G3

Devices that run the app successfully and draw a red spiral

Android 5.0 Lollipop (API level 21) armeabi-v7a, emulator (system-images;android-21;default;armeabi-v7a)
Android 6.0 Lollipop (API level 23) armeabi-v7a, Google APIs emulator (system-images;android-23;google_apis;armeabi-v7a)
Android 7.1 Nougat (API level 25) armeabi-v7a, Motorola Moto E4
Android 9.0 Pie (API level 28) arm64-v8a, Google Pixel 3

Xamarin.Android versions where the DllNotFoundException occurs

(Tested on the Android 6.0 Marshmallow (API level 23) armeabi-v7a, Motorola Moto G3.)

Xamarin.Android versions where the app successfully draws a red spiral

  • Xamarin.Android SDK 9.3.0.23 (d16-1/ebd7bda)

(Tested on the Android 6.0 Marshmallow (API level 23) armeabi-v7a, Motorola Moto G3.)

The issue depends on the Mono runtime and class library versions

Steps tested:

  1. Replace the following one directory and three files in Xamarin.Android SDK 9.4.1.0 with the versions from Xamarin.Android SDK 9.3.0.23 (d16-1/ebd7bda):

    C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\System.dll
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\lib\armeabi-v7a\libmonosgen-2.0.so
    
  2. Disable the managed linker to avoid type resolution issues.

  3. Rebuild and redeploy the app.

Result:

The app successfully draws a red spiral.

Inverse steps tested:

  1. Replace libmonosgen-2.0.so, System.dll, mscorlib.dll, and the facades in Xamarin.Android SDK 9.3.0.23 with the versions from Xamarin.Android SDK 9.4.1.0.
  2. Disable the managed linker to avoid type resolution issues.
  3. Rebuild and redeploy the app.

Result:

The DllNotFoundException occurs.

@uwe-neuronation
Copy link

uwe-neuronation commented Aug 28, 2019

Similar issue by using CocosSharp game engine.

System.DllNotFoundException: libGLESv2.dll

[CCGameView]   at (wrapper managed-to-native) OpenTK.Graphics.ES20.GL+Core.GetIntegerv(OpenTK.Graphics.ES20.GetPName,int*)
[CCGameView]   at OpenTK.Graphics.ES20.GL.GetInteger (OpenTK.Graphics.ES20.GetPName pname, System.Int32& params) [0x00005] in <6391ddc92a4944d3b8ae0179897f2270>:0 
[CCGameView]   at Microsoft.Xna.Framework.Graphics.GraphicsDevice.PlatformSetup () [0x00008] in <80aea6d26800439fa85d9a7bf56fa3a3>:0 
[CCGameView]   at Microsoft.Xna.Framework.Graphics.GraphicsDevice.Setup () [0x00033] in <80aea6d26800439fa85d9a7bf56fa3a3>:0 
[CCGameView]   at Microsoft.Xna.Framework.Graphics.GraphicsDevice..ctor (Microsoft.Xna.Framework.Graphics.GraphicsAdapter adapter, Microsoft.Xna.Framework.Graphics.GraphicsProfile graphicsProfile, Microsoft.Xna.Framework.Graphics.PresentationParameters presentationParameters) [0x000df] in <80aea6d26800439fa85d9a7bf56fa3a3>:0 
[CCGameView]   at CocosSharp.CCGameView.InitialiseGraphicsDevice () [0x0005c] in <5aa6e85657944fe5a79963edbf3915f6>:0 

Happens from Android 4.1 to Android 6. Version 7 to 9 seem to be ok.
Only happens on release builds.

My workaround, for now, was to downgrade Xamarin.Android to version 9.3.
https://github.com/xamarin/xamarin-android on Mac this is easy. Download package, it's an installer. Run it, downgrade done! But it can only be a temporary solution.

@brendanzagaeski
Copy link
Contributor

Release status update

A new Release version has now been published that includes the fix for this item.

Fix included in Xamarin.Android 10.0.0.43

Fix included on Windows in Visual Studio 2019 version 16.3. To get the new version that includes the fix, check for the latest updates or install the latest version from https://visualstudio.microsoft.com/downloads/.

Fix included on macOS in Visual Studio 2019 for Mac version 8.3. To get the new version that includes the fix, check for the latest updates on the Stable updater channel.


Verification details

I had chance to test the released fix for #3388 against the test case from this issue today, and I verified that it resolved this issue too.

Xamarin.Android versions where the app successfully draws a red spiral

Tested on:

Android 4.1 Jelly Bean (API level 16) armeabi-v7a, LG Optimus L9
Android 6.0 Marshmallow (API level 23) armeabi-v7a, Motorola Moto G3

Xamarin.Android versions where the DllNotFoundException occurs

Tested on:

Android 4.1 Jelly Bean (API level 16) armeabi-v7a, LG Optimus L9
Android 6.0 Marshmallow (API level 23) armeabi-v7a, Motorola Moto G3

@brendanzagaeski
Copy link
Contributor

Duplicate of #3388

@brendanzagaeski brendanzagaeski marked this as a duplicate of #3388 Oct 2, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Jun 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants