Errors during compilation

250 views
Skip to first unread message

Alberto Ramirez

unread,
Feb 5, 2022, 12:57:10 AM2/5/22
to tesseract-ocr
Full of errors occur when i try to link that leptonica, and not only. First, i am not good at cmake, so i had to figure out how to disable all the usless crap, that was enabled by default.

Then i had to compile leptonica, after that, some curl also was missing, i tried to compile that, and some other junk ss2 has been missing... Then some more stuff, so i disabled them in cmake, still now leptonica is missing, and i get almost 800 compile errors, about missing library, when clearly it's linked!! I am not wasting my time with this bullshit anymore, 3 days is enough.


This thing i put in the cmakelist

set(Leptonica_DIR C:/Users/ name /Documents/Qt_Projects/leptonica-master-build/src)

include_directories(
    C:/Users/name/Documents/Qt_Projects/leptonica-master-build/src
)

target_link_libraries(libtesseract C:/Users/name/Documents/Qt_Projects/leptonica-master-build/src/libleptonica-1.83.0.a)

Zdenko Podobny

unread,
Feb 5, 2022, 2:37:51 AM2/5/22
to tesser...@googlegroups.com
I am not sure what you try to communicate, but windows build is without problem see e.g. https://github.com/tesseract-ocr/tesseract/runs/5073771445
There are several ways how to build it on windows. Just read and carefully documentation or tutorials on the internet. 

Zdenko


so 5. 2. 2022 o 6:57 Alberto Ramirez <albert...@gmail.com> napísal(a):
--
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-oc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/86c6cd17-c8a4-4f75-96ec-1ce20927f625n%40googlegroups.com.

Alberto Ramirez

unread,
Feb 5, 2022, 1:54:54 PM2/5/22
to tesseract-ocr
What documentation? Cmake documentation or tesseract one? I tried to look up over the internet, but there's nothing clear why this crap happens, the stuff is linked, and i don't see any errors with missing lib, still errors occur, when the compilation is almost complete.

Zdenko Podobny

unread,
Feb 6, 2022, 5:54:47 AM2/6/22
to tesser...@googlegroups.com
If you are really interested in help/support you will need to change the way you communicate.
First of all, you did not describe what you did exactly, so nobody can reproduce your problem.
Next - from your post, I guess you have some problem with compilation. It is not clear what you try, but I have already provided you proof that tesseract (and leptonica) could be compiled on windows without a problem. Github actions document it clearly.
If you try to build/compile tesseract, you should read and follow tesseract documentation https://tesseract-ocr.github.io/tessdoc/

Zdenko


so 5. 2. 2022 o 19:54 Alberto Ramirez <albert...@gmail.com> napísal(a):

Alberto Ramirez

unread,
Feb 7, 2022, 11:25:06 PM2/7/22
to tesseract-ocr
" First of all, you did not describe what you did exactly "

I absolutely did, i compiled leptonica without errors, and then all i did, is paste that code from the tutorial i found, into cmakelists, and i posted an image with the errors i got, which someone deleted.

The errors are compile errors, not cmake errors, which suggest that the leptonica library isn't linked or whatever it might be, but the library is found, because there are no cmake messages complaining about it.

Alberto Ramirez

unread,
Feb 8, 2022, 10:16:13 AM2/8/22
to tesseract-ocr
After i clear everything, and rebuild it once again, i found some errors complaining about leptonica not being found and some lept.pc missing, before it said clearly that the library was found...

After i wwas able to locate that lept.pc, i get this message
Could NOT ind Leptonica (missing: Leptonica_DIR)

this is from that lept.pc

prefix=C:/Users/name/Documents/Qt_Projects/leptonica-master-build
exec_prefix=${prefix}/bin
libdir=${prefix}/lib
includedir=${prefix}/include

these paths don't exist, i don't have bin, include and lib folder,  i also don't have any dll's related to leptonica.

I append a picture with the files in the folder, the .a library ends up in src \leptonica-master-build\src\libleptonica-1.83.0.a with some other .h and .cpp files.

If i try to specify in cmake, where that libleptonica-1.83.0.a  is, after i hit generate in cmake, the path is set back to not specified, and idk why..

How am i supposed to change the path, if it's reset to unspecified after i just set it??


i1.png
i2.png

Zdenko Podobny

unread,
Feb 10, 2022, 2:10:38 AM2/10/22
to tesser...@googlegroups.com
I already proved to you that windows cmake build works without any modification.
Nobody is able to replicate your problem if you do not provide exact steps (commands) what you do + error messages (maybe full log of configuration and compilations).


Zdenko


ut 8. 2. 2022 o 16:16 Alberto Ramirez <albert...@gmail.com> napísal(a):
--
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-oc...@googlegroups.com.

Alberto Ramirez

unread,
Feb 11, 2022, 8:40:03 AM2/11/22
to tesseract-ocr
As i probably already said, i don't have much experience with that cmake, i tried to follow some yt tutorials, but it disn't help much, even when they compiled it without problem.

Doesn't matter, somehow i get it almost done, i finally compiled and linked leptonica, i compiled gif, tiff, png, jpeg and zlib, and also linked it, and now i have one last compile error:
"undefined reference to `nano_sleep'", when i click on it it points to the file "tesseract-main\src\viewer\svutil.cpp"

I tried to google it, but nothing shows up.

Alberto Ramirez

unread,
Feb 11, 2022, 8:46:43 AM2/11/22
to tesseract-ocr
And this is the output i get

[ 73%] Building CXX object CMakeFiles/libtesseract.dir/src/api/wordstrboxrenderer.cpp.obj
[ 74%] Building CXX object CMakeFiles/libtesseract.dir/src/arch/dotproduct.cpp.obj
[ 74%] Building CXX object CMakeFiles/libtesseract.dir/src/arch/simddetect.cpp.obj
[ 74%] Building CXX object CMakeFiles/libtesseract.dir/src/arch/intsimdmatrix.cpp.obj
[ 75%] Building CXX object CMakeFiles/libtesseract.dir/src/arch/dotproductavx.cpp.obj
C:\Users\UserName\Documents\Qt_Projects\tesseract-main\src\arch\dotproductavx.cpp: In function 'double tesseract::DotProductAVX(const double*, const double*, int)':
C:\Users\UserName\Documents\Qt_Projects\tesseract-main\src\arch\dotproductavx.cpp:74:27: warning: requested alignment 32 is larger than 16 [-Wattributes]
   alignas(32) double tmp[4];
                           ^
[ 75%] Building CXX object CMakeFiles/libtesseract.dir/src/arch/intsimdmatrixavx2.cpp.obj
[ 75%] Building CXX object CMakeFiles/libtesseract.dir/src/arch/dotproductfma.cpp.obj
C:\Users\UserName\Documents\Qt_Projects\tesseract-main\src\arch\dotproductfma.cpp: In function 'double tesseract::DotProductFMA(const double*, const double*, int)':
C:\Users\UserName\Documents\Qt_Projects\tesseract-main\src\arch\dotproductfma.cpp:78:27: warning: requested alignment 32 is larger than 16 [-Wattributes]
   alignas(32) double tmp[4];
                           ^
[ 76%] Building CXX object CMakeFiles/libtesseract.dir/src/arch/dotproductsse.cpp.obj
[ 76%] Building CXX object CMakeFiles/libtesseract.dir/src/arch/intsimdmatrixsse.cpp.obj
[ 77%] Linking CXX static library libtesseract50.a
[ 77%] Built target libtesseract
[ 77%] Building CXX object CMakeFiles/tesseract.dir/src/tesseract.cpp.obj
[ 78%] Linking CXX executable bin\tesseract.exe
libtesseract50.a(svutil.cpp.obj):svutil.cpp:(.text+0xfa2): undefined reference to `nano_sleep'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [CMakeFiles\tesseract.dir\build.make:109: bin/tesseract.exe] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:162: CMakeFiles/tesseract.dir/all] Error 2
mingw32-make: *** [Makefile:135: all] Error 2

Zdenko Podobny

unread,
Feb 13, 2022, 10:27:57 AM2/13/22
to tesser...@googlegroups.com
I am sorry, but I have feel like playing seek and hide. 

Why you do not provide the full output of all steps you did???  Including configuration and setting of compiling environment? 

E.g. your error comes from 'nano_sleep' but when I check the svutil.cpp (I needed to guess based on the error message you try build tesseract version 5) there is no function nano_sleep. 

Also, I see you try to build a static library. Do you have enough experience for that? I guess that nano_sleep is related to that.

Also, this is the first time I see that you built the tesseract with mingw32. It should be possible, but why did not use the installer provided by UB Mannheim? What are your intentions?


Zdenko


pi 11. 2. 2022 o 14:46 Alberto Ramirez <albert...@gmail.com> napísal(a):
--
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-oc...@googlegroups.com.

Alberto Ramirez

unread,
Feb 13, 2022, 6:18:35 PM2/13/22
to tesseract-ocr
I don't know what do you mean by "Including configuration and setting of compiling environment"..
Which configuration? Name me the file you want.  I use qt in order to compile, i drag and drop the cmakelists and hit build, i don't change anything else, except for cmakecache in cmake, in order to change the config of what should or shoulnd't be enabled.

" but why did not use the installer provided by UB Mannheim " because first of all, i didn't know it was there, second, i lost more than 5 days, to understand how to compile these libs,  and now i don't really want to use the compiled libs of someone else.
Does that thing even works with mingw?

I have no clue where in the world that thing "nano_sleep" comes from, it's some rubbish bs bug out of nowhere... I tried to look it up, but it doesn't even exist anywhere, i run a search inside all the files, and nothing was found, so idk why that thing even happen, the method i use works basically with anything, since i don't want to deal much with cmake and all the boring configs, that are just a waste of time, when i just can drag and drop, and hit build..

I would rather install and use these dll's you provided if they work with that mingw, but i am very curious how to fix that thing, cause it just doesn't make any sense.

Alberto Ramirez

unread,
Feb 13, 2022, 6:22:59 PM2/13/22
to tesseract-ocr
Here i found this bug https://github.com/espressif/esp-idf/issues/3559, i guess it's not related to this thing at all. They claim it's because of c++14 or c++17.
Reply all
Reply to author
Forward
0 new messages