1. 解压redis后,第一次make出现报错:

[root@localhost redis-3.2.5]# make cd src && make all
make[1]: Entering directory `/data/redis/redis-3.2.5/src'
rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-rdb redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html
(cd ../deps && make distclean)
make[2]: Entering directory `/data/redis/redis-3.2.5/deps'
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd geohash-int && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
make[2]: Leaving directory `/data/redis/redis-3.2.5/deps'
(rm -f .make-*)
echo STD=-std=c99 -pedantic -DREDIS_STATIC='' >> .make-settings
echo WARN=-Wall -W >> .make-settings
echo OPT=-O2 >> .make-settings
echo MALLOC=jemalloc >> .make-settings
echo CFLAGS= >> .make-settings
echo LDFLAGS= >> .make-settings
echo REDIS_CFLAGS= >> .make-settings
echo REDIS_LDFLAGS= >> .make-settings
echo PREV_FINAL_CFLAGS=-std=c99 -pedantic -DREDIS_STATIC='' -Wall -W -O2 -g -ggdb -I../deps/geohash-int -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -DUSE_JEMALLOC -I../deps/jemalloc/include >> .make-settings
echo PREV_FINAL_LDFLAGS= -g -ggdb -rdynamic >> .make-settings
(cd ../deps && make hiredis linenoise lua geohash-int jemalloc)
make[2]: Entering directory `/data/redis/redis-3.2.5/deps'
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd geohash-int && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
(echo "" > .make-cflags)
(echo "" > .make-ldflags)
MAKE hiredis
cd hiredis && make static
make[3]: Entering directory `/data/redis/redis-3.2.5/deps/hiredis'
gcc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb net.c
make[3]: gcc: Command not found
make[3]: *** [net.o] Error 127
make[3]: Leaving directory `/data/redis/redis-3.2.5/deps/hiredis'
make[2]: *** [hiredis] Error 2
make[2]: Leaving directory `/data/redis/redis-3.2.5/deps'
make[1]: [persist-settings] Error 2 (ignored)
CC adlist.o
/bin/sh: cc: command not found                     这行报错说明你没有安装gcc
make[1]: *** [adlist.o] Error 127
make[1]: Leaving directory `/data/redis/redis-3.2.5/src'
make: *** [all] Error 2

  1. 安装gcc后,继续make出现如下报错:

[root@localhost redis-3.2.5]# make
cd src && make all
make[1]: Entering directory `/data/redis/redis-3.2.5/src'
CC adlist.o
In file included from adlist.c:34:0:
zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory
#include <jemalloc/jemalloc.h>
^
compilation terminated.
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory `/data/redis/redis-3.2.5/src'
make: *** [all] Error 2

解决方法:

第一种:执行 make MALLOC=libc 命令 ,如果执行后报错 或 还有其他错误,建议删除redis所有文件重新解压编译尝试

原因:由于系统没有jemalloc 而只有 libc ,但是默认回去找jemalloc,导致了 make 出错。 所以加参:make MALLOC=libc

第二种:make CFLAGS="-march=x86-64"

在README 有这个一段话。

Allocator  
---------  
 
Selecting a non-default memory allocator when building Redis is done by setting  
the `MALLOC` environment variable. Redis is compiled and linked against libc  
malloc by default, with the exception of jemalloc being the default on Linux  
systems. This default was picked because jemalloc has proven to have fewer  
fragmentation problems than libc malloc.  
 
To force compiling against libc malloc, use:  
 
    % make MALLOC=libc  
 
To compile against jemalloc on Mac OS X systems, use:  
 
    % make MALLOC=jemalloc

在构建Redis时,通过设置来选择非默认的内存分配器

MALLOC的环境变量。Redis被编译并链接到libc

malloc是默认的,jemalloc是Linux上的默认值。之所以选择这个默认值,是由于事实证明jemalloc的内存更少,碎片化问题比libc malloc严重。

现在由于没有jemalloc 而只有 libc ,但是默认回去找jemalloc,导致了 make 出错。 所以加这么一个参数。

要强制编译libc malloc,请使用:

% MALLOC = libc

要在Mac OS X系统上编译jemalloc,请使用:

% MALLOC = jemalloc

redis make报错的更多相关文章

  1. REDIS持久化报错失败

    redis log报错: [7666] 15 Jan 00:22:36.028 # Error moving temp DB file on the final destination: Invali ...

  2. SpringBoot- springboot集成Redis出现报错:No qualifying bean of type 'org.springframework.data.redis.connection.RedisConnectionFactory'

    Springboot将accessToke写入Redisk 缓存,springboot集成Redis出现报错 No qualifying bean of type 'org.springframewo ...

  3. redis编译报错总结

    redis编译报错总结: 1.不能编译没有GCC 编译工具安装报错:问题1:make时可能会报如下错误cc -c -std=c99 -pedantic -O2 -Wall -W   -g -rdyna ...

  4. redis启动报错:Fatal error loading the DB: Invalid argument

    redis启动报错 add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be ...

  5. .Net Core redis 调用报错 '6000 Redis requests per hour' 解决 6000 此调用限制

    问题描述 redis 是一种基于内存,性能高效的 NoSQL 数据库,性能高主要就体现在数据交互耗时较短,能够段时快速的对用户的请求做出反应,所以在业务比较复杂或交互量需求大时,必然会超过 6000次 ...

  6. Ubuntu 14.04下Redis安装报错:“You need tcl 8.5 or newer in order to run the Redis test”问题解决

    Redis简介: Redis是一个开源的使用ANSI C语言编写.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言的API.从2010年3月15日起,Redis的开发工 ...

  7. 非root用户启动redis容器报错mkdir: cannot create directory '/bitnami/redis': Permission denied

    问题:使用docker启动容器时,报错如下 zh@debian:~/testPath$ docker-compose up redis Starting testpath_redis_1 ... do ...

  8. linux下安装redis组件报错-gcc报错

    报错如图: 1.解决办法    先安装gcc插件.删除redis解压后文件.重新解压

  9. Windows 7 上面 redis 启动报错的处理

    Windows 7或者是 win10 上面 安装redis 的windows 3.2.100 的版本 启动报错: Creating Server TCP listening socket *:: li ...

  10. 机器装多个版本php,并安装redis插件报错【已解决】

    机器原版本php5.5.3 适应新的框架安装了7.1.12 期间遇到的小问题就是安装 redis插件的时候,总报错,报错如下: Starting php-fpm [02-Jan-2019 10:15: ...

随机推荐

  1. JS 操作 HTML 和 AJAX 请求后台数据

    为某个元素插入值,添加属性,添加子元素 <div class="col-sm-6"> <select class="form-control" ...

  2. Azure Java Libraries 入门

    本指南演示了以下 Azure Java Libraries 的用法,包括设置认证.创建并使用 Azure 存储.创建并使用 Azure SQL 数据库.部署虚拟机.从 GitHub 部署 Azure ...

  3. Excel的Sheet页复制

    最近在做一个项目,其中涉及基于模板对Excel的Sheet页进行复制.在网上尝试了很多,发现都不够完美,苦恼. 然后在查阅资料的过程中,发现有一篇提及,POI的API只对同一个Excel文件中的She ...

  4. DOM Tree

    DOM Tree   什么是DOM树:网页的所有内容在内存当中,其实是以树形结构存储的 何时创建:当浏览器,读取html中内容的时候,会马上开始创建DOM树. 如何创建: 1.读到HTML的时候还没有 ...

  5. js权威指南学习笔记(四)对象

    1.创建对象 (1).通过对象直接量的方式创建 说明:对象直接量是由若干名/值对组成的映射表,名/值对中间用冒号分隔,名/值对之间用逗号分隔,整个映射表用花括号括起来. 如:       5 5   ...

  6. 云栖神侠传—阿里云数据库专家德歌告诉你PostgreSQL的那些事

    什么是云栖神侠传: 云栖社区(http://yq.aliyun.com/?utm_source=yqdg),是阿里云面向开发者群体的开放型社区.在云栖社区中,活跃着许多阿里技术大牛,他们在自己的技术领 ...

  7. Android sqlite日期存储

    SQLite日期类型是以TEXT.REAL和INTEGER类型分别不同的格式表示的,对应如下:TEXT: "YYYY-MM-DD HH:MM:SS.SSS"REAL: 以Julia ...

  8. IE的兼容性设置 X-UA-Compatible

    < meta http-equiv = "X-UA-Compatible" content = "IE=edge,chrome=1" /> 是IE8 ...

  9. arm汇编学习(六)---跳转到thumb状态

    通常函数返回使用 pop {r7,pc}或bx lr等方式(bx,b类似jmp为跳转指令,但bx可以指定跳转区域究竟为thumb还是arm指令.thumb指令指令的时候,直接填写该地址却总是产生SIG ...

  10. WPF控件相对位置解析

    WPF控件相对位置的获取方法是比较简单的.对于初学者来说,掌握这一技巧的应用,可以帮助以后对WPF的深入学习,而且在实际使用中,这是一个非常常用的方法. 我们知道WPF有着比较灵活的布局方式,关于某个 ...