Skip to content

Commit

Permalink
cmake lz4: fix wrong CMake target name (groonga#1850)
Browse files Browse the repository at this point in the history
This patch will fix build error on Arch Linux by adding the fix that was
missing at groonga#1832 .

Arch Linux provides only `LZ4::lz4_shared`. `LZ4::lz4_static` isn't
provided. We always use `LZ4::lz4_static` because of the wrong target
name (`LZ4::liblz4_shared`). But Arch Linux doesn't provide
`LZ4::lz4_static`. So it causes the following build error.

### error log:
```
$ cmake -S . -B ../groonga.doc --preset=doc
Preset CMake variables:

  CMAKE_BUILD_TYPE="Debug"
  CMAKE_EXPORT_COMPILE_COMMANDS="ON"
  GRN_WITH_APACHE_ARROW="ON"
  GRN_WITH_BLOSC="auto"
  GRN_WITH_DOC="ON"
  GRN_WITH_MRUBY="ON"

-- CMake: 3.30.1
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- Use ccache for compiling C: /usr/bin/ccache
-- Use ccache for compiling C++: /usr/bin/ccache
-- AVX flags: -mavx
-- AVX2 flags: -mavx2
-- AVX512 flags:  -mavx512f -mavx512fp16 -mavx512cd -mavx512dq -mavx512vnni -mavx512vpopcntdq
-- Arrow version: 16.1.0
-- Found the Arrow shared library: /usr/lib/libarrow.so.1601.0.0
-- Found the Arrow import library: ARROW_IMPORT_LIB-NOTFOUND
-- Found the Arrow static library:
-- Zstandard: system
-- RapidJSON found. Headers: /usr/include
-- RapidJSON: system
-- MeCab: /usr/lib/libmecab.so
-- Checking for module 'kytea'
--   Package 'kytea', required by 'virtual:world', not found
CMake Warning at cmake/FindGroongamsgpackc.cmake:30 (find_package):
  By not providing "Findmsgpack-c.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "msgpack-c", but CMake did not find one.

  Could not find a package configuration file provided by "msgpack-c" with
  any of the following names:

    msgpack-cConfig.cmake
    msgpack-c-config.cmake

  Add the installation prefix of "msgpack-c" to CMAKE_PREFIX_PATH or set
  "msgpack-c_DIR" to a directory containing one of the above files.  If
  "msgpack-c" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:895 (find_package)


CMake Warning at cmake/FindGroongaxxHash.cmake:29 (find_package):
  By not providing "FindxxHash.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "xxHash", but
  CMake did not find one.

  Could not find a package configuration file provided by "xxHash" (requested
  version 0.8.0) with any of the following names:

    xxHashConfig.cmake
    xxhash-config.cmake

  Add the installation prefix of "xxHash" to CMAKE_PREFIX_PATH or set
  "xxHash_DIR" to a directory containing one of the above files.  If "xxHash"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  CMakeLists.txt:940 (find_package)


CMake Warning at CMakeLists.txt:1102 (find_package):
  By not providing "FindBlosc2.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Blosc2", but
  CMake did not find one.

  Could not find a package configuration file provided by "Blosc2" (requested
  version 2.10.0) with any of the following names:

    Blosc2Config.cmake
    blosc2-config.cmake

  Add the installation prefix of "Blosc2" to CMAKE_PREFIX_PATH or set
  "Blosc2_DIR" to a directory containing one of the above files.  If "Blosc2"
  provides a separate development package or SDK, be sure it has been
  installed.


Configuring for Blosc version: 2.13.2
-- Found LZ4 library: $<TARGET_PROPERTY:LZ4::lz4_static,INTERFACE_LINK_LIBRARIES>
-- Could NOT find ZLIB_NG (missing: ZLIB_NG_LIBRARY ZLIB_NG_INCLUDE_DIR)
-- Found ZSTD library: $<TARGET_PROPERTY:zstd::libzstd_shared,INTERFACE_LINK_LIBRARIES>
-- Building for system processor x86_64
-- Building for compiler ID GNU
-- Detected that BLOSC is used a subproject.
-- Adding run-time support for SSE2
-- Adding run-time support for AVX2
-- Adding run-time support for AVX512
-- Blosc: bundled
CMake Warning at CMakeLists.txt:1210 (find_package):
  By not providing "Findxsimd.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "xsimd", but
  CMake did not find one.

  Could not find a package configuration file provided by "xsimd" with any of
  the following names:

    xsimdConfig.cmake
    xsimd-config.cmake

  Add the installation prefix of "xsimd" to CMAKE_PREFIX_PATH or set
  "xsimd_DIR" to a directory containing one of the above files.  If "xsimd"
  provides a separate development package or SDK, be sure it has been
  installed.


-- xsimd v12.1.1
-- xsimd: bundled
CMake Warning at CMakeLists.txt:1318 (find_package):
  By not providing "Findh3.cmake" in CMAKE_MODULE_PATH this project has asked
  CMake to find a package configuration file provided by "h3", but CMake did
  not find one.

  Could not find a package configuration file provided by "h3" with any of
  the following names:

    h3Config.cmake
    h3-config.cmake

  Add the installation prefix of "h3" to CMAKE_PREFIX_PATH or set "h3_DIR" to
  a directory containing one of the above files.  If "h3" provides a separate
  development package or SDK, be sure it has been installed.


-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- H3: bundled
-- Configuring done (0.4s)
CMake Error at /home/watson/src/groonga.doc/_deps/blosc-src/blosc/CMakeLists.txt:422 (target_link_libraries):
  Error evaluating generator expression:

    $<TARGET_PROPERTY:LZ4::lz4_static,INTERFACE_LINK_LIBRARIES>

  Target "LZ4::lz4_static" not found.


CMake Error at /home/watson/src/groonga.doc/_deps/blosc-src/blosc/CMakeLists.txt:422 (target_link_libraries):
  Error evaluating generator expression:

    $<TARGET_PROPERTY:LZ4::lz4_static,INTERFACE_LINK_LIBRARIES>

  Target "LZ4::lz4_static" not found.


CMake Error at /home/watson/src/groonga.doc/_deps/blosc-src/blosc/CMakeLists.txt:422 (target_link_libraries):
  Error evaluating generator expression:

    $<TARGET_PROPERTY:LZ4::lz4_static,INTERFACE_LINK_LIBRARIES>

  Target "LZ4::lz4_static" not found.


CMake Error at /home/watson/src/groonga.doc/_deps/blosc-src/blosc/CMakeLists.txt:422 (target_link_libraries):
  Error evaluating generator expression:

    $<TARGET_PROPERTY:LZ4::lz4_static,INTERFACE_LINK_LIBRARIES>

  Target "LZ4::lz4_static" not found.


CMake Error at /home/watson/src/groonga.doc/_deps/blosc-src/blosc/CMakeLists.txt:422 (target_link_libraries):
  Error evaluating generator expression:

    $<TARGET_PROPERTY:LZ4::lz4_static,INTERFACE_LINK_LIBRARIES>

  Target "LZ4::lz4_static" not found.


CMake Error at /home/watson/src/groonga.doc/_deps/blosc-src/blosc/CMakeLists.txt:422 (target_link_libraries):
  Error evaluating generator expression:

    $<TARGET_PROPERTY:LZ4::lz4_static,INTERFACE_LINK_LIBRARIES>

  Target "LZ4::lz4_static" not found.


CMake Error at /home/watson/src/groonga.doc/_deps/blosc-src/blosc/CMakeLists.txt:422 (target_link_libraries):
  Error evaluating generator expression:

    $<TARGET_PROPERTY:LZ4::lz4_static,INTERFACE_LINK_LIBRARIES>

  Target "LZ4::lz4_static" not found.


CMake Error at /home/watson/src/groonga.doc/_deps/blosc-src/blosc/CMakeLists.txt:422 (target_link_libraries):
  Error evaluating generator expression:

    $<TARGET_PROPERTY:LZ4::lz4_static,INTERFACE_LINK_LIBRARIES>

  Target "LZ4::lz4_static" not found.


CMake Error at /home/watson/src/groonga.doc/_deps/blosc-src/blosc/CMakeLists.txt:422 (target_link_libraries):
  Error evaluating generator expression:

    $<TARGET_PROPERTY:LZ4::lz4_static,INTERFACE_LINK_LIBRARIES>

  Target "LZ4::lz4_static" not found.


CMake Error at /home/watson/src/groonga.doc/_deps/blosc-src/blosc/CMakeLists.txt:87 (target_include_directories):
  Error evaluating generator expression:

    $<TARGET_PROPERTY:LZ4::lz4_static,INTERFACE_INCLUDE_DIRECTORIES>

  Target "LZ4::lz4_static" not found.


CMake Error at lib/CMakeLists.txt:148 (target_link_libraries):
  Error evaluating generator expression:

    $<TARGET_PROPERTY:LZ4::lz4_static,INTERFACE_INCLUDE_DIRECTORIES>

  Target "LZ4::lz4_static" not found.


CMake Error at lib/CMakeLists.txt:148 (target_link_libraries):
  Error evaluating generator expression:

    $<TARGET_PROPERTY:LZ4::lz4_static,INTERFACE_INCLUDE_DIRECTORIES>

  Target "LZ4::lz4_static" not found.


CMake Error at CMakeLists.txt:996 (target_link_libraries):
  The link interface of target "grn_dependencies" contains:

    LZ4::lz4_static

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.



-- Generating done (0.2s)
CMake Generate step failed.  Build files cannot be regenerated correctly.
```
  • Loading branch information
Watson1978 authored Aug 2, 2024
1 parent 9fc86dd commit 89e46ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmake/FindGroongalz4.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ endif()
find_package(lz4 ${find_package_args})
set(Groongalz4_FOUND ${lz4_FOUND})
if(Groongalz4_FOUND)
if(TARGET LZ4::liblz4_shared)
if(TARGET LZ4::lz4_shared)
set(GRN_LZ4_TARGET LZ4::lz4_shared)
else()
set(GRN_LZ4_TARGET LZ4::lz4_static)
Expand Down

0 comments on commit 89e46ff

Please sign in to comment.