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
Autotools build on Windows tries to link with libtiff when it's not available #4051
Comments
Did you try a build with line 759 removed or deactivated to avoid linking libtiff? Does it work and produce usable binaries? For some special options Tesseract tries to write TIFF files. That options won't work without libtiff. |
I didn't, but there's a HAVE_TIFFIO_H macro in tesseract.cpp, which suggest that libtiff support was probably designed to be optional. |
Even if tiffio.h is not available, libtiff might still be used by the Leptonica library which is used by Tesseract. That situation could cause problems on Windows. So either a build for Windows must provide both tiffio.h and libtiff, or it should be done without any tiff component (also no indirect tiff in Leptonica). Maybe that 2nd alternative does not work at all. The existing HAVE_TIFFIO_H does not indicate that it was designed to be supported. |
But if tiffio.h is not available, in practice this means that the development version of libtiff is not available as well. Anyway, the code in tesseract.cpp compiles fine, which suggest that the HAVE_TIFFIO_H macro is not defined, so the TIFF-related code in the file is not used and there's no sense to link with the library. BTW, the issue only affects the tesseract program, not the library.
This is exactly my case, as I use a custom Leptonica build configured with |
We have two options for the Tesseract builds for Windows:
Option 1 is our current solution, but currently fails too late at the link stage. It should fail right at the beginning when configure is run. Option 2 could be implemented by making |
@stweil yes, I use a statically linked build with a statically linked version of Leptonica, where I disable every image format except for PNM and BMP (so I can pass images to libtesseract). This issue is annoying because I have to hack / modify the CMakeLists.txt at build time to work around this. I thought I indicated through
|
So not only autotools but also cmake builds have a similar problem. |
We have several issues here:
=>
|
IMHO, due to the fact that Leptonica is dynamically linked (i.e. it's a DLL), it doesn't make much sense to do a build-time check if it was built with libtiff. Strictly speaking, the DLL can later be replaced with the one that has/lacks TIFF support. If these two functions are the only ones that are needed in tesseract.cpp, it would probably be easier to just use them if libtiff was found and not disabled explicitly by Another solution is to load these functions dynamically ( |
Please don't assume that, I link leptonica statically (because I want a single .exe file for simplicity). |
Current Behavior
When I build v5.3.1 on Windows under MSYS2 without libtiff, the configure script clearly tells that the library is not available:
Yet, linking tesseract.exe gives an error:
It looks like the libtiff is unconditionally linked on Windows:
tesseract/Makefile.am
Lines 758 to 761 in f1e3697
The text was updated successfully, but these errors were encountered: