Trying to build OCRmyPDF under Cygwin, hit a brick wall
René Berber
rene.berber@gmail.com
Fri May 15 00:23:36 GMT 2020
On 5/14/2020 5:50 PM, Jim Garrison via Cygwin wrote:
> The magic incantation necessary to get strdup turns out to be -
> D_GNU_SOURCE, as noted on StackOverflow.
>
> However, now I'm encountering a problem with Python's DLL handling
> code. When attempting to run OCRmyPDF I get
[snip]
> line 18, in <module>
> from . import helpers, hocrtransform, leptonica, pdfa, pdfinfo
> File
> "/usr/lib/python3.7/site-packages/ocrmypdf-9.8.0.post3+g5944044.d20200514-py3.7.egg/ocrmypdf/leptonica.py",
> line 67, in <module>
> """
> ocrmypdf.exceptions.MissingDependencyError:
[snip]
> In the last file of the traceback (leptonica.py) there's this:
>
>
> from ctypes.util import find_library
> ...
> if os.name == 'nt':
> libname = 'liblept-5'
> os.environ['PATH'] = shim_paths_with_program_files()
> else:
> libname = 'lept'
>
>
> In Cygwin, that library is /usr/bin/cyglept-5.dll (why was the name
> changed?)
>
> First I created a symlink from cyglept-5.dll to liblept-5.dll, with no
> effect. So I added a test for Cygwin at that point, resulting in this
> code:
>
>
> if os.name == 'nt':
> libname = 'liblept-5'
> os.environ['PATH'] = shim_paths_with_program_files()
Notice this change in search path, dll files in Windows are executables
and they are (must) installed in the system PATH (or the current directory).
> elif sys.platform == 'cygwin':
> libname = 'cyglept-5'
On Cygwin you can do the same as above, it will contain /bin (or
/usr/bin which are one and the same).
> else:
> libname = 'lept'
>
>
> This also had no effect, so I tried playing with find_library() in the
> interactive shell. In Cygwin, it doesn't seem to find any DLLs even
> though those DLLs are actually loadable. Viz:
[snip]
My guess is the search path is incorrect.
Either that or python needs the symbols file, like the linker, which in
this case would be /usr/lib/liblept.dll.a, which is in the -devel
package, but I doubt it.
--
R.Berber
More information about the Cygwin
mailing list