<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>516162</bug_id>
          
          <creation_ts>2026-02-17 20:29:41 +0000</creation_ts>
          <short_desc>Tesseract library is not found</short_desc>
          <delta_ts>2026-04-16 13:33:33 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>Spectacle</product>
          <component>General</component>
          <version>6.6.0</version>
          <rep_platform>Fedora RPMs</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>VHI</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Steve Cossette">farchord</reporter>
          <assigned_to name="Noah Davis">noahadvs</assigned_to>
          <cc>agurenko</cc>
    
    <cc>fred.dumois</cc>
    
    <cc>kde</cc>
    
    <cc>madness742</cc>
    
    <cc>nate</cc>
    
    <cc>ngompa</cc>
    
    <cc>nivaca</cc>
    
    <cc>nucleo</cc>
    
    <cc>pallaswept</cc>
    
    <cc>pg_forums</cc>
    
    <cc>rikmills</cc>
    
    <cc>slartibart70</cc>
          
          <cf_commitlink>https://invent.kde.org/plasma/spectacle/-/commit/13b0be099e7abe9bbb17b90e62c2e83afb248db7</cf_commitlink>
          <cf_versionfixedin>6.7.0</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2495509</commentid>
    <comment_count>0</comment_count>
    <who name="Steve Cossette">farchord</who>
    <bug_when>2026-02-17 20:29:41 +0000</bug_when>
    <thetext>***
If you&apos;re not sure this is actually a bug, instead post about it at https://discuss.kde.org

If you&apos;re reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports

Please remove this comment after reading and before submitting - thanks!
***

SUMMARY
On Fedora 43 and up, loading spectacle works, but on load, we get the following error in the logs:

spectacle: Unable to load Tesseract candidate &quot;libtesseract.so.5&quot; : &quot;Cannot load library libtesseract.so.5: libtesseract.so.5: cannot open shared object file: No such file or directory&quot;
spectacle: Unable to load Tesseract candidate &quot;libtesseract.so.4&quot; : &quot;Cannot load library libtesseract.so.4: libtesseract.so.4: cannot open shared object file: No such file or directory&quot;
spectacle: Unable to load Tesseract candidate &quot;libtesseract.so&quot; : &quot;Cannot load library libtesseract.so: libtesseract.so: cannot open shared object file: No such file or directory&quot;
spectacle: Unable to locate a suitable Tesseract shared library
spectacle: Tesseract runtime library not available

Fedora uses Tesseract 5.5.2, which includes a libtesseract.so.5.5 and libtesseract.so.5.5.2, but no .5, .4 or .so.


STEPS TO REPRODUCE
1. On Fedora, launch spectacle from console
2. The app will start, but the above answer will show in the log.

OBSERVED RESULT
App starts, but an error shows in the log (And the associated features using tesseract do not work)

EXPECTED RESULT
No errors, and image scanning works

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 44
KDE Plasma Version: 6.6.0
KDE Frameworks Version: 6.23.0
Qt Version: 6.10.2
Kernel Version: 6.19.0-301.fc44.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 24 × AMD Ryzen 9 9900X3D 12-Core Processor
Memory: 128 GiB of RAM (125.3 GiB usable)
Graphics Processor: AMD Radeon RX 7900 XT
Manufacturer: Gigabyte Technology Co., Ltd.
Product Name: X870E AORUS MASTER X3D ICE
System Version: Default string-WCP-ADO-XT2

ADDITIONAL INFORMATION</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2495533</commentid>
    <comment_count>1</comment_count>
    <who name="Noah Davis">noahadvs</who>
    <bug_when>2026-02-17 22:03:01 +0000</bug_when>
    <thetext>It seems that the logic for loading tesseract may not be robust enough.

In case there&apos;s someone who can figure out a fix before me, here&apos;s some info about the relevant code.
In spectacle/src/TesseractRuntimeLoader.cpp, TesseractRuntimeLoader::loadLocked() calls TesseractRuntimeLoader::candidateLibraryNames() to get a list of library names.

&gt;QStringList TesseractRuntimeLoader::candidateLibraryNames() const
&gt;{
&gt;    return {QStringLiteral(&quot;libtesseract.so.5&quot;), QStringLiteral(&quot;libtesseract.so.4&quot;), QStringLiteral(&quot;libtesseract.so&quot;)};
&gt;}

In TesseractRuntimeLoader::loadLocked(), &quot;m_library&quot; is an instance of QLibrary (https://doc.qt.io/qt-6/qlibrary.html).

&gt;bool TesseractRuntimeLoader::loadLocked()
&gt;{
&gt;    const auto candidates = candidateLibraryNames();
&gt;    for (const QString &amp;candidate : candidates) {
&gt;        m_library.setFileName(candidate);
&gt;        m_library.setLoadHints(QLibrary::ExportExternalSymbolsHint | QLibrary::PreventUnloadHint);
&gt;
&gt;        if (!m_library.load()) {
&gt;            qCWarning(SPECTACLE_LOG) &lt;&lt; &quot;Unable to load Tesseract candidate&quot; &lt;&lt; candidate &lt;&lt; &apos;:&apos; &lt;&lt; m_library.errorString();
&gt;            continue;
&gt;        }
&gt;
&gt;        qCInfo(SPECTACLE_LOG) &lt;&lt; &quot;Attempting to use Tesseract library&quot; &lt;&lt; candidate;
&gt;
&gt;        if (!resolveSymbols()) {
&gt;            m_library.unload();
&gt;            continue;
&gt;        }
&gt;
&gt;        if (!validateLoadedVersion()) {
&gt;            m_library.unload();
&gt;            continue;
&gt;        }
&gt;
&gt;        m_loaded = true;
&gt;        qCInfo(SPECTACLE_LOG) &lt;&lt; &quot;Loaded Tesseract runtime library from&quot; &lt;&lt; m_library.fileName();
&gt;        return true;
&gt;    }
&gt;
&gt;    qCWarning(SPECTACLE_LOG) &lt;&lt; &quot;Unable to locate a suitable Tesseract shared library&quot;;
&gt;    return false;
&gt;}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2495539</commentid>
    <comment_count>2</comment_count>
    <who name="Bug Janitor Service">bug-janitor</who>
    <bug_when>2026-02-17 22:15:03 +0000</bug_when>
    <thetext>A possibly relevant merge request was started @ https://invent.kde.org/plasma/spectacle/-/merge_requests/511</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2495646</commentid>
    <comment_count>3</comment_count>
    <who name="">slartibart70</who>
    <bug_when>2026-02-18 10:10:28 +0000</bug_when>
    <thetext>in the meantime, doing this helps:

cd /usr/lib64
ln -s libtesseract.so.5.5 libtesseract.so.5</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2495741</commentid>
    <comment_count>4</comment_count>
    <who name="Antonio Rojas">arojas</who>
    <bug_when>2026-02-18 13:16:20 +0000</bug_when>
    <thetext>*** Bug 516203 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2495958</commentid>
    <comment_count>5</comment_count>
    <who name="Nicolas Vaughan">nivaca</who>
    <bug_when>2026-02-18 22:10:26 +0000</bug_when>
    <thetext>(In reply to slartibart70 from comment #3)
&gt; in the meantime, doing this helps:
&gt; 
&gt; cd /usr/lib64
&gt; ln -s libtesseract.so.5.5 libtesseract.so.5

This worked for me. Thanks.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2500959</commentid>
    <comment_count>6</comment_count>
    <who name="Noah Davis">noahadvs</who>
    <bug_when>2026-03-05 17:53:44 +0000</bug_when>
    <thetext>Git commit 921620e5153b2eb103c1633fee3995b187bd08db by Noah Davis.
Committed on 05/03/2026 at 15:07.
Pushed by ndavis into branch &apos;master&apos;.

Fix tesseract not being found on Fedora

Now it tries to match any library called &quot;tesseract&quot;

See https://doc.qt.io/qt-6/qlibrary.html#details for how this should work.
FIXED-IN: 6.6.1

M  +5    -1    src/TesseractRuntimeLoader.cpp

https://invent.kde.org/plasma/spectacle/-/commit/921620e5153b2eb103c1633fee3995b187bd08db</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2500961</commentid>
    <comment_count>7</comment_count>
    <who name="Noah Davis">noahadvs</who>
    <bug_when>2026-03-05 17:54:40 +0000</bug_when>
    <thetext>Git commit 89538f014de81ce15f70a3e8b1125648ef5d37ef by Noah Davis.
Committed on 05/03/2026 at 17:54.
Pushed by ndavis into branch &apos;Plasma/6.6&apos;.

Fix tesseract not being found on Fedora

Now it tries to match any library called &quot;tesseract&quot;

See https://doc.qt.io/qt-6/qlibrary.html#details for how this should work.
FIXED-IN: 6.6.1


(cherry picked from commit 921620e5153b2eb103c1633fee3995b187bd08db)

Co-authored-by: Noah Davis &lt;noahadvs@gmail.com&gt;

M  +5    -1    src/TesseractRuntimeLoader.cpp

https://invent.kde.org/plasma/spectacle/-/commit/89538f014de81ce15f70a3e8b1125648ef5d37ef</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2500962</commentid>
    <comment_count>8</comment_count>
    <who name="Noah Davis">noahadvs</who>
    <bug_when>2026-03-05 17:55:45 +0000</bug_when>
    <thetext>Changed the fixed-in version to 6.6.3 because the patch missed 6.6.1 and 6.6.2, but I forgot to change the commit message</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2506333</commentid>
    <comment_count>9</comment_count>
    <who name="pg_tips">pg_forums</who>
    <bug_when>2026-03-26 18:42:38 +0000</bug_when>
    <thetext>This isn&apos;t working correctly in spectacle 6.6.3-1 on Fedora 43.

On a system which has the &apos;tesseract-libs&apos; package installed (and therefore has library files at &apos;/usr/lib64/libtesseract.so.5.5.2&apos; and &apos;/usr/lib64/libtesseract.so.5.5&apos;, but no file simply called &apos;libtesseract.so&apos;), Spectacle reports that OCR is not available. Starting Spectacle from the command line gives the messages:

```
spectacle: Unable to load Tesseract candidate &quot;tesseract&quot; : &quot;Cannot load library tesseract: tesseract: cannot open shared object file: No such file or directory&quot;
spectacle: Unable to locate a suitable Tesseract shared library
spectacle: Tesseract runtime library not available
```

Looking at the documentation of the QLibrary class, does it actually do what we need here, i.e. to find &apos;libtesseract.so.5.5&quot; or &apos;libtesseract.5.5.2.so&apos;?

According to the docs, it &quot;tries the name with different platform-specific file prefixes, like &quot;lib&quot; on Unix and Mac ... and suffixes, like &quot;.so&quot; on Unix...&quot;.

So, if you tell it to look for &apos;tesseract&apos;, you&apos;d expect it to find &apos;libtesseract.so&apos;, but there&apos;s nothing to say that it will find files with version-specific suffices like &apos;libtesseract.so.5.5&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2506385</commentid>
    <comment_count>10</comment_count>
    <who name="Steve Cossette">farchord</who>
    <bug_when>2026-03-27 01:28:13 +0000</bug_when>
    <thetext>Can confirm:

spectacle: Unable to load Tesseract candidate &quot;tesseract&quot; : &quot;Cannot load library tesseract: tesseract: cannot open shared object file: No such file or directory&quot;
spectacle: Unable to locate a suitable Tesseract shared library
spectacle: Tesseract runtime library not available</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2506786</commentid>
    <comment_count>11</comment_count>
    <who name="pallaswept">pallaswept</who>
    <bug_when>2026-03-28 20:57:22 +0000</bug_when>
    <thetext>+1. I have a live opensuse tumbleweed image with 6.6.0 and another with 6.6.3. Installing libtesseract and a language pack will get it working on 6.6.0, the exact same tesseract packages installed on the image with 6.6.3 fails as described above. I also had it working on the host prior to the update to 6.6.3 and it is no longer working there.

Probable dupes, which were added since 6.6.3:
https://bugs.kde.org/show_bug.cgi?id=518039
https://bugs.kde.org/show_bug.cgi?id=517900</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2506789</commentid>
    <comment_count>12</comment_count>
    <who name="pallaswept">pallaswept</who>
    <bug_when>2026-03-28 21:36:24 +0000</bug_when>
    <thetext>(In reply to pg_tips from comment #9)
&gt; Looking at the documentation of the QLibrary class, does it actually do what
&gt; we need here, i.e. to find &apos;libtesseract.so.5.5&quot; or &apos;libtesseract.5.5.2.so&apos;?

Seems you&apos;re right. Qt is testing the &apos;lib&apos; prefix, and does test the .so suffix, but does not provide any wildcard/glob searching of the name or the extension.

I have /usr/lib64/libtesseract.so.5 -&gt; libtesseract.so.5.0.5

If I do sudo ln -s  /usr/lib64/libtesseract.so.5.0.5  %FILENAME

/usr/lib64/libtesseract.so    works
/usr/lib64/tesseract.so    works
/usr/lib64/tesseract.so.5    fails
/usr/lib64/tesseract5.so    fails</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2506792</commentid>
    <comment_count>13</comment_count>
    <who name="pallaswept">pallaswept</who>
    <bug_when>2026-03-28 22:19:19 +0000</bug_when>
    <thetext>And here&apos;s our root cause, a 7 year old bug in tesseract: https://github.com/tesseract-ocr/tesseract/issues/2749#issuecomment-4148915185</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2506867</commentid>
    <comment_count>14</comment_count>
    <who name="Nicolas Vaughan">nivaca</who>
    <bug_when>2026-03-29 14:51:38 +0000</bug_when>
    <thetext>It is now working for me.

Spectacle: 6.6.3
KDE Frameworks: 6.24.0
Qt: Using 6.10.2 and built against 6.10.2
Fedora Linux 43 (KDE Plasma Desktop Edition) (Wayland)
Build ABI: x86_64-little_endian-lp64
Kernel: linux 6.19.9-200.fc43.x86_64</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2506870</commentid>
    <comment_count>15</comment_count>
    <who name="pg_tips">pg_forums</who>
    <bug_when>2026-03-29 15:19:47 +0000</bug_when>
    <thetext>(In reply to Nicolas Vaughan from comment #14)
&gt; It is now working for me.
&gt; 
&gt; Spectacle: 6.6.3

Is that version 6.6.3-2 of the spectacle package? That has a patch by the Fedora maintainers to work around the bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2506871</commentid>
    <comment_count>16</comment_count>
    <who name="Nicolas Vaughan">nivaca</who>
    <bug_when>2026-03-29 15:30:13 +0000</bug_when>
    <thetext>Yes:
spectacle.x86_64 1:6.6.3-2.fc43
(In reply to pg_tips from comment #15)
&gt; (In reply to Nicolas Vaughan from comment #14)
&gt; &gt; It is now working for me.
&gt; &gt; 
&gt; &gt; Spectacle: 6.6.3
&gt; 
&gt; Is that version 6.6.3-2 of the spectacle package? That has a patch by the
&gt; Fedora maintainers to work around the bug.

Yes: spectacle.x86_64 1:6.6.3-2.fc43</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2506913</commentid>
    <comment_count>17</comment_count>
    <who name="Olivier BELLEUX">o.g.m.belleux</who>
    <bug_when>2026-03-29 18:59:50 +0000</bug_when>
    <thetext>Confirm on opensuse leap 16

spectacle: Unable to load Tesseract candidate &quot;tesseract&quot; : &quot;Impossible de charger la bibliothèque tesseract : tesseract: cannot open shared object file: No such file or directory&quot;
spectacle: Unable to locate a suitable Tesseract shared library
spectacle: Tesseract runtime library not available

Operating System: openSUSE Leap 16.0
KDE Plasma Version: 6.6.3
KDE Frameworks Version: 6.24.0
Qt Version: 6.10.2
Kernel Version: 6.12.0-160000.27-default (64-bit)
Graphics Platform: Wayland
Processors: 8 × 11th Gen Intel® Core™ i7-1165G7 @ 2.80GHz
Memory: 16 Gio of RAM (15.4 Gio usable)
Graphics Processor: Intel® Iris® Xe Graphics
Manufacturer: Notebook
Product Name: NLx0MU</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2507007</commentid>
    <comment_count>18</comment_count>
    <who name="Rik Mills">rikmills</who>
    <bug_when>2026-03-30 09:18:24 +0000</bug_when>
    <thetext>Can also confirm in Kubuntu 26.04.

Same issue. Cannot find or load the versioned libraries</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2507009</commentid>
    <comment_count>19</comment_count>
    <who name="Rik Mills">rikmills</who>
    <bug_when>2026-03-30 09:33:06 +0000</bug_when>
    <thetext>(In reply to Rik Mills from comment #18)
&gt; Can also confirm in Kubuntu 26.04.
&gt; 
&gt; Same issue. Cannot find or load the versioned libraries

i.e. In Ubuntu cannot not find/load libtesseract.so.5 or libtesseract.so.5.0.5</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2507216</commentid>
    <comment_count>20</comment_count>
    <who name="pallaswept">pallaswept</who>
    <bug_when>2026-03-31 08:47:17 +0000</bug_when>
    <thetext>Apparently a summary of my above posts and the attached links, is in order, so...

There is no need for &quot;works for me&quot; or &quot;doesn&apos;t work here&quot; posts. The nature of the problem is well understood, and we already know where it does and does not work.


There are three bugs interacting here:
- Tesseract built with cmake (fedora) has the wrong library soname (and so, mis-named symlink to the library) 
- Tesseract built with autotools (debian, suse, arch) has the wrong library filename
- Spectacle searches for the wrong name (because there is no right name, because of the above bugs)

The fix will be to first fix library naming of tesseract in each build system, and then to fix spectacle to search for the resulting libraries. 


Alternatively, for a permanent workaround if tesseract will not be fixed, spectacle could search for the various possible library names for all distros. The most portable way of doing this is 

return {QStringLiteral(&quot;tesseract.so.5.5&quot;), QStringLiteral(&quot;tesseract.so.5&quot;), QStringLiteral(&quot;tesseract.so.4&quot;), QStringLiteral(&quot;tesseract&quot;)};

This will work across all distros and all compatible releases of tesseract from either build system. 

For KDE I would recommend this course forward, as it will work both immediately and after tesseract is fixed and that fix rolls out, which may take some time, may be out of sync with KDE, or may never happen at all.

@KDE: This is what happens when developers ignore legit bug reports because they don&apos;t like the user who reported the bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2507250</commentid>
    <comment_count>21</comment_count>
    <who name="Rik Mills">rikmills</who>
    <bug_when>2026-03-31 14:13:56 +0000</bug_when>
    <thetext>(In reply to Noah Davis from comment #6)
&gt; Git commit 921620e5153b2eb103c1633fee3995b187bd08db by Noah Davis.

K/Ubuntu have had to revert this commit in packaging to fix this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2510310</commentid>
    <comment_count>22</comment_count>
    <who name="Nicolas Fella">nicolas.fella</who>
    <bug_when>2026-04-16 09:39:45 +0000</bug_when>
    <thetext>Git commit 13b0be099e7abe9bbb17b90e62c2e83afb248db7 by Nicolas Fella.
Committed on 16/04/2026 at 09:35.
Pushed by nicolasfella into branch &apos;master&apos;.

Properly link against tesseract

When using QLibrary to load a library at runtime, QLibrary finds the library by
looking for a file that has a platform dependent prefix and suffix added to a
given base name (e.g., &quot;tesseract&quot; -&gt; &quot;libtesseract.so&quot;). If a Linux distro
doesn&apos;t have a file called &quot;libtesseract.so&quot;, the library won&apos;t be found even if
&quot;libtesseract.so.5&quot; exists unless you add logic to also check for that file.

Tesseract has a bug where different ways of building it can generate different
library file names (https://github.com/tesseract-ocr/tesseract/issues/2749).
We could work around this by checking the file names used by different distros,
but we&apos;ve decided that it&apos;s better to link to the tesseract library to avoid
this problem entirely.

We generally prefer requiring libraries anyway to avoid situations where users
don&apos;t see a feature because they didn&apos;t know they needed to install an optional
dependency. That situation is unfortunately still not 100% avoidable since
Tesseract language packs are optional and Tesseract doesn&apos;t work without them.

M  +3    -0    CMakeLists.txt
M  +1    -1    src/CMakeLists.txt
M  +36   -67   src/OcrManager.cpp
M  +4    -5    src/OcrManager.h
D  +0    -189  src/TesseractRuntimeLoader.cpp
D  +0    -76   src/TesseractRuntimeLoader.h

https://invent.kde.org/plasma/spectacle/-/commit/13b0be099e7abe9bbb17b90e62c2e83afb248db7</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>