[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake build fails on Ubuntu bionic because of old cmake version #3702

Closed
stweil opened this issue Jan 1, 2022 · 15 comments
Closed

cmake build fails on Ubuntu bionic because of old cmake version #3702

stweil opened this issue Jan 1, 2022 · 15 comments

Comments

@stweil
Copy link
Contributor
stweil commented Jan 1, 2022

cmake version 3.10.2 aborts the build:

CMake Error at src/training/CMakeLists.txt:4 (cmake_policy):
  Policy "CMP0074" is not known to this version of CMake.

Can this policy be set conditionally only for newer versions of cmake?

After removing the policy line, the build sets wrong linker options for Curl (caused by commit c4ad9b7):

CMake Error at CMakeLists.txt:812 (add_executable):
  Target "tesseract" links to target "CURL::libcurl" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
[...]

After fixing that locally, building tesseract works, but the training tools give linker errors:

[ 90%] Linking CXX executable ../../bin/text2image
cd /home/ubuntu/src/github/tesseract-ocr/tesseract/build/src/training && /usr/bin/cmake -E cmake_link_script CMakeFiles/text2image.dir/link.txt --verbose=1
/usr/bin/clang++-10  -O3 -DNDEBUG -Wno-unused-command-line-argument   CMakeFiles/text2image.dir/text2image.cpp.o CMakeFiles/text2image.dir/degradeimage.cpp.o  -o ../../bin/text2image libpango_training.a libunicharset_training.a libcommon_training.a ../../libtesseract.a -lpthread /usr/lib/powerpc64le-linux-gnu/libarchive.so /usr/lib/powerpc64le-linux-gnu/libcurl.so -llept 
/usr/bin/ld: libpango_training.a(ligature_table.cpp.o): undefined reference to symbol '_ZN6icu_608ByteSink5FlushEv'
//usr/lib/powerpc64le-linux-gnu/libicuuc.so.60: error adding symbols: DSO missing from command line
clang: error: linker command failed with exit code 1 (use -v to see invocation)
src/training/CMakeFiles/text2image.dir/build.make:126: recipe for target 'bin/text2image' failed
make[2]: *** [bin/text2image] Error 1
make[2]: Leaving directory '/home/ubuntu/src/github/tesseract-ocr/tesseract/build'
CMakeFiles/Makefile2:228: recipe for target 'src/training/CMakeFiles/text2image.dir/all' failed
make[1]: *** [src/training/CMakeFiles/text2image.dir/all] Error 2
make[1]: Leaving directory '/home/ubuntu/src/github/tesseract-ocr/tesseract/build'
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

That looks like the linker does not get called with all necessary libraries.

@stweil
Copy link
Contributor Author
stweil commented Jan 1, 2022

Commit e1764e1 fixes the problem with clang policy CMP0074.

@stweil
Copy link
Contributor Author
stweil commented Jan 2, 2022

The linker errors are also caused by the cmake version: <XXX>_LINK_LIBRARIES variables which are currently used in the training build are only supported since cmake 3.12.

@egorpugin
Copy link
Contributor

cmake version 3.10.2 aborts the build

We should bump minimum cmake version then.

@zdenop
Copy link
Contributor
zdenop commented Jan 2, 2022

version 3.10.2 was released 4 years ago. The current version is 3.22.1. Any chance they would include a newer version?

@zdenop
Copy link
Contributor
zdenop commented Jan 2, 2022

Ubuntu bionic is version 18.4. According action there is no problem with building training tools.

Can you check if all necessary libraries are installed and OK? Maybe reinstall icu libs?

@stweil
Copy link
Contributor Author
stweil commented Jan 2, 2022

We should bump minimum cmake version then.

Ubuntu bionic comes with cmake 3.10.2 and is supported until 2023. So I'd wait with dropping that version.

Can you check if all necessary libraries are installed and OK? Maybe reinstall icu libs?

Replacing <XXX>_LINK_LIBRARIES (which is not supported by cmake 3.10.2) fixes the build, so it does not look like a problem of missing libraries.

@zdenop
Copy link
Contributor
zdenop commented Jan 2, 2022

Ubuntu bionic comes with clang 3.10.2
I assume you mean cmake 3.10.2. Right?

I did not get this. Why build on Ubuntu 18.04.6 works (x86?), but on the ppc64le not (icu)? I expect there is the same version of cmake (and other packages).

@stweil
Copy link
Contributor Author
stweil commented Jan 2, 2022

Thanks, yes, it should be cmake, not clang. I fixed my comment now. And cmake on Ubuntu bionic x86* should have the same problem, so either there is a newer cmake version (where from?) or it does not use the problematic lines.

@stweil stweil changed the title cmake build fails on Ubuntu bionic ppc64le cmake build fails on Ubuntu bionic because of old cmake version Jan 3, 2022
@stweil
Copy link
Contributor Author
stweil commented Jan 3, 2022

GitHub actions for Ubuntu always use the latest cmake version (not the one which is provided by Ubuntu). Therefore those CI actions don't have a problem.

@stweil
Copy link
Contributor Author
stweil commented Jan 3, 2022

This issue was fixed by pull request #3705.

@stweil stweil closed this as completed Jan 3, 2022
@amitdo
Copy link
Collaborator
amitdo commented Jan 16, 2022

What about requiring 3.10 as the minimum CMake version instead of 3.7?

@stweil
Copy link
Contributor Author
stweil commented Jan 16, 2022

That would be possible, but is it necessary? Do we already or do we want to use features which work with 3.10, but not with 3.7?

@amitdo
Copy link
Collaborator
amitdo commented Jan 16, 2022

Do we already or do we want to use features which work with 3.10, but not with 3.7?

I don't know.

Did you tested Tesseract 5.0.1 with CMake 3.7? If you did not, how do you know we don't use a CMake feature that is not supported in CMake 3.7?

@stweil
Copy link
Contributor Author
stweil commented Jan 16, 2022

Debian stretch has 3.7. I now did a test there, and cmake failed.

CMakeLists.txt uses TREE (supported since 3.8) and check_ipo_supported (supported since 3.9). So the cmake build already requires 3.9, and we should indeed update the documented requirement.

For Debian stretch there is a newer version in stretch-backports, and Ubuntu bionic already has 3.10. Therefore requiring 3.10 would be fine for me, too.

@stweil
Copy link
Contributor Author
stweil commented Jan 16, 2022

See pull request #3724.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants