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\|/

相关推荐
不想写bug呀11 小时前
Redis主从复制介绍
数据库·redis
XT462512 小时前
交易、订单轮询策略(能用数据库轮询解决的不用Redis,能用Redis解决的不用消息队列)
数据库·redis·bootstrap
梦茹^_^14 小时前
flask框架(笔记一次性写完)
redis·python·flask·cookie·session
panzer_maus15 小时前
Redis简单介绍(3)-持久化的实现
java·redis·mybatis
wWYy.15 小时前
详解redis(1)
数据库·redis·缓存
麦兜*16 小时前
SpringBoot集成Redis缓存,提升接口性能的五大实战策略
spring boot·redis·缓存
晓131316 小时前
第一章:Redis 安装与入门
redis·json·nosql
晓131319 小时前
第二章:Redis常见命令与Java客户端
java·数据库·redis
填满你的记忆19 小时前
【从零开始——Redis 进化日志|Day7】双写一致性难题:数据库与缓存如何不再“打架”?(附 Canal/读写锁实战)
java·数据库·redis·缓存·面试
小冷coding20 小时前
【Java】以 Java + Redis + MySQL 为技术栈,模拟电商商品详情的读写场景,Cache Aside+ 延迟双删 方案
java·redis·mysql