charlesw / tesseract

A .Net wrapper for tesseract-ocr
Apache License 2.0
2.3k stars 743 forks source link

Failed to find library 'liblept172.dll' still.................... #372

Open JohnVLinton opened 7 years ago

JohnVLinton commented 7 years ago

I see a lot of chatter about the below error but have still no working solution.

Whether I copy the two .dlls (liblept172.dll and libtesseract304.dll) into x64 and x86 -- or configure the build to auto-copy them, I keep getting the library load error no matter what. Whether I put them in the main solution folder, x64 and x86 inside that, inside the bin folders, they're never found.

I'm running Windows 10 and in either Visual Studio 2015 or 2017, I keep having this problem. I don't really know why there's not a simple fix.

I'm using Tesseract 3.02, I heard 3.01 didn't have the issue, but that didn't work either.

System.DllNotFoundException: Failed to find library "liblept172.dll" for platform x86. at InteropDotNet.LibraryLoader.LoadLibrary(String fileName, String platformName) at InteropRuntimeImplementer.LeptonicaApiSignaturesInstance.LeptonicaApiSignaturesImplementation..ctor(LibraryLoader loader) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, Object[] args) at InteropDotNet.InteropRuntimeImplementer.CreateInstance[T]() at Tesseract.Interop.LeptonicaApi.Initialize() at Tesseract.Interop.TessApi.Initialize() at Tesseract.Interop.TessApi.get_Native() at Tesseract.TesseractEngine..ctor(String datapath, String language, EngineMode engineMode, IEnumerable1 configFiles, IDictionary2 initialOptions, Boolean setOnlyNonDebugVariables) at ScanDoc.Scanner.IsPageBlank(Bitmap pageImg) in C:\TFS\SharePoint\Web Applications\PersonnelDocuments\ScanDoc\Scanner.cs:line 640 at ScanDoc.Scanner.ProcessLegacyDocuments(Stream pdfFileStream, String userName) in C:\TFS\SharePoint\Web Applications\PersonnelDocuments\ScanDoc\Scanner.cs:line 262 at PersonnelDocuments.Controllers.SearchController.UploadLegacyArbitration(HttpPostedFileBase arbitrationFile) in C:\TFS\SharePoint\Web Applications\PersonnelDocuments\PersonnelDocuments\Controllers\SearchController.cs:line 411 at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) at System.Web.Mvc.Async.AsyncControllerActionInvoker.b39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult2.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase1.End() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.b3d() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>cDisplayClass46.b3f() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>cDisplayClass33.b32(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase1.End() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>cDisplayClass21.<>cDisplayClass2b.b1c() at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>cDisplayClass21.b__1e(IAsyncResult asyncResult)

tdhintz commented 7 years ago

Start walking through #304.

Commonly this means something those libraries depend on is missing from the environment.

ilochray commented 7 years ago

I recently encountered this issue and was initially unable to solve it using any of the normal suggestions in the threads related to Error 2 / #304. Eventually I traced the problem to an invalid version of vcruntime140.dll. Check that the versions of this dll in system32 and syswow64 are correct by comparing the file version with the version reported in Add/Remove programs. In my case they did not match. By re-installing the correct versions I got things working.

JohnVLinton commented 7 years ago

Thanks Sir.

Somehow I rebuilt things several times, reloaded Studio, and the annoying error simply disappeared -- which is both comforting and worrisome.

Best,

John Linton

On Wed, Oct 4, 2017 at 2:52 PM, ilochray notifications@github.com wrote:

I recently encountered this issue and was initially unable to solve it using any of the normal suggestions in the threads related to Error 2 /

304 https://github.com/charlesw/tesseract/issues/304. Eventually I

traced the problem to an invalid version of vcruntime140.dll. Check that the versions of this dll in system32 and syswow64 are correct by comparing the file version with the version reported in Add/Remove programs. In my case they did not match. By re-installing the correct versions I got things working.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/charlesw/tesseract/issues/372#issuecomment-334254665, or mute the thread https://github.com/notifications/unsubscribe-auth/AXng6E6URuylb-UA4s9Jkk0rnvTqv74rks5so9P6gaJpZM4PnwMp .

JohnVLinton commented 7 years ago

Egad. The issue came back; not sure why. I'm trying to get the Tesseract logging to work per the config file update but that isn't writing either... To be clear, the log file is created where I want it on the error occurring but it is "writing blank", with no content on open.