Repository navigation
Error 2
This error occurs when the Tesseract wrapper fails to load the native tesseract and leptonica libraries. The loading routine will try to identify the correct version of the dll that should reside in the x86 or x64 folder under you bin folder based on the executing CPU architecture.
- The Visual Studio 2015 x86 & x64 Runtime is not installed, as detailed on the main readme page these can be found here.
- The x86 and x64 versions leptonica (liblept172.dll) and tesseract (libtesseract304.dll) were not copied to their respective folders in the bin directory.
- DotNet may be reporting the wrong architecture, for instance a known issue is that for an Application compiled using the prefer 32-bit flag will report it's running on x64 when running on windows 64-bit OS (see issue #55). A common workaround is to either change the cpu architecture to x86.
- Your running this on an unsupported architecture (e.g. ARM).
Tesseract will write the detected architectures and paths searched to the System.Diagnostics source named "Tesseract" which will be helpful for figuring out what is going on. An example configuration is provided at the end of the page.
If the correct version of the library is being found but fails to load, the log will tell you if this is the case, then the next step is to enable logging of binding errors and check the fusion log. Note that it's been my experience that Windows may log these errors to the Windows Event Log so it might be worth checking that first. Further details can be found here:
- https://blogs.msdn.microsoft.com/suzcook/2003/05/29/debugging-assembly-loading-failures/
- http://stackoverflow.com/questions/255669/how-to-enable-assembly-bind-failure-logging-fusion-in-net
If you cannot resolve the issue please file a new issue including the library version, operating system your executing the code on, the target architecture for the entry program, and a copy of the full standard and trace outputs. Note you'll need to enable System.Diagnostics output for the Tesseract source as previously mentioned.
Add this to your web.config or app.config and adjust as required.
<system.diagnostics>
<sources>
<source name="Tesseract" switchValue="Verbose">
<listeners>
<clear />
<add name="console" />
<!-- Uncomment to log to file
<add name="file" />
-->
</listeners>
</source>
</sources>
<sharedListeners>
<add name="console" type="System.Diagnostics.ConsoleTraceListener" />
<!-- Uncomment to log to file
<add name="file"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="c:\log\tesseract.log" />
-->
</sharedListeners>
</system.diagnostics>