OpenCV+Tesseract, problems linking to Leptonica (ubuntu, docker)

Hello everybody.

I need to use OCRTesseract in our project. It already extensively uses OpenCV.
So to enable OCRTesseract, I needed to install tesseract-ocr. Installing it using just package manager didn’t work: probably package doesn’t come with cmake configuration files, so cmake cannot find tesseract.
So I cloned Tesseract project and built it locally. In the process I had to clone and build Leptonica project, which is required for Tesseract.
Finally after that opencv cmake reported that it found Tesseract and I started build.
Unfortunaly it failed with numerous errors from linker:

[ 63%] Linking CXX executable …/…/bin/opencv_test_text
/usr/bin/ld: …/…/lib/libopencv_text.so.4.5.5: undefined reference to pixCopy' /usr/bin/ld: ../../lib/libopencv_text.so.4.5.5: undefined reference to numaDestroy’
/usr/bin/ld: …/…/lib/libopencv_text.so.4.5.5: undefined reference to pixReadMemTiff' /usr/bin/ld: ../../lib/libopencv_text.so.4.5.5: undefined reference to pixClearInRect’

Those symbols are from Leptonica, and it is there, otherwise I wouldn’t be able to build Tesseract in the first place. How do I make ld find the proper library?..

I use OpenCV 4.5.5, Tesseract and Leptonica are masters.