安装redisbloom时通过make编译报错解决方法
1.首先将redisbloom克隆到本地电脑,代码实现如下:
git clone https://github.com/RedisLabsModules/redisbloom.git
备注:此时不报错则万事大吉,代码顺利被克隆下来;若是报错则看接下来的处理
2.若是报错如下:
fatal: unable to access 'https://github.com/RedisLabsModules/redisbloom.git/': gnutls_handshake() failed: Error in the pull function.
则可以将https改为 git解决,如下所示:
git clone https://github.com/RedisLabsModules/redisbloom.git
修改为:
git clone git://github.com/RedisLabsModules/redisbloom.git
执行成功:
hongrong@hongrong:~$ git clone git://github.com/RedisLabsModules/redisbloom.git
Cloning into 'redisbloom'...
remote: Enumerating objects: 2668, done.
remote: Counting objects: 100% (209/209), done.
remote: Compressing objects: 100% (144/144), done.
remote: Total 2668 (delta 94), reused 101 (delta 46), pack-reused 2459
Receiving objects: 100% (2668/2668), 793.04 KiB | 1.18 MiB/s, done.
Resolving deltas: 100% (1722/1722), done.
3.执行成功会生成一个redisbloom目录,切换到此目录下
hongrong@hongrong:~$ cd redisbloom/
接下来执行make,报错如下:
hongrong@hongrong:~/redisbloom$ make
cc -Wall -Wno-unused-function -g -ggdb -O2 -fPIC -std=gnu99 -D_GNU_SOURCE -I/home/hongrong/redisbloom/contrib -I/home/hongrong/redisbloom -I/home/hongrong/redisbloom/src -I/home/hongrong/redisbloom/deps/t-digest-c/src -c -o /home/hongrong/redisbloom/src/rebloom.o /home/hongrong/redisbloom/src/rebloom.c
make: cc: Command not found
<builtin>: recipe for target '/home/hongrong/redisbloom/src/rebloom.o' failed
make: *** [/home/hongrong/redisbloom/src/rebloom.o] Error 127
以上报错执行:sudo apt install gcc即可
sudo apt install gcc
4.redisbloom目录下继续执行make编译
报错如图:
5.根据以上报错执行git submodule sync
git submodule sync
接下来执行git submodule init
git submodule init
发现有报错:大概意思是说子模组未对该路径注册
hongrong@hongrong:~/redisbloom$ git submodule init
Submodule 'deps/readies' (https://github.com/RedisLabsModules/readies.git) registered for path 'deps/readies'
Submodule 'deps/t-digest-c' (https://github.com/RedisBloom/t-digest-c) registered for path 'deps/t-digest-c'
6.根据报错执行下sudo apt install update
依然还是报错:
hongrong@hongrong:~/redisbloom$ git submodule update
Cloning into '/home/hongrong/redisbloom/deps/readies'...
fatal: unable to access 'https://github.com/RedisLabsModules/readies.git/': gnutls_handshake() failed: Error in the pull function.
fatal: clone of 'https://github.com/RedisLabsModules/readies.git' into submodule path '/home/hongrong/redisbloom/deps/readies' failed
Failed to clone 'deps/readies'. Retry scheduled
Cloning into '/home/hongrong/redisbloom/deps/t-digest-c'...
fatal: unable to access 'https://github.com/RedisBloom/t-digest-c/': gnutls_handshake() failed: Error in the pull function.
fatal: clone of 'https://github.com/RedisBloom/t-digest-c' into submodule path '/home/hongrong/redisbloom/deps/t-digest-c' failed
Failed to clone 'deps/t-digest-c'. Retry scheduled
Cloning into '/home/hongrong/redisbloom/deps/readies'...
fatal: unable to access 'https://github.com/RedisLabsModules/readies.git/': gnutls_handshake() failed: The TLS connection was non-properly terminated.
fatal: clone of 'https://github.com/RedisLabsModules/readies.git' into submodule path '/home/hongrong/redisbloom/deps/readies' failed
Failed to clone 'deps/readies' a second time, aborting
7.执行下以下命令
sudo vim .gitmodules
如图:
将以上url 的https改为git并保存,修改完如下图:
接着再执行git submodule sync 同步下
git submodule sync
hongrong@hongrong:~/redisbloom$ git submodule sync
Synchronizing submodule url for 'deps/readies'
Synchronizing submodule url for 'deps/t-digest-c'
再执行git submodule init
git submodule init
接下来执行git submodule update
git submodule update
hongrong@hongrong:~/redisbloom$ git submodule update
Cloning into '/home/hongrong/redisbloom/deps/readies'...
Cloning into '/home/hongrong/redisbloom/deps/t-digest-c'...
Submodule path 'deps/readies': checked out '60652c75fdf0760c1c125760a6412fba51175740'
Submodule path 'deps/t-digest-c': checked out '265c005e2f2e6b389bdecb3633672bfb2add98f1'
8.此时再次执行make,出现以下报错
根据以上报错执行下sudo apt-get install cmake
9.再次执行make,依然报错
根据以上报错执行下终极命令:sudo apt-get install “build-essential”
sudo apt-get install "build-essential"
10.最后再执行下make即可成功编译
成功编译的显示界面如下:
此时在redisbloom目录下会生成一个redisbloom.so 文件,说明布隆过滤器安装成功