Nordix / hiredis-cluster

C client library for Valkey/Redis Cluster. This project is used and sponsored by Ericsson. It is a fork of the now unmaintained hiredis-vip.
BSD 3-Clause "New" or "Revised" License
87 stars 42 forks source link

Error on building library from source code #121

Closed y291arh closed 1 year ago

y291arh commented 1 year ago

cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_SSL=OFF ..

-- The C compiler identification is GNU 9.4.0 -- The CXX compiler identification is GNU 9.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 Detected version: 0.8.1 Downloading dependency 'hiredis'.. Scanning dependencies of target hiredis-populate [ 11%] Creating directories for 'hiredis-populate' [ 22%] Performing download step (git clone) for 'hiredis-populate' Cloning into 'hiredis'... Note: switching to 'v1.1.0'.

You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example:

git switch -c

Or undo this operation with:

git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at c14775b Prepare for v1.1.0 GA [ 33%] No patch step for 'hiredis-populate' [ 44%] Performing update step for 'hiredis-populate' fatal: invalid upstream 'origin/v1.1.0' fatal: No rebase in progress? CMake Error at /root/hiredis-cluster/build/_deps/hiredis-subbuild/hiredis-populate-prefix/tmp/hiredis-populate-gitupdate.cmake:102 (message):

Failed to rebase in: '/root/hiredis-cluster/build/_deps/hiredis/'.

You will have to resolve the conflicts manually

make[2]: [CMakeFiles/hiredis-populate.dir/build.make:97: hiredis-populate-prefix/src/hiredis-populate-stamp/hiredis-populate-update] Error 1 make[1]: [CMakeFiles/Makefile2:76: CMakeFiles/hiredis-populate.dir/all] Error 2 make: *** [Makefile:84: all] Error 2

CMake Error at /usr/share/cmake-3.16/Modules/FetchContent.cmake:915 (message): Build step for hiredis failed: 2 Call Stack (most recent call first): /usr/share/cmake-3.16/Modules/FetchContent.cmake:1006 (__FetchContent_directPopulate) CMakeLists.txt:91 (FetchContent_Populate)

-- Configuring incomplete, errors occurred! See also "/root/hiredis-cluster/build/CMakeFiles/CMakeOutput.log".

Does anybody know, why I'm having this dependancy problem while trying to compile library from a source?

bjosv commented 1 year ago

This is probably an issue with the version of CMake. CMake ~< v1.20~ < v3.20 seems to have problems with its FetchContent functionality and how hiredis config is setup. The advice is to upgrade CMake or install hiredis manually, and we will add some block/warning text to our CMakeLists.txt

y291arh commented 1 year ago

This is probably an issue with the version of CMake. CMake < v1.20 seems to have problems with its FetchContent functionality and how hiredis config is setup. The advice is to upgrade CMake or install hiredis manually, and we will add some block/warning text to our CMakeLists.txt

I've got Ubuntu 20.04.5 with latest cmake installed

dpkg -l | grep cmake

ii cmake 3.16.3-1ubuntu1.20.04.1 amd64 cross-platform, open-source make system ii cmake-data 3.16.3-1ubuntu1.20.04.1 all CMake data files (modules, templates and documentation)

Hiredis is also installed manually

dpkg -l | grep hiredis

ii libhiredis-dev:amd64 0.14.0-6 amd64 minimalistic C client library for Redis (development files) ii libhiredis0.14:amd64 0.14.0-6 amd64 minimalistic C client library for Redis But hiredis-cluster does fetch it's source code automatically and tries to compile it.

bjosv commented 1 year ago

Sorry, I gave the wrong version. A fix for this came into CMake v3.20.

bjosv commented 1 year ago

You can skip the automatically download with cmake -DDOWNLOAD_HIREDIS=OFF .. but then a recent hiredis needs to be found.

y291arh commented 1 year ago

Sorry, I gave the wrong version. A fix for this came into CMake v3.20.

Thank you! It works now! One more question: How to compile library without debug information, what should I put instead: -DCMAKE_BUILD_TYPE=RelWithDebInfo ?

y291arh commented 1 year ago

The answer is: -DCMAKE_BUILD_TYPE=Release Thanks!