Sicos1977 / TesseractOCR

A .net library to work with Google's Tesseract
161 stars 20 forks source link

Xamarin Forms .Net Standard 2.1 - Failed to find library libleptonica-1.83.0.dll.so x64 #40

Closed issacpena closed 1 year ago

issacpena commented 1 year ago

Hello,

Thank you for your time on this.

I am developing a Xamarin Forms app. I am trying to create an instance of TesseractOCR.Engine as follows:

TesseractOCR.Engine engine = new TesseractOCR.Engine( ... parameters ... )

Then I go the following error:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DllNotFoundException: Failed to find library 'libleptonica-1.83.0.dll.so' for platform x64 at TesseractOCR.InteropDotNet.LibraryLoader.LoadLibrary (System.String fileName, System.String platformName) [0x000e8] in <473c4887e9054f468a6af92983d262bf>:0 at InteropRuntimeImplementer.LeptonicaApiSignaturesInstance.LeptonicaApiSignaturesImplementation..ctor (TesseractOCR.InteropDotNet.LibraryLoader loader) [0x00006] in <49523509dca646fd985953232f51873a>:0 at (wrapper managed-to-native) System.Reflection.RuntimeConstructorInfo.InternalInvoke(System.Reflection.RuntimeConstructorInfo,object,object[],System.Exception&) at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:936 --- End of inner exception stack trace --- at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00018] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:944 at System.Reflection.RuntimeConstructorInfo.DoInvoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00086] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:926 at System.Reflection.RuntimeConstructorInfo.Invoke (System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:960 at System.RuntimeType.CreateInstanceImpl (System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes, System.Threading.StackCrawlMark& stackMark) [0x0022b] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/rttype.cs:5535 at System.Activator.CreateInstance (System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x000b5] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/activator.cs:107 at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/activator.cs:112 at TesseractOCR.InteropDotNet.InteropRuntimeImplementer.CreateInstance[T] () [0x000d3] in <473c4887e9054f468a6af92983d262bf>:0 at TesseractOCR.Interop.LeptonicaApi.Initialize () [0x0000d] in <473c4887e9054f468a6af92983d262bf>:0 at TesseractOCR.Interop.TessApi.Initialize () [0x00008] in <473c4887e9054f468a6af92983d262bf>:0 at TesseractOCR.Interop.TessApi.get_Native () [0x00007] in <473c4887e9054f468a6af92983d262bf>:0 at TesseractOCR.Engine.Initialize (System.String dataPath, System.String languages, TesseractOCR.Enums.EngineMode engineMode, System.Collections.Generic.IEnumerable1[T] configFiles, System.Collections.Generic.IDictionary2[TKey,TValue] initialValues, System.Boolean setOnlyNonDebugVariables, Microsoft.Extensions.Logging.ILogger logger) [0x00012] in <473c4887e9054f468a6af92983d262bf>:0 at TesseractOCR.Engine.Initialize (System.String dataPath, System.Collections.Generic.List1[T] languages, TesseractOCR.Enums.EngineMode engineMode, System.Collections.Generic.IEnumerable1[T] configFiles, System.Collections.Generic.IDictionary2[TKey,TValue] initialValues, System.Boolean setOnlyNonDebugVariables, Microsoft.Extensions.Logging.ILogger logger) [0x00049] in <473c4887e9054f468a6af92983d262bf>:0 at TesseractOCR.Engine..ctor (System.String dataPath, TesseractOCR.Enums.Language language, TesseractOCR.Enums.EngineMode engineMode, System.Collections.Generic.IEnumerable1[T] configFiles, System.Collections.Generic.IDictionary`2[TKey,TValue] initialOptions, System.Boolean setOnlyNonDebugVariables, Microsoft.Extensions.Logging.ILogger logger) [0x00014] in <473c4887e9054f468a6af92983d262bf>:0

The related dll is in the project

image

What do I am missing?

Thank you

Sicos1977 commented 1 year ago

I think the problem is just the extension. It is looking for .dll.so so try renaming the files and see if that solves something.

issacpena commented 1 year ago

Thank you @Sicos1977 for the advice, I just try it and the issue remains. Regards