szcompressor/SZauto

install TARGETS given target "sz_cpp" which does not exist in this directory. (CMake version too low?)

Wout12345 opened this issue · 8 comments

I'm trying to build SZauto but am having some trouble with the CMake configuration. After setting up the zstd paths correctly, I get the following error (I'm running the following command in the build directory):

cmake .. -DCMAKE_INSTALL_PREFIX:PATH=build
CMake Error at CMakeLists.txt:21 (install):
  install TARGETS given target "sz_cpp" which does not exist in this
  directory.


-- Configuring incomplete, errors occurred!

This seems to be caused by the following issue: https://stackoverflow.com/questions/34443128/cmake-install-targets-in-subdirectories

It seems like this set-up would work if CMake version >= 3.13 is used, but the file itself only requires 3.0. Could this be updated? Or even better, could the CMakeLists be updated such that they can also be processed by lower versions?

Thanks!

ayzk commented

I just verified the project can be built by cmake 3.9.1 without errors. The cmake_minimum_required has been changed to 3.9.

Thank you for your comments. First of all I must say that I switched back to SZ since it seems that SZauto doesn't yet have a (documented) command-line interface, which is what I need. Nevertheless I appreciate the help and hope you don't mind if I report my current compilation problems just for the sake of improving the library, although I don't plan on using it at the moment.

@disheng222 : Thank you for the alternative set-up. I tried running these command and got a problem with the first make command. This is an excerpt from the output:

In file included from src/sz_autotuning_3d.cpp:5:0:
./include/sz_lossless.hpp:7:10: fatal error: zstd.h: No such file or directory
 #include "zstd.h"
          ^~~~~~~~
compilation terminated.

This may be caused by the fact that I don't have zstd installed system-wide. However, it seems as if SZauto tries to compile and use its own copy, so this seems like a bug.

@ayzk : I see the CMakeLists.txt file in the root directory was changed as well. With this new file I also have the problem that zstd is not found because it is not installed system-wide. I fixed this in my installation from two days ago by manually installing zstd in a separate directory and adapting CMakeLists.txt to point to it. However, since I see SZauto comes with a copy of zstd, this seems like a bug. Isn't CMake supposed to build and use the zstd source files you included in the zstd directory? To be precise, these are the errors during CMake generation:

-- Configuring done
CMake Error at src/CMakeLists.txt:1 (add_library):
  Target "sz_cpp" links to target "PkgConfig::ZSTD" 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 test/CMakeLists.txt:6 (add_executable):
  Target "sz_sampling_test" links to target "PkgConfig::ZSTD" 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 test/CMakeLists.txt:4 (add_executable):
  Target "sz_autotuning_double" links to target "PkgConfig::ZSTD" 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 test/CMakeLists.txt:3 (add_executable):
  Target "sz_autotuning" links to target "PkgConfig::ZSTD" 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 test/CMakeLists.txt:5 (add_executable):
  Target "sz_highorder_test" links to target "PkgConfig::ZSTD" 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 test/CMakeLists.txt:2 (add_executable):
  Target "sz_huffman_lossless" links to target "PkgConfig::ZSTD" 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 test/CMakeLists.txt:1 (add_executable):
  Target "sz_test1" links to target "PkgConfig::ZSTD" 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/CMakeLists.txt:1 (add_library):
  Target "sz_cpp" links to target "PkgConfig::ZSTD" 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
[...]

As a result, I can't yet verify if the new CMake set-up (ignoring the zstd aspect) works on my system.

ayzk commented

@Wout12345 Thank you for your feedback. The CMake bug is fixed. Now this project can be compiled without requiring users to configure zstd first. We will add explanations of the command-line interface later.
@disheng222 I removed the automake for now because it cannot compile successfully on my computer and the CMake approach is ready to use.

(Sorry for the late reply.)

@ayzk Thank you for your effort. Most of the errors are now fixed, but I still get the following error (with CMake versoin 3.10.2) when running cmake .. -DCMAKE_INSTALL_PREFIX:PATH=build:

-- 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
-- No build type was set. Setting build type to Release.
-- Performing Test HAVE_NO_OMIT_FRAME_POINTER
-- Performing Test HAVE_NO_OMIT_FRAME_POINTER - Success
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for one of the modules 'libzstd'
CMake Error at src/CMakeLists.txt:32 (install):
  install TARGETS given target "zstd" which does not exist in this directory.


-- Configuring incomplete, errors occurred!

Based on this post I found, it looks like the set-up might still rely on a CMake 3.13 feature. Maybe it works on your machine because you have already installed zstd on a system or user level, while I don't have it?

ayzk commented

@Wout12345 Yes, you are correct. I've updated the CMakeList.txt to require Cmake 3.13. The Github CI now runs successfully (https://github.com/szcompressor/SZauto/runs/2131104169?check_suite_focus=true).
Thank you very much.

@ayzk Thanks for the fix! Unfortunately I can't check if there are no more problems on my side now, since my CMake version is too low and I don't have the permissions to update it, however I may look more into this if/when there's a documented CLI.