ld:未找到 -lrt 的库 [英] ld: library not found for -lrt

查看:62
本文介绍了ld:未找到 -lrt 的库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行一个为 Ubuntu 制作并适用于 Mac OS 的项目.当我执行 make 时,出现以下错误:

I am trying to run a project that was made and works for Ubuntu but on Mac OS. And when I am doing the make I got the following error:

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

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

I can't see any library with that name at thole project.

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

Can anyone explain what it is and how to solve it?

推荐答案

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

On old Linux systems, several functions, such as clock_gettime, are documented to need -lrt for old versions of GNU libc. This is no more the case on recent glibc (after 2.17 from 2013).

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

So you can remove -lrt from your Makefile (and remove the thing from your cmake configuration thing generating it).

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

BTW, removing -lrt should also fit for recent Linux distributions.

附注.如果您要为自己的 Linux 系统支付支持费用,则应该向您的支持人员寻求建议.

PS. If you are paying support for your Linux system, you should ask your support for advice.

这篇关于ld:未找到 -lrt 的库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆