在 MAC 10.8.5 上安装 Redis 不工作! DMG 在哪里?未定义的符号 -?*&!

Installing Redis on MAC 10.8.5 Not Working! Where is the DMG ? Undefined symbol -?*&!

我正在尝试在我的 Macbook Pro 上安装最新的 Redis 运行 10.8.5 下载 tar 球后,我受邀制作项目.... 输入 make:

 LINK redis-server
 Undefined symbols for architecture x86_64:

我知道 Redis 是很棒的产品,但是 DMG 在哪里?我的意思是,您知道安装 mongodb 是多么容易吗?

对于那些对我 mac 上的血腥细节感兴趣的人:

     unknownb8f6b11c7271:redis-2.8.19 Mac1$ make
 cd src && make all
 LINK redis-server
Undefined symbols for architecture x86_64:
   "___atomic_add_fetch", referenced from:
     _zmalloc in zmalloc.o
     _zcalloc in zmalloc.o
     _zrealloc in zmalloc.o
  _zmalloc_used_memory in zmalloc.o
  _zmalloc_get_fragmentation_ratio in zmalloc.o
 "___atomic_sub_fetch", referenced from:
  _zrealloc in zmalloc.o
  _zfree in zmalloc.o
 ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see    invocation)
 make[1]: *** [redis-server] Error 1
 make: *** [all] Error 2

在 OS X 上安装 Redis 的简单方法是使用 Homebrew。只需安装它 运行:

brew install redis

此命令将已编译的二进制文件安装到您的系统。

做一个

make distclean

首先。 make distclean 应该通过删除内置的 hiredis 来解决这个问题。

下一个 make 应该重新构建。

[使 distclean; CC=gcc make ] 我使用这个命令。它适用于 redis 5.0.6

使用 Homebrew 很容易安装-

  • 酿造更新
  • brew 安装 redis

检查

  • redis-cli ping

如果你正在获得 PONG 那你就可以开始了(y)

我在用redis编译C++项目时遇到了同样的问题api 但是当你使用 cmake 时,我正在使用 g++ 进行编译。

如果在 Mac(M1) 上使用 g++ 编译 C++ 和 redis,可以添加

-lhreids

用于项目编译。 它会起作用。