4lex4 / scantailor-advanced

ScanTailor Advanced is the version that merges the features of the ScanTailor Featured and ScanTailor Enhanced versions, brings new ones and fixes.
GNU General Public License v3.0
1.18k stars 129 forks source link

Build fails due to CMake error for target "JPEG::JPEG" #92

Closed FriedrichFroebel closed 4 years ago

FriedrichFroebel commented 4 years ago

I have previously been able to build STA using Ubuntu 18.04, but after pulling the latest commits from this repository, the build stopped working when following the steps from the official guide.

The first problem was the missing libqt5svg5-dev package which I was able to install, but running cmake .. from the build directory still fails with some issue regarding the JPEG::JPEG target. Trying to build with make afterwards nevertheless will abort due to a similar error later on.

How to fix this problem?

The following output is produced by cmake ..:

-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.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?

CMake Error at src/core/zones/CMakeLists.txt:19 (add_library):
  Target "zones" 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/tests/CMakeLists.txt:6 (add_executable):
  Target "core_tests" 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/filters/fix_orientation/CMakeLists.txt:17 (add_library):
  Target "fix_orientation" 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/filters/page_split/CMakeLists.txt:28 (add_library):
  Target "page_split" 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/filters/deskew/CMakeLists.txt:20 (add_library):
  Target "deskew" 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/filters/select_content/CMakeLists.txt:25 (add_library):
  Target "select_content" 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/filters/page_layout/CMakeLists.txt:23 (add_library):
  Target "page_layout" 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/filters/output/CMakeLists.txt:70 (add_library):
  Target "output" 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/app/CMakeLists.txt:70 (add_executable):
  Target "scantailor" 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?

-- Generating done
-- Build files have been written to: /home/me/github/scantailor-advanced/build
4lex4 commented 4 years ago

Update CMake

FriedrichFroebel commented 4 years ago

According to the build instructions, at least CMake 3.9.x is required. This does not seem to be true any more then, as Ubuntu 18.04 is currently shipping 3.10.2 which suffices the stated requirement.

Nevertheless I have been able to build STA again using the latest stable CMake build 3.16.4 now.

4lex4 commented 4 years ago

If you use old cmake you should also use old versions of the libraries. I won't duplicate cmake features on finding dependencies more as that required constant maintance, now cmake team is responsible for updating their finding modules to support newest versions of the libraries and they do it.