redis: undefined reference to `log‘

user1@raspberrypi:~/Public/redis-2.0.4-stable $ cc -o redis-server -lm -lpthread -g adlist.o ae.o anet.o dict.o redis.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o

/usr/bin/ld: redis.o: in function `computeObjectSwappability':

/home/user1/Public/redis-2.0.4-stable/redis.c:9293:(.text+0x199b8): undefined reference to `log'

collect2: error: ld returned 1 exit status

math库链接上了 -lm 但是还是报错 找不到log自然对数(Natural logarithm)函数

修改Makefile 把*.o 移动到 链接参数前面

redis-server: $(OBJ)

(CC) -o (PRGNAME) (CCOPT) (DEBUG) $(OBJ)

redis-server: $(OBJ)

(CC) -o (PRGNAME) (OBJ) (DEBUG) $(CCOPT)

$ make

...

cc -o redis-server adlist.o ae.o anet.o dict.o redis.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o -g -lpthread -lm

$ ./redis-server

9056\] 10 Dec 09:52:13 # Warning: no config file specified, using the default config. In order to specify a config file use 'redis-server /path/to/redis.conf' \[9056\] 10 Dec 09:52:13 \* Server started, Redis version 2.0.4 \[9056\] 10 Dec 09:52:13 # 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. \[9056\] 10 Dec 09:52:13 \* The server is now ready to accept connections on port 6379 \[9056\] 10 Dec 09:52:13 - 0 clients connected (0 slaves), 821832 bytes in use \[9056\] 10 Dec 09:52:18 - 0 clients connected (0 slaves), 821832 bytes in use 代码下载链接 ```bash ed2k://|file|redis-2.0.4-stable.zip|485917|24CEAB4671C984F169A2160AEFE55154|h=I5RAFGIKIEECN37FZNHN2JSVZFNVAEC3|/ ``` 相关书籍 ed2k://\|file\|Levine%20-%20Linkers%20and%20Loaders%20\[compilers,%20ELF\]%20(Morgan,%202000).djvu\|2265728\|D17EFC39F27205933AE9571E8F7EE617\|h=HIPA4QMJZK7KGNCAFZCKJISCWZODIEHK\|/ ed2k://\|file\|Levine,%20Linkers%20And%20Loaders%20(Morgan%20Kaufmann,%202000).pdf\|18883469\|9E934E3F78C2BABD586670F3815A1166\|h=EP6AOLUQYOADRAGS2M7OV4Y7KS6SKAS2\|/

相关推荐
知我Deja_Vu4 天前
redisCommonHelper.generateCode(“GROUP“),Redis 生成码方法
数据库·redis·缓存
Charlie_lll4 天前
Redis脑裂问题处理——基于min-replicas-to-write配置
redis·后端
奇点爆破XC4 天前
Redis迁移
数据库·redis·bootstrap
断手当码农4 天前
Redis 实现分布式锁的三种方式
数据库·redis·分布式
菜鸟小九4 天前
redis原理篇(基本数据结构)
数据结构·数据库·redis
没有bug.的程序员4 天前
电商秒杀系统深度进阶:高并发流量建模、库存零超卖内核与 Redis+MQ 闭环
数据库·redis·缓存·高并发·电商秒杀·流量建模·库存零超卖
菜鸟小九4 天前
redis原理篇(五种数据结构)
数据结构·数据库·redis
初次攀爬者4 天前
Redis分布式锁实现的三种方式-基于setnx,lua脚本和Redisson
redis·分布式·后端
June`4 天前
Redis缓存深度解析:20%数据应对80%请求
数据库·redis
m0_738120725 天前
应急响应——Solar月赛emergency靶场溯源过程(内含靶机下载以及流量分析)
java·开发语言·网络·redis·web安全·系统安全