c++ - ld : library not found for -lrt

标签 c++ macos makefile apache-kafka

我正在尝试运行一个为 Ubuntu 创建并在 Mac OS 上运行的项目。当我进行 make 时,出现以下错误:

ld: library not found for -lrt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [consumer] Error 1
make[1]: *** [CMakeFiles/consumer.dir/all] Error 2
make: *** [all] Error 2

我在项目中看不到任何具有该名称的库。

谁能解释一下这是什么以及如何解决?

最佳答案

在旧的 Linux 系统上,几个函数,例如 clock_gettime , 被记录为需要 -lrt 用于 版本的 GNU libc。 最近 不再是这种情况glibc (2013 年 2.17 之后)。

因此,您可以从 Makefile 中删除 -lrt(并从生成它的 cmake 配置中删除它)。

顺便说一句,删除 -lrt 也应该适合 最近 Linux 发行版。

附言。如果您正在为您的 Linux 系统付费支持,您应该向您的支持寻求建议。

关于c++ - ld : library not found for -lrt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47703239/

相关文章:

macos - Mac 10.7.5 上的 Homebrew OpenCV 32 位

debugging - 如何暂停以检查 Makefile 运行的 sh 命令的结果?

c++ -/usr/bin/ld : cannot find -lgd

c++ - 导致无法解析的外部符号的常量引用参数

c++ - 隐式字段初始化规则

c++ - C++ 中转换为 simd 类型是未定义行为吗?

javascript - 从 Obj C 调用 JavaScript - 没有 WebView

c++ - 加密初始化 vector

c++ - 如何在 Os X 上用 C++ 获取模块的基地址

bash - Makefile 错误退出并显示一条消息