X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EF517383F84A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1589507124; bh=EjUKeW+w77CQfL/bUSnf3qxxELIUk1apvts4/6yZNRs=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=AMmKzfsNOmvTvIyZfvNReWWFts0SKHCYR4wIIoW8DgJMHgQknYq9ns+gOwi9V8kvk L3kOrLK4dYgHbRlufAdrjSf2UkP246oR9V8RSBMuqkABODGftSPF7UDSAScT7xJHBe G23NuIh8Ybzv0mZf/q4xODVFwWNcyM/50G4S4Cpo= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 77D1A38708E6 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=CLnMKgnhPdtQ29yIXEdTpTxCrPQgqVyCzR2QmxJURy8=; b=lsBKg4ElSwtFEju21OBjnjehFPdcDvHbEMpSMoMtTGMlrO3JQR5QOYSnqg8o/pEA5Z KqllX0ZnkNJc/lR15U7NnJJqLZsmzriReqv2J2I6tPC0qP6+zT6dohQuVihfSyTL9cOF lYCvK2qL1EI0dLjpq+G4eF7VcheaiMMrhxbVjgH8fSgwZkGPTXKhUDMjGkPIodDow6C9 cLtPhndeUHv7wzGGMv3XFAjjaoOUJBWKIJ6jh9ksBPQ2CAZM1f4pCowudJagSSkyXflc HemvMZLieSN3NV7DDF3mMAO4RT7YlJMLtbQt8h8zc2B9t8ipVTp+pXn5zJGm5+jlNT/s odqw== X-Gm-Message-State: AOAM530tOABv4PtCL6xZo+tdJb5JPbGzay6qQtg1ekMkbvpTvM+ijVYc rl88t6IGjNKjAdl7HcMJkNWIhpXSj3g= X-Google-Smtp-Source: ABdhPJwPZhTosPlBSJPaiWpBv6PZYXAb/wYJgSLkhKfmcFru1pjfnITjVuNpItl3Tjf+bhXXRs48VQ== X-Received: by 2002:a1c:4d18:: with SMTP id o24mr1144200wmh.141.1589507109684; Thu, 14 May 2020 18:45:09 -0700 (PDT) Subject: Re: Trying to build OCRmyPDF under Cygwin, hit a brick wall To: cygwin AT cygwin DOT com References: <2afedbcf-f3d7-4e96-e196-fb3091630245 AT jhmg DOT net> Message-ID: <30096962-60b0-45d2-434f-9eb0da786061@gmail.com> Date: Fri, 15 May 2020 03:45:08 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <2afedbcf-f3d7-4e96-e196-fb3091630245@jhmg.net> X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Marco Atzeri via Cygwin Reply-To: Marco Atzeri Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: cygwin-bounces AT cygwin DOT com Sender: "Cygwin" Am 15.05.2020 um 00:50 schrieb Jim Garrison via Cygwin: > 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 > > > > $ ocrmypdf --help > Traceback (most recent call last): > File "/usr/bin/ocrmypdf", line 11, in > load_entry_point('ocrmypdf==9.8.0.post3+g5944044.d20200514', > 'console_scripts', 'ocrmypdf')() > File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", > line 489, in load_entry_point > return get_distribution(dist).load_entry_point(group, name) > File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", > line 2852, in load_entry_point > return ep.load() > File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", > line 2443, in load > return self.resolve() > File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", > line 2449, in resolve > module = __import__(self.module_name, fromlist=['__name__'], level=0) > File > "/usr/lib/python3.7/site-packages/ocrmypdf-9.8.0.post3+g5944044.d20200514-py3.7.egg/ocrmypdf/__init__.py", > line 18, in > 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 > """ > ocrmypdf.exceptions.MissingDependencyError: > > --------------------------------------------------------------------- > This error normally occurs when ocrmypdf can't find the Leptonica > library, which is usually installed with Tesseract OCR. It could > be that > Tesseract is not installed properly, we can't find the installation > on your system PATH environment variable. > > The library we are looking for is usually called: > liblept-5.dll (Windows) > liblept*.dylib (macOS) > liblept*.so (Linux/BSD) > > Please review our installation procedures to find a solution: > https://ocrmypdf.readthedocs.io/en/latest/installation.html > > --------------------------------------------------------------------- > > > 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?) standard on Cygwin to differentiate from mingw build https://cygwin.com/cygwin-ug-net/dll.html > > 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() > elif sys.platform == 'cygwin': > libname = 'cyglept-5' > 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: > > > $ python3 > Python 3.7.7 (default, Apr 10 2020, 07:59:19) > [GCC 9.3.0] on cygwin > Type "help", "copyright", "credits" or "license" for more information. >>>> import os >>>> import sys >>>> from ctypes import * >>>> from ctypes.util import find_library >>>> find_library('cyglept-5') or 'Not found' > 'Not found' >>>> find_library('cyglept-5.dll') or 'Not Found' > 'Not Found' >>>> cdll.LoadLibrary('cyglept-5.dll') or 'Not Found' > > > > So it appears to me that possibly find_library() is broken because > it doesn't find the library, but yet Python can actually load the > library. > > What am I missing? > where are you looking for ? Have you installed libleptonica_5 and libleptonica-devel ? $ cygcheck -cd |grep lept leptonica 1.79.0-1 libleptonica-devel 1.79.0-1 libleptonica_5 1.79.0-1 -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple