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

相关推荐
予枫的编程笔记5 小时前
Redis 核心数据结构深度解密:从基础命令到源码架构
java·数据结构·数据库·redis·缓存·架构
CodeAmaz6 小时前
一致性哈希与Redis哈希槽详解
redis·算法·哈希算法
一条大祥脚8 小时前
25.12.30
数据库·redis·缓存
程可爱9 小时前
详解Redis消息队列的三种实现方案
redis
源代码•宸12 小时前
goframe框架签到系统项目开发(每日签到添加积分和积分记录、获取当月最大连续签到天数、发放连续签到奖励积分、实现签到日历详情接口)
数据库·经验分享·redis·中间件·golang·dao·goframe
斯普信云原生组12 小时前
Linux 平台 Redis Insight 安装卸载与常见问题
linux·运维·redis
小画家~12 小时前
第四十三:redis 查找所有KEY应用方法
数据库·redis·bootstrap
攻心的子乐12 小时前
redis 使用Pipelined 管道命令批量操作 减少网络操作次数
数据库·redis·缓存
蜂蜜黄油呀土豆17 小时前
Redis 数据结构详解:从底层实现到应用场景
数据结构·redis·跳表·zset
a努力。17 小时前
哈罗骑行Java面试被问:Redis的持久化策略对比
java·redis·面试