Hi Zdenko, thanks for your kind help and suggestions
I solved the issue, thanks to the help and suggestions, and explanations, I kindly received in StackOverFlow Best regards Raphy Il giorno sab 17 feb 2024 alle ore 19:21 Zdenko Podobny <zde...@gmail.com> ha scritto: > First of all: you should use tools you are familiar with. Your CMake > configuration (CMakeLists.txt) does not look that way (you would use CMake > to check required libraries, not PkgConfig, you would not hardcode curl for > linking etc...), > > Next. you should provide all the details to replicate the problem. What is > missing (at least): > > 1. BasicExample.cpp > 2. What OS you use (you put "WIN32 MACOSX_BUNDLE" to add_executable, > what is quite surprising combination) > 3. How did you install Tesseract? Some error outputs indicate manual > static linked tesseract. Why a static build? It could be quite tricky to > link static library with external dependencies > > Best regards, > > Zdenko > > > so 17. 2. 2024 o 19:06 Raphael Stonehorse <raphael.stoneho...@gmail.com> > napĂsal(a): > >> As described and discussed here: >> https://stackoverflow.com/questions/78011753/how-to-correctly-define-cmakelists-txt-for-tesseract >> I've been trying to use CMake for Tesseract compilation and building >> >> With this CMakeLists.txt : >> >> cmake_minimum_required(VERSION 3.5) >> project(BasicExample) >> >> set(CMAKE_CXX_STANDARD 17) >> >> find_package(PkgConfig REQUIRED) >> >> pkg_check_modules(tesseract REQUIRED IMPORTED_TARGET tesseract) >> pkg_check_modules(leptonica REQUIRED IMPORTED_TARGET lept) >> pkg_check_moduleS(libcurl REQUIRED IMPORTED_TARGET libcurl) >> >> add_executable(${PROJECT_NAME} WIN32 MACOSX_BUNDLE BasicExample.cpp) >> >> target_link_libraries(BasicExample PUBLIC >> PkgConfig::leptonica >> PkgConfig::tesseract >> -lcurl >> ) >> >> I get these errors: >> >> raphy@raohy:~/tesseract/Examples$ cmake -B builddir >> -- The C compiler identification is GNU 12.3.0 >> -- The CXX compiler identification is GNU 13.2.0 >> -- Detecting C compiler ABI info >> -- Detecting C compiler ABI info - done >> -- Check for working C compiler: /usr/bin/cc - skipped >> -- Detecting C compile features >> -- Detecting C compile features - done >> -- Detecting CXX compiler ABI info >> -- Detecting CXX compiler ABI info - done >> -- Check for working CXX compiler: /usr/bin/c++ - skipped >> -- Detecting CXX compile features >> -- Detecting CXX compile features - done >> -- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.1") >> -- Checking for module 'tesseract' >> -- Found tesseract, version 5.3.4 >> -- Checking for module 'lept' >> -- Found lept, version 1.82.0 >> -- Checking for module 'libcurl' >> -- Found libcurl, version 8.2.1 >> -- Configuring done (0.3s) >> -- Generating done (0.0s) >> -- Build files have been written to: >> /home/raphy/tesseract/Examples/builddir >> raphy@raohy:~/tesseract/Examples$ >> raphy@raohy:~/tesseract/Examples$ cmake --build builddir/ >> [ 50%] Building CXX object >> CMakeFiles/BasicExample.dir/BasicExample.cpp.o >> [100%] Linking CXX executable BasicExample >> /usr/bin/ld: /usr/local/lib/libtesseract.a(baseapi.cpp.o): in >> function `tesseract::TessBaseAPI::ProcessPagesInternal(char const*, char >> const*, int, tesseract::TessResultRenderer*)::{lambda(char >> const*)#1}::operator()(char const*) const': >> baseapi.cpp:(.text+0x13): undefined reference to `curl_easy_strerror' >> /usr/bin/ld: baseapi.cpp:(.text+0x3b): undefined reference to >> `curl_easy_cleanup' >> /usr/bin/ld: /usr/local/lib/libtesseract.a(baseapi.cpp.o): in >> function `tesseract::TessBaseAPI::ProcessPagesInternal(char const*, char >> const*, int, tesseract::TessResultRenderer*)': >> baseapi.cpp:(.text+0xad07): undefined reference to `curl_easy_init' >> /usr/bin/ld: baseapi.cpp:(.text+0xad48): undefined reference to >> `curl_easy_setopt' >> /usr/bin/ld: baseapi.cpp:(.text+0xad5d): undefined reference to >> `curl_easy_strerror' >> /usr/bin/ld: baseapi.cpp:(.text+0xad89): undefined reference to >> `curl_easy_cleanup' >> /usr/bin/ld: baseapi.cpp:(.text+0xb26f): undefined reference to >> `curl_easy_setopt' >> /usr/bin/ld: baseapi.cpp:(.text+0xb298): undefined reference to >> `curl_easy_setopt' >> /usr/bin/ld: baseapi.cpp:(.text+0xb2c1): undefined reference to >> `curl_easy_setopt' >> /usr/bin/ld: baseapi.cpp:(.text+0xb2fa): undefined reference to >> `curl_easy_setopt' >> /usr/bin/ld: baseapi.cpp:(.text+0xb324): undefined reference to >> `curl_easy_setopt' >> /usr/bin/ld: >> /usr/local/lib/libtesseract.a(baseapi.cpp.o):baseapi.cpp:(.text+0xb3c9): >> more undefined references to `curl_easy_setopt' follow >> /usr/bin/ld: /usr/local/lib/libtesseract.a(baseapi.cpp.o): in >> function `tesseract::TessBaseAPI::ProcessPagesInternal(char const*, char >> const*, int, tesseract::TessResultRenderer*)': >> baseapi.cpp:(.text+0xb455): undefined reference to `curl_easy_perform' >> /usr/bin/ld: baseapi.cpp:(.text+0xb6b0): undefined reference to >> `curl_easy_cleanup' >> /usr/bin/ld: /usr/local/lib/libtesseract.a(tessdatamanager.cpp.o): in >> function `tesseract::TessdataManager::LoadArchiveFile(char const*)': >> tessdatamanager.cpp:(.text+0x199): undefined reference to >> `archive_read_new' >> /usr/bin/ld: tessdatamanager.cpp:(.text+0x1ad): undefined reference >> to `archive_read_support_filter_all' >> /usr/bin/ld: tessdatamanager.cpp:(.text+0x1b5): undefined reference >> to `archive_read_support_format_all' >> /usr/bin/ld: tessdatamanager.cpp:(.text+0x1c5): undefined reference >> to `archive_read_open_filename' >> /usr/bin/ld: tessdatamanager.cpp:(.text+0x1e6): undefined reference >> to `archive_entry_pathname' >> /usr/bin/ld: tessdatamanager.cpp:(.text+0x1f6): undefined reference >> to `archive_read_next_header' >> /usr/bin/ld: tessdatamanager.cpp:(.text+0x208): undefined reference >> to `archive_read_free' >> /usr/bin/ld: tessdatamanager.cpp:(.text+0x294): undefined reference >> to `archive_entry_size' >> /usr/bin/ld: tessdatamanager.cpp:(.text+0x2e1): undefined reference >> to `archive_read_data' >> collect2: error: ld returned 1 exit status >> gmake[2]: *** [CMakeFiles/BasicExample.dir/build.make:99: >> BasicExample] Error 1 >> gmake[1]: *** [CMakeFiles/Makefile2:83: >> CMakeFiles/BasicExample.dir/all] Error 2 >> gmake: *** [Makefile:91: all] Error 2 >> raphy@raohy:~/tesseract/Examples$ >> >> What am I missing? How to make it work? >> >> -- >> 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-ocr+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/tesseract-ocr/c42c4e75-ae31-4a78-9152-839df7c00421n%40googlegroups.com >> <https://groups.google.com/d/msgid/tesseract-ocr/c42c4e75-ae31-4a78-9152-839df7c00421n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > 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-ocr+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/tesseract-ocr/CAJbzG8zsS-eo-s6_GO%3DHg1ED-6A0zKN%2BmVy4iy47k7MkzANarQ%40mail.gmail.com > <https://groups.google.com/d/msgid/tesseract-ocr/CAJbzG8zsS-eo-s6_GO%3DHg1ED-6A0zKN%2BmVy4iy47k7MkzANarQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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-ocr+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/CAKSMiAPgu7P0YRfKFMzyTO9ZqZ1Onu%2B%2BkNry0XDUBF0f-CQGGg%40mail.gmail.com.