今天安装Redis6.2版本的时候,执行MAKE命令总是失败,报错如下:
alloc.c:33:10: fatal error: 'string.h' file not found
#include <string.h> ^~~~~~~~~~
1 error generated.
make[3]: *** [alloc.o] Error 1
make[2]: *** [hiredis] Error 2
make[1]: [persist-settings] Error 2 (ignored)
CC adlist.o
adlist.c:32:10: fatal error: 'stdlib.h' file not found
#include <stdlib.h>
根据网上搜索的,都是重装GCC新版本,或者执行这个命令
xcode-select install
发现都没有用。
最后折腾了几小时,过程就不说了,终于知道是什么情况了。
MAC 10.15版本中,是没有/usr/include文件的,也就是说gcc会从这里去搜索头文件,但是发现都没有这些文件就提示文件不存在了!
就是需要创建个/usr/include文件!但是这个路径需要关闭SIP才能创建,具体可以百度MAC怎么关闭SIP,