Closed dr-matt closed 1 month ago
Please provide information about OS and exact commands you use to build and install leptonica and tesseract.
We run GA for cmake builds and they are working for windows, linux(ubuntu) and mac:
(MacOS macos-12-clang-14-cmake build fails for some reason at baseapi test, but rest macos build are ok)
Thank you for that. I'm on ubuntu 24.04, cmake version 3.28.3.
Command to build leptonica:
cmake <srcdir> -DCMAKE_INSTALL_PREFIX=/tmp/leptonica
make install
Command to build tesseract:
cmake <srcdir> -DLeptonica_DIR=/tmp/leptonica/lib/cmake/leptonica -DGRAPHICS_DISABLED=on -DBUILD_TRAINING_TOOLS=off
In trying to reproduce this cleanly, I discovered some strange behavior. In certain situations the error does not show up. However, if cmake is run multiple times with different arguments, without first clearing the cache, then we can see the error.
For instance, if just before running the above cmake command for tesseract, we just do cmake <srcdir>
, then the second cmake command fails.
This came up when we configured the tesseract build using cmake-gui
, which by default first runs cmake
without any arguments. After we filled in Leptonica_DIR
and re-ran, we saw the error mentioned above, and it persisted until we deleted the entire cache, build tree, and install tree.
Doing fully clean builds, we can't reproduce this issue. So perhaps it's just related to some sticky state related to tesseract and/or cmake.
AFAIR Leptonica_DIR
is the tesseract relic from a time when leptonica did not create files needed for find_package
.
Can you please try to use the standard cmake setting -DCMAKE_PREFIX_PATH=/tmp
?
It may be moot, as the error isn't reproducible if everything is done from a clean install. Closing this issue, thanks for the review.
I'm trying to build tesseract, which depends on leptonica. I built leptonica successfully via cmake, but when I try to build tesseract, cmake emits the following complaint and can't proceed:
Note that this is not tesseract-specific. If I create a minimal cmake project with the line:
it fails in the same way.
From what I can tell, this is because
Leptonica_FOUND
is not explicitly set toTRUE
orFALSE
in leptonica's generated cmake configs. A workaround/fix is to simply add the following line at the end ofcmake/templates/LeptonicaConfig.cmake.in
:After doing so, tesseract is able to successfully find leptonica and all is well.