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 error despite all dependencies being installed #7

Open
Fifis opened this issue Apr 18, 2020 · 3 comments
Open

CMake error despite all dependencies being installed #7

Fifis opened this issue Apr 18, 2020 · 3 comments

Comments

@Fifis
Copy link

Fifis commented Apr 18, 2020

There is an issue in Ubuntu 18.04 and systems based on it (including the very popular Linux Mint 19.3): after installing the all the dependencies and compilers and doing cmake -G "Unix Makefiles" --build .., the compiler throws a bunch of errors like

-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11"
-- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.6.34")
-- Found TIFF: /usr/lib/x86_64-Linux-gnu/Libtiff.so (found version "4.0.9")
-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   unit_test_framework
--   prg_exec_monitor
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread create
-- Looking for pthread create - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Configuring done

CMake Error at src/core/CMakeLists.txt:120 (add library):
  Target "core" links to target "JPEG::JPEG" but the target was not found.
  Perhaps a find package() call is missing for an IMPORTED target, or an
  ALIAS target is missing?

CMake Error at src/core/interaction/CMakeLists.txt:14 (add_library):
  Target "interaction" links to target "JPEG::JPEG" but the target was not
  found. Perhaps a find package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

The version of CMake that is proposed in the repositories for Ubuntu-18.04-based distributions is 3.10, and it is probably slightly broken, so what helped—and what is currently outside the scope of this tutorial and what a strongly recommend to the ‘Troubleshooting’ section is the following:
— If CMake produces errors complaining about not finding targets despite all libraries with development headers already being present in the system, then remove CMake (sudo apt remove cmake cmake-data) and compile CMake from sources:

cd cmake-3.17.1/
./bootstrap --parallel=2 -- -DCMAKE_BUILD_TYPE:STRING=Release
make -j2
make install

(or replacing the last line with sudo checkinstall --fstrans=no for easier uninstallation even when the sources are gone), and after that, CMake should find all libraries and compile scantailor-advanced without a hindrance.

@4lex4
Copy link
Owner

4lex4 commented Apr 21, 2020

or replacing the last line with sudo checkinstall --fstrans=no for easier uninstallation even when the sources are gone

Have you tried cpack -G "DEB" and installing the resulting package with the default package manager?
There is also an alternative approach without building: just to download cmake binaries, unpack, output all the files in the cmake directory via find into a text file, install with cp, and then use xargs with rm for removing. The only downside you need to keep that text file somewhere.

@Fifis
Copy link
Author

Fifis commented Apr 24, 2020

Yeah, both cpack -G "DEB" (for cmake version 3.17.1) and sudo checkinstall --fstrans=no work without a hindrance after a successful compilation, so it is not the point of this issue. It is cmake that was throwing errors (the 3.10 cmake supplied in Linux Mint 19.3) before the compilation, after which make would return a compilation error.

@4lex4 4lex4 mentioned this issue Apr 29, 2020
@bertvandepoel
Copy link

So if I understand things correctly, scantailor-advanced can't be built with CMake 3.10 (the default in Ubuntu 18.04)?

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

No branches or pull requests

3 participants