I am using .net core c# code to extract text from image using Tesseract. I have added Tesseract 3.3.0 to my project using NuGet package command. This code is working fine on my windows machine. However this fails on Linux machine. After research on internet, I got to know that I need to link liblept and libtesseract files. Hence I am doing below to link the files.
ln -s /usr/lib/x86_64-linux-gnu/liblept.so.5 /xxx/yyy/zzzz/project/x64/liblept1753.so
ln -s /usr/lib/x86_64-linux-gnu/libtesseract.so.4 /xxx/yyy/zzzz/project/x64/libtesseract3052.so
However I am still getting below error.
+++++++StackTrace+++++++
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
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)
at InteropDotNet.InteropRuntimeImplementer.CreateInstance[T]()
at Tesseract.Interop.TessApi.Initialize()
at Tesseract.Interop.TessApi.get_Native()
at Tesseract.TesseractEngine..ctor(String datapath, String language, EngineMode engineMode, IEnumerable`1 configFiles, IDictionary`2 initialOptions, Boolean setOnlyNonDebugVariables)
at Controller.OCRImage(String image_path, Int32 page_id, String page_img_path) in Controller.cs:line 710
+++++++InnerException+++++++
System.Exception: dlsym: /xxx/yyy/zzzz/project/x64/libtesseract3052.so: undefined symbol: TessPDFRendererCreateTextonly
at InteropDotNet.UnixLibraryLoaderLogic.GetProcAddress(IntPtr libraryHandle, String functionName)
at InteropDotNet.LibraryLoader.GetProcAddress(IntPtr dllHandle, String name)
at InteropRuntimeImplementer.TessApiSignaturesInstance.TessApiSignaturesImplementation..ctor(LibraryLoader loader)
+++++++Data+++++++
System.Collections.ListDictionaryInternal
+++++++Source+++++++
System.Private.CoreLib
+++++++HResult+++++++
-2146232828
+++++++TargetSite+++++++
System.Object InvokeMethod(System.Object, System.Object[], System.Signature, Boolean, Boolean)
+++++++Message+++++++
Exception has been thrown by the target of an invocation.
+++++++HelpLink+++++++
Below is the actual error, not sure how to proceed. I am stuck here, Any help would be greatly appreciated.
/xxx/yyy/zzzz/project/x64/libtesseract3052.so: undefined symbol: TessPDFRendererCreateTextonly
First error you did is pretending that tesseract library 4.x version is tesseract 3.x (by creating symbolic link). This will never work. 3.x library is outdated not support, so best thing you can do is upgrade your app to 4.x/5.x tesseract.