Could not find REDISPP using the following names: redis++
Closed this issue · 4 comments
Hi.
@sewenew do you have any tips to see roughly how to address this issue?
I have a app (redis_cache) which needs to use redis-plus-plus. I run the following code to install dependencies (Hiredis and redis-plus-plus) of redis_cache
# Install Hiredis
if ls ../build/install/lib/libhiredis.a 1>/dev/null 2>&1; then
echo "Redis-plus-plus has already been installed"
else
if [[ ! -d "./redis-plus-plus" ]]; then
git clone https://github.com/sewenew/redis-plus-plus.git redis-plus-plus --branch 1.3.2 --depth=1
echo "Redis-plus-plus downloaded"
fi
cd redis-plus-plus
mkdir compile
cd compile
BASE_DIR=$(pwd)
echo "Current Directory: $BASE_DIR"
UP_THREE_LEVELS=$(realpath "$BASE_DIR/../../../")
CMAKE_PREFIX_PATH="$UP_THREE_LEVELS/build/install"
echo "CMAKE_PREFIX_PATH: $CMAKE_PREFIX_PATH"
CMAKE_INSTALL_PREFIX="$UP_THREE_LEVELS/build/install"
echo "CMAKE_INSTALL_PREFIX: $CMAKE_INSTALL_PREFIX"
$CMAKE -DCMAKE_BUILD_TYPE=Release \
-DREDIS_PLUS_PLUS_BUILD_TEST=OFF \
-DREDIS_PLUS_PLUS_BUILD_SHARED=OFF \
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
-DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" \
-DCMAKE_CXX_STANDARD=17 \
-DREDIS_PLUS_PLUS_USE_TLS=ON ..
CC=gcc CXX=g++ make -j 4
CC=gcc CXX=g++ make install
cd ../../
echo "Finished installing Redis-plus-plus"
fi
cd ../
After Hiredis is installed, I got an error saying
In file included from /home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/connection.h:31,
from /home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/command.h:24,
from /home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/command.cpp:17:
/home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/tls/tls.h:23:10: fatal error: hiredis/hiredis_ssl.h: No such file or directory
23 | #include <hiredis/hiredis_ssl.h>
| ^~~~~~~~~~~~~~~~~~~~~~~
when running this command in the script above
$CMAKE -DCMAKE_BUILD_TYPE=Release \
-DREDIS_PLUS_PLUS_BUILD_TEST=OFF \
-DREDIS_PLUS_PLUS_BUILD_SHARED=OFF \
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
-DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" \
-DCMAKE_CXX_STANDARD=17 \
-DREDIS_PLUS_PLUS_USE_TLS=ON ..
I'm sure both files (hiredis.h and hiredis_ssl.h) are created as follows
ubuntu@master:~/redis_cache/build/install/include/hiredis$ ls -l /home/ubuntu/redis_cache/build/install/include/hiredis
total 60
drwx------ 2 ubuntu ubuntu 4096 Jul 2 05:07 adapters
-rw------- 1 ubuntu ubuntu 2982 Jul 2 05:05 alloc.h
-rw------- 1 ubuntu ubuntu 6027 Jul 2 05:05 async.h
-rw------- 1 ubuntu ubuntu 12747 Jul 2 05:05 hiredis.h
-rw------- 1 ubuntu ubuntu 4615 Jul 2 05:05 hiredis_ssl.h
-rw------- 1 ubuntu ubuntu 4918 Jul 2 05:05 read.h
-rw------- 1 ubuntu ubuntu 9213 Jul 2 05:05 sds.h
Looks like that you did not enable TLS support for hiredis, while you enabled it when building redis++.
Check the doc for detail.
Regards
I changed the dependencies build code like this, where USE_SSL=1 is used in Hiredis installation and
-DREDIS_PLUS_PLUS_USE_TLS=ON in Redis-plus-plus installation
if [[ ! -d "./third-party" ]]; then
mkdir ./third-party
fi
if [[ ! -d "./build/install" ]]; then
mkdir -p ./build/install
fi
cd ./third-party
CMAKE=$(which cmake)
# Install Hiredis
if ls ../build/install/lib/libhiredis.a 1>/dev/null 2>&1; then
echo "Hiredis has already been installed"
else
if [[ ! -d "./hiredis" ]]; then
git clone https://github.com/redis/hiredis.git hiredis --branch v1.0.2 --depth=1
echo "Hiredis downloaded"
fi
cd hiredis
LIBRARY_PATH=lib CC=gcc CXX=g++ make PREFIX="$(pwd)/../../build/install" USE_SSL=1 static -j 4
LIBRARY_PATH=lib CC=gcc CXX=g++ make PREFIX="$(pwd)/../../build/install" USE_SSL=1 install
cd ../
# delete shared libraries
rm ../build/install/lib/*.so
rm ../build/install/lib/*.dylib
echo "Finished installing Hiredis"
fi
#Install Redis-plus-plus
if ls ../build/install/lib/libredis++.a 1>/dev/null 2>&1; then
echo "Redis-plus-plus has already been installed"
else
if [[ ! -d "./redis-plus-plus" ]]; then
git clone https://github.com/sewenew/redis-plus-plus.git redis-plus-plus --branch 1.3.2 --depth=1
echo "Redis-plus-plus downloaded"
fi
cd redis-plus-plus
mkdir compile
cd compile
BASE_DIR=$(pwd)
echo "Current Directory: $BASE_DIR"
UP_THREE_LEVELS=$(realpath "$BASE_DIR/../../../")
CMAKE_PREFIX_PATH="$UP_THREE_LEVELS/build/install"
echo "CMAKE_PREFIX_PATH: $CMAKE_PREFIX_PATH"
CMAKE_INSTALL_PREFIX="$UP_THREE_LEVELS/build/install"
echo "CMAKE_INSTALL_PREFIX: $CMAKE_INSTALL_PREFIX"
# Check if the critical directories and files exist
if [[ -d "$CMAKE_PREFIX_PATH/include/hiredis" && -f "$CMAKE_PREFIX_PATH/include/hiredis/hiredis_ssl.h" ]]; then
echo "CMAKE_PREFIX_PATH is correct"
else
echo "Error: CMAKE_PREFIX_PATH is incorrect or necessary files are missing"
exit 1
fi
$CMAKE -DCMAKE_BUILD_TYPE=Release \
-DREDIS_PLUS_PLUS_BUILD_TEST=OFF \
-DREDIS_PLUS_PLUS_BUILD_SHARED=OFF \
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH/include" \
-DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" \
-DCMAKE_CXX_STANDARD=17 \
-DREDIS_PLUS_PLUS_USE_TLS=ON ..
CC=gcc CXX=g++ make -j 4
CC=gcc CXX=g++ make install
cd ../../
echo "Finished installing Redis-plus-plus"
fi
cd ../
I also add one more line in redis-plus-plus/CMakeLists.txt to indicate whether Hiredis package is found or not
However, the error remains the same as follows:
ubuntu@master:~/redis_cache/build$ cmake -DCMAKE_INSTALL_PREFIX:PATH=`pwd`/install ..
-- RapidJSON found. Headers: /usr/include
-- RapidJSON found. Headers: /usr/include
make: Nothing to be done for 'static'.
mkdir -p /home/ubuntu/redis_cache/third-party/hiredis/../../build/install/include/hiredis /home/ubuntu/redis_cache/third-party/hiredis/../../build/install/lib
cp -pPR hiredis_ssl.h /home/ubuntu/redis_cache/third-party/hiredis/../../build/install/include/hiredis
cp -pPR libhiredis_ssl.so /home/ubuntu/redis_cache/third-party/hiredis/../../build/install/lib/libhiredis_ssl.so.1.0.0
cd /home/ubuntu/redis_cache/third-party/hiredis/../../build/install/lib && ln -sf libhiredis_ssl.so.1.0.0 libhiredis_ssl.so
cp -pPR libhiredis_ssl.a /home/ubuntu/redis_cache/third-party/hiredis/../../build/install/lib
mkdir -p /home/ubuntu/redis_cache/third-party/hiredis/../../build/install/lib/pkgconfig
cp -pPR hiredis_ssl.pc /home/ubuntu/redis_cache/third-party/hiredis/../../build/install/lib/pkgconfig
mkdir -p /home/ubuntu/redis_cache/third-party/hiredis/../../build/install/include/hiredis /home/ubuntu/redis_cache/third-party/hiredis/../../build/install/include/hiredis/adapters /home/ubuntu/redis_cache/third-party/hiredis/../../build/install/lib
cp -pPR hiredis.h async.h read.h sds.h alloc.h /home/ubuntu/redis_cache/third-party/hiredis/../../build/install/include/hiredis
cp -pPR adapters/*.h /home/ubuntu/redis_cache/third-party/hiredis/../../build/install/include/hiredis/adapters
cp -pPR libhiredis.so /home/ubuntu/redis_cache/third-party/hiredis/../../build/install/lib/libhiredis.so.1.0.0
cd /home/ubuntu/redis_cache/third-party/hiredis/../../build/install/lib && ln -sf libhiredis.so.1.0.0 libhiredis.so
cp -pPR libhiredis.a /home/ubuntu/redis_cache/third-party/hiredis/../../build/install/lib
mkdir -p /home/ubuntu/redis_cache/third-party/hiredis/../../build/install/lib/pkgconfig
cp -pPR hiredis.pc /home/ubuntu/redis_cache/third-party/hiredis/../../build/install/lib/pkgconfig
rm: cannot remove '../build/install/lib/*.dylib': No such file or directory
Finished installing Hiredis
mkdir: cannot create directory ‘compile’: File exists
Current Directory: /home/ubuntu/redis_cache/third-party/redis-plus-plus/compile
CMAKE_PREFIX_PATH: /home/ubuntu/redis_cache/build/install
CMAKE_INSTALL_PREFIX: /home/ubuntu/redis_cache/build/install
CMAKE_PREFIX_PATH is correct
-- redis-plus-plus version: 1.3.1
-- redis-plus-plus build type: Release
-- redis-plus-plus build with CXX standard: c++17
-- redis-plus-plus TLS support: ON
package hiredis not found...
-- redis-plus-plus build static library: ON
-- redis-plus-plus build static library with position independent code: ON
-- redis-plus-plus build shared library: OFF
-- redis-plus-plus build test: OFF
-- Debian package name: .deb
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/redis_cache/third-party/redis-plus-plus/compile
Consolidate compiler generated dependencies of target redis++_static
[ 5%] Building CXX object CMakeFiles/redis++_static.dir/src/sw/redis++/command.cpp.o
[ 11%] Building CXX object CMakeFiles/redis++_static.dir/src/sw/redis++/connection_pool.cpp.o
[ 17%] Building CXX object CMakeFiles/redis++_static.dir/src/sw/redis++/connection.cpp.o
[ 23%] Building CXX object CMakeFiles/redis++_static.dir/src/sw/redis++/pipeline.cpp.o
In file included from /home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/connection.h:31,
from /home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/pipeline.h:22,
from /home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/pipeline.cpp:17:
/home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/tls/tls.h:23:10: fatal error: hiredis/hiredis_ssl.h: No such file or directory
23 | #include <hiredis/hiredis_ssl.h>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from /home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/connection.h:31,
from /home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/connection.cpp:17:
/home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/tls/tls.h:23:10: fatal error: hiredis/hiredis_ssl.h: No such file or directory
23 | #include <hiredis/hiredis_ssl.h>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/redis++_static.dir/build.make:160: CMakeFiles/redis++_static.dir/src/sw/redis++/pipeline.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/connection.h:31,
from /home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/command.h:24,
from /home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/command.cpp:17:
/home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/tls/tls.h:23:10: fatal error: hiredis/hiredis_ssl.h: No such file or directory
23 | #include <hiredis/hiredis_ssl.h>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/redis++_static.dir/build.make:104: CMakeFiles/redis++_static.dir/src/sw/redis++/connection.cpp.o] Error 1
make[2]: *** [CMakeFiles/redis++_static.dir/build.make:76: CMakeFiles/redis++_static.dir/src/sw/redis++/command.cpp.o] Error 1
In file included from /home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/connection.h:31,
from /home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/connection_pool.h:26,
from /home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/connection_pool.cpp:17:
/home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/tls/tls.h:23:10: fatal error: hiredis/hiredis_ssl.h: No such file or directory
23 | #include <hiredis/hiredis_ssl.h>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/redis++_static.dir/build.make:118: CMakeFiles/redis++_static.dir/src/sw/redis++/connection_pool.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/redis++_static.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
[ 5%] Building CXX object CMakeFiles/redis++_static.dir/src/sw/redis++/command.cpp.o
In file included from /home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/connection.h:31,
from /home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/command.h:24,
from /home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/command.cpp:17:
/home/ubuntu/redis_cache/third-party/redis-plus-plus/src/sw/redis++/tls/tls.h:23:10: fatal error: hiredis/hiredis_ssl.h: No such file or directory
23 | #include <hiredis/hiredis_ssl.h>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/redis++_static.dir/build.make:76: CMakeFiles/redis++_static.dir/src/sw/redis++/command.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/redis++_static.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
Finished installing Redis-plus-plus
CMake Error at CMakeLists.txt:76 (find_library):
Could not find REDISPP using the following names: redis++
-- Configuring incomplete, errors occurred!
See also "/home/ubuntu/redis_cache/CMakeFiles/CMakeOutput.log".
ubuntu@master:~/redis_cache/build$
Here are the hiredis file locations:
ubuntu@master:~/redis_cache$ ls -l /home/ubuntu/redis_cache/build/install/include
total 4
drwx------ 3 ubuntu ubuntu 4096 Jul 2 15:05 hiredis
ubuntu@master:~/redis_cache$ ls -l /home/ubuntu/redis_cache/build/install/include/hiredis/
total 60
drwx------ 2 ubuntu ubuntu 4096 Jul 2 15:05 adapters
-rw------- 1 ubuntu ubuntu 2982 Jul 2 05:05 alloc.h
-rw------- 1 ubuntu ubuntu 6027 Jul 2 05:05 async.h
-rw------- 1 ubuntu ubuntu 12747 Jul 2 05:05 hiredis.h
-rw------- 1 ubuntu ubuntu 4615 Jul 2 05:05 hiredis_ssl.h
-rw------- 1 ubuntu ubuntu 4918 Jul 2 05:05 read.h
-rw------- 1 ubuntu ubuntu 9213 Jul 2 05:05 sds.h
ubuntu@master:~/redis_cache$
@sewenew I used debug mode and found out that this line find_package(hiredis QUIET)
in CMakeList.txt of redis-plus-plus cannot find the package in
/home/ubuntu/redis_cache/build/install/hiredisConfig.cmake
and
/home/ubuntu/redis_cache/build/install/hiredis-config.cmake
But the files of following functions are all found
find_path(HIREDIS_HEADER hiredis)
--> /user/include
find_library(HIREDIS_LIB hiredis)
--> /usr/lib/x86_64-linux-gnu/libhiredis.so
find_library(HIREDIS_TLS_LIB hiredis_ssl)
--> /home/ubuntu/redis_cache/build/install/lib/libhiredis_ssl.a
and these functions are all checked in the following code section in CMakeList.txt of redis-plus-plus
Is it going to be an issue?
I figure out what's wrong. I installed hiredis twice by accident and it generate the header files under /usr/include/hiredis where CMakelist.txt of redis-plus-plus would find and use.
After removing the system installation package, the issue is gone.