Tesseract should not be compiled with --enable-opencl
Package Information
- Package name: tesseract-ocr
- Package version: 5.3.4-r0
- Alpine version: 3.20.0
- Alpine architecture: x86_64
Summary
When running tesseract in Docker, it is common to have no GPU. The recent change to compile with --enable-opencl is causing software such as ocrmypdf to crash when tesseract tries to find a GPU and can not. Here is an example error message.
[DS] Profile file not available (tesseract_opencl_profile_devices.dat); performing profiling. [DS] Device: "(null)" (Native) evaluation... Error in pixCloseBrick: pixs not 1 bpp Error in pixOpenBrick: pixs not defined Error in pixSubtract: pixs1 not defined Error in pixOpenBrick: pixs not defined Error in pixOpenBrick: pixs not defined [DS] Device: "(null)" (Native) evaluated [DS] composeRGBPixel: 0.017794 (w=1.2) [DS] HistogramRect: 0.015793 (w=2.4) [DS] ThresholdRectToPix: 0.025850 (w=4.5) [DS] getLineMasksMorph: 0.000040 (w=5.0) [DS] Score: 0.175782 [DS] Scores written to file (tesseract_opencl_profile_devices.dat). [DS] Device[1] 0:(null) score is 0.175782 [DS] Selected Device[1]: "(null)" (Native) List of available languages in "/usr/share/tessdata/" (23): ces dan deu est fin fra heb ita jpn jpn_vert khm lav lit nld nor pol por ron rus slk spa swe ukr
I discovered this issue when I made a custom docker container that runs ocrmypdf (which depends on tesseract).
I did some searching and found that the docspell project has run into this problem as well. I am not part of the docspell project.
https://github.com/eikek/docspell/issues/2504#issuecomment-1970644872
An additional reason to not compile with --enable-opencl is that the tesseract project removed OpenCL support in the V5.4.0-rc1 release as seen in this pull request: https://github.com/tesseract-ocr/tesseract/issues/4220