-
Notifications
You must be signed in to change notification settings - Fork 741
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
Linux support missing for .NET Core #503
Comments
I'm also having this problem when trying to build in travis-ci with linux. Is there a package that can be installed that will bring this file down? I have tried both of the following neither of which helped sudo apt install tesseract-ocr
sudo apt install libleptonica-dev |
I needed to compile this file myself in order to get it working. |
The problem is that InteropDotNet seems to expect native libleptonica and libtesseract in the according folder (x64 or x86). So if you're lazy as myself, you can install I think the appropriate solution though is to ship the binaries for Linux as it's done for Windows. |
I was thinking a better way of dealing with this would be to support
falling back on just using the generic load dynamic library routine (i.e.
standard search paths). That way it should just work provided the libraries
been installed.
Only issue I can think of is it might cause issues with the diagnosing
errors relating to finding or loading the library. Which has been a
consistent pain in the ass.
How does that sound?
…On Tue, 28 Jan 2020, 07:13 Arthur, ***@***.***> wrote:
The problem is that InteropDotNet
<https://github.com/AndreyAkinshin/InteropDotNet> seems to expect native
libleptonica and libtesseract in the according folder (x64 or x86). So if
you're lazy as myself, you can install libtesseract-dev and
libleptonica-dev, copy the *.so files to bin//x64 folder, rename them
(compiler will you what file is missing) and it suddenly *works*.
I think the appropriate solution though is to ship the binaries for Linux
as it's done for Windows.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#503?email_source=notifications&email_token=AAB7HSFBQGRE4KQQXT532Q3Q7455HA5CNFSM4KKGHXW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKA4R5A#issuecomment-578930932>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAB7HSDQUHSMSOEPC36WOSDQ7455HANCNFSM4KKGHXWQ>
.
|
I'm having the same issue, I have managed to complile the correct leptonica 1.78.0 and tesseract 4.1.0 because I'm using a Docker image based on Debian buster and it only goes to 1.76 and 4.0.1 but I still have the "System.DllNotFoundException: Failed to find library "libleptonica-1.78.0.so" for platform x64." I tried copying the .so in the x64 folder as suggester by @arthrp and I also tried with symlinks but it does not work either, I don't know what else to do at this point. Any idea? |
Not sure if this helps but @howff managed to get it working in our repo with this commit. It has some renames of the files in the x64 directory SMI/SmiServices@d97879d |
Thanks, at least it confirms that they need to be called |
You will need to compile the linux .so for leptonica and tesseract and place them in the x64 directory. Make sure the filenames are x64/libtesseract41.so and x64/libleptonica-1.78.0.so so that the DLLs can find them, BUT you might find that internally the tesseract .so references the leptonica .so by a different name so you might need a symbolic link (or copy) named x64/libleptonica.so.5.3.0 You can use the linux 'ldd' utility to find out if there are any other dependencies missing. |
Thanks a lot for trying to help me with this, basically, in my Docker image I have this:
And this:
Which is consistent with what I got from ldd:
However, even with this configuration, I still get the |
Monday morning, fresh coffee, clear mind, I finally got this to work! |
I am trying to compile in Windows 10, and deploy on AWS Lambda. I am getting the error on libleptonica-1.78.0.so file missing. |
@sudipkumarbhattacharya The linux binaries are linked from one of the previous comments |
This is how I fixed it in a Debian 9 server: cd ~/MyProject/x64
sudo apt install libleptonica-dev
ln -s /usr/lib/x86_64-linux-gnu/liblept.so.5 liblept.so.5
ln -s /usr/lib/x86_64-linux-gnu/liblept.so.5 libleptonica-1.78.0.so
# Installed the repository from https://notesalexp.org/
sudo apt install libtesseract-dev
ln -s /usr/lib/x86_64-linux-gnu/libtesseract.so.4.0.1 libtesseract41.so The paths and versions might be different in your machine. |
Is anyone able to run it against .NET Core 5.0? I'm having issues to compile example console app on Manjaro Linux after updating dependencies and target framework. leptopnica is OK, libteseract is OK, but the result Console App even tho it compiles, it crashes with |
Wouldn't it make more sense to just bundle the native dependencies in the package? There are many .net packages that do this rather than requiring that people have exactly the right libs installed (or perform manual steps to copy in those dependencies). |
Yes that's certainly an option, does anyone else have any opinions here? I
don't have much experience with Linux so not sure of current best practices
here.
Note I don't have the time to maintain Linux/Mac however will accept pull
requests. Please do raise an issue, or comment on existing issue if
appropriate, to discuss your ideas first though 🙂
…On Tue, 16 Mar 2021, 02:49 Alexander Trauzzi, ***@***.***> wrote:
Wouldn't it make more sense to just bundle the native dependencies in the
package? There are many .net packages that do this rather than requiring
that people have exactly the right libs installed (or perform manual steps
to copy in those dependencies).
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#503 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAB7HSF4QBJ3BHIGK62JFODTDYUAFANCNFSM4KKGHXWQ>
.
|
I think the process would be the same for Windows, macOS and Linux. The Windows library should also be including a static copy too, so maybe start there? |
I use wrapper for .NET 4.1.1 and it worked on WSL2 (Ubuntu 20.04) using solution by carloswbarros . But deploing on Docker on AWS it fails with message Failed to find library "libleptonica-1.80.0.so" for platform x64. or sometimes with Failed to find library "libtesseract41.so" for platform x64. I tryied symlinks like |
also have this error when I run github workflow and docker instation |
This worked fo me in Dockerfile. We had to build libtesseract.so.4.0.1 from source WORKDIR /app/x64 |
I added the installation of libleptonica-dev and libtesseract-dev and continue to receive the error "Failed to find library" libleptonica-1.80.0.so "for platform x64.". My dockerfile file used with core 3.1
Does anyone have any suggestions of where am I going wrong? |
It's very useful to me ,thanks |
I have the same problem as described here. I was able to work around it at least by pre-installing the mentioned packages and creating the symlinks. |
does anyone know where i can get libtesseract.so.4.0.1? |
#503 (comment) |
I was hoping someone just had a download for it as i don't have anything to run ubuntu on currently |
One of the previous comments has a link to pre-compiled libraries here: |
thanks. i've added the file to my x64 directory and named it
libtesseract41.so but i'm still getting the dll not found exception
…On Fri, 2 Jul 2021 at 08:54, howff ***@***.***> wrote:
One of the previous comments has a link to pre-compiled libraries here:
https://github.com/SMI/SmiServices/tree/master/lib
and an explanation of how to rename them.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#503 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGML6N3UQTTJ5IAJBCOB25TTVVWDVANCNFSM4KKGHXWQ>
.
|
sorry if this is a stupid question, i'm not great at ubuntu. does this mean that the dllNotFoundException is because i'm missing a dependency?
|
Yes it is saying "libleptonica.so.5.3.0" is not found so you need that library with that exact filename to be accessible (you can copy the file libleptonica.so.1.78.0-minimal-centos7) |
so i have the libleptonica.so.5.3.0 file and if i copy it into /usr/lib/x86_64-linux-gnu/libleptonica.so.5.3.0 tesseract starts so i've added |
Having the same or similar problem on Visual Studio Mac 2019 on a Xamarin project. I am getting the following error. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DllNotFoundException: Failed to find library "libleptonica-1.80.0.so" for platform x64. .... The Dlls for x64 and x86 (leptonica-1.80.dll and tesseract41.dll) are in the proper folder in the project and being copied to the output directories. I note that the sample console application works fine. Anything thoughts would be appreciated. |
Hi Guys, i recently started working with teseract and this thread was one of the first i looked, to help me out on this task (run teseract on .net core inside a docker image). Finnaly yesterday i acomplish to run a simple project using .net core 3.1 with a simple api. I don't know if all these steps are really necessary But here is my dockerfile to help anyone who are facing this problem:
With this i could run the project without needing to put both leptonica or tesseract41.so objects on x64 folder neither create the symlink to both. Again, i don't know if all these steps are really necessary, but most of these solution came out from this two docs from Tesseract documentation: On the Tesseract installation docs, you have a part that describe how to install on Debian, and that redirects to notesalexp site. I just finished the build and have a lot to change on the application so i don't know if this is the final solution. |
how can I install libleptonica-dev to start with? I'm not able to get this lib from anywhere. Any hint would be greatly appreciated |
This might help Could not load file or assembly Tesseract |
Take a look at my answer, i think that some of the problems you are facing can be resolved following that steps. |
I compiled following working Dockerfile, maybe this helps someone to save some hours of trial-and-error :) |
Thank you very much, works like a charm. |
I've put pre-built |
Has anyone gotten this to work for Xamarin/MAUI? I've followed @jas88 instructions which solved the missing libleptonica.so file, however the linux patch will not work for mobile platforms (iOS & Android). Any suggestions? |
@ZitaRR In theory the same steps should work for MacOS, iOS and Android - after doing the Linux/x64 Tesseract build, I packaged libarchive.net for Windows, Linux and MacOS the same way, so I might well add MacOS Tesseract at some point soon. I haven't tried building libraries for iOS or Android yet - in theory it should be similar, but there are probably some platform pitfalls in store ... I might give it a try at some point though. |
For those who are interested in running the current Tesseract 5.2 version in .NET 6 Docker container, I've written the answer on SO. In short, Dockerfile is like this:
Other details can be seen on Stackoverflow |
This worked. Thank you. |
There is still the System.Drawing.Common depency in the pacakge which means there is never full support for corss platform tesseract without running into random issues. Could the System.Drawing.Common part of this library be replaced with something like SkiaSharp to not depend on windows only? |
@cmxl The System.Drawing.Common (Windows GDI) dependency seems to be confined to Tesseract.Drawing, at least? |
ah yes, sry for the confusion. It seems I had this dependency directly referenced which resulted in the error. The only thing that was limiting for me has always been the Pix class. |
When trying to run minimal application on linux, exception is thrown
System.DllNotFoundException: Failed to find library "libleptonica-1.78.0.so" for platform x64
So native dependencies aren't included for any platforms other than Windows it seems.
The text was updated successfully, but these errors were encountered: