安装Redis报错:undefined reference to `__sync_add_and_fetch_4'
来源:互联网 发布:双十一淘宝客服话术 编辑:程序博客网 时间:2024/05/30 04:32
在VMware的Linux系统上安装Redis
具体过程如下:
下载,解压和编译:
- $ wget http://redis.googlecode.com/files/redis-2.6.14.tar.gz
- $ tar xzf redis-2.6.14.tar.gz
- $ cd redis-2.6.14
- $ make
在执行make的时候报错,具体报错信息如下:
- zmalloc.o: In function `zmalloc_used_memory':
- /usr/local/redis-2.6.14/src/zmalloc.c:223: undefined reference to `__sync_add_and_fetch_4'
- collect2: ld returned 1 exit status
- make[1]: *** [redis-server] Error 1
- make[1]: Leaving directory `/usr/local/redis-2.6.14/src'
- make: *** [all] Error 2
在make操作的时候加一个执行参数:make CFLAGS="-march=i686"
然后就不报错了。
附:启动并运行Redis
编译的可执行文件在src目录中,使用以下命令运行Redis:
- [root@localhost redis-2.6.14]# src/redis-server
- [2918] 03 Jul 09:05:01.011 # Warning: no config file specified, using the default config. In order to specify a config file use src/redis-server /path/to/redis.conf
- [2918] 03 Jul 09:05:01.017 * Max number of open files set to 10032
- [2918] 03 Jul 09:05:01.024 # Warning: 32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit with 'noeviction' policy now.
- _._
- _.-``__ ''-._
- _.-`` `. `_. ''-._ Redis 2.6.14 (00000000/0) 32 bit
- .-`` .-```. ```\/ _.,_ ''-._
- ( ' , .-` | `, ) Running in stand alone mode
- |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
- | `-._ `._ / _.-' | PID: 2918
- `-._ `-._ `-./ _.-' _.-'
- |`-._`-._ `-.__.-' _.-'_.-'|
- | `-._`-._ _.-'_.-' | http://redis.io
- `-._ `-._`-.__.-'_.-' _.-'
- |`-._`-._ `-.__.-' _.-'_.-'|
- | `-._`-._ _.-'_.-' |
- `-._ `-._`-.__.-'_.-' _.-'
- `-._ `-.__.-' _.-'
- `-._ _.-'
- `-.__.-'
- [2918] 03 Jul 09:05:01.029 # Server started, Redis version 2.6.14
- [2918] 03 Jul 09:05:01.030 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
- [2918] 03 Jul 09:05:01.030 * The server is now ready to accept connections on port 6379
- [root@localhost redis-2.6.14]# src/redis-cli
- redis 127.0.0.1:6379> set name chenzhou
- OK
- redis 127.0.0.1:6379> get name
- "chenzhou"
- redis 127.0.0.1:6379>
这里只提供一种最简单的方式,最好的是通过编写开机启动脚本来做。
如果要开机启动redis,我们需要把redis设置为daemon后台启动(如果不设置为后台启动,则linux启动后图形界面会卡在一个空白的页面),而redis只有1个启动参数,就是redis的配置文件路径。redis的默认配置文件redis.conf位于redis的安装目录下。我们可以把该文件copy到/etc目录下
- [root@localhost redis-2.6.14]# cp redis.conf /etc/
修改完daemonize参数之后,redis就能够通过daemon方式启动了,那么下一步就是把redis加入到linux开机启动服务配置中了,具体步骤如下:
使用VI编辑器打开Linux开机启动服务配置文件/etc/rc.local,并在其中加入下面的一行代码:
- /usr/local/redis-2.6.14/src/redis-server /etc/redis.conf
停止Redis服务:
- src/redis-cli shutdown
0 0
- 执行安装redis报错undefined reference to `__sync_add_and_fetch_4\'
- 安装Redis报错:undefined reference to `__sync_add_and_fetch_4'
- 32位Linux编译redis失败解决方法:zmalloc.c:223: undefined reference to `__sync_add_and_fetch_4`
- mingw编译x264 出错undefined reference to `__sync_add_and_fetch_4
- 程序报错 undefined reference to `shm_open'
- AndroidStudio报错: undefined reference to 'AndroidBitmap_getInfo'
- 安装libvirt-snmp过程及报错undefined reference to `virDomainCreateWithFlags'
- Centos6.8安装ncrack 报错undefined reference to `clock_gettime解决方案
- bedtools软件安装报错:gzopen函数未定义(undefined reference to `gzopen64')
- QT报错:undefined reference to vtable for (class name)
- C++报错集合:undefined reference to `htonl@4'
- Ubuntu 编译报错 undefined reference to ’d2i_RSAPrivateKey‘
- apache 编译报错:undefined reference to `apr_array_clear'
- Qt编译报错 undefined reference to vtable for ...
- android ndk编译报错undefined reference to __gxx_personality_v0
- Linux 编译报错 undefined reference to `pthread_create'
- Makefile编写执行问题,报错undefined reference to `main'
- linux中 OpenGL 出现 undefined reference to `gluLookAt' 报错
- POJ 1862 Stripies(G++与C++的抉择)
- 现在市面上网络监控系统分析
- ASP.NET服务器端控件RadioButtonList,DropDownList,CheckBoxList的取值、赋值用法
- Java-JVM优化
- 定义数组时不小心内存溢出
- 安装Redis报错:undefined reference to `__sync_add_and_fetch_4'
- 页面获取地理位置经纬度
- Java之详解坦克大战游戏(三)
- POJ2395-Out of Hay
- 用mybatis实现模糊查询
- 【高精度算法】A/B 高精度除以低精度 保留小数
- PAT-B 1049. 数列的片段和
- 打开res 目录下raw和assets目录中数据库的方式和文本监听器的实现
- NYOJ236心急的c小加