为什么使用 GHC 7.10.2 构建的可执行文件同时依赖于 librt 和 libc?

Why executables built with GHC 7.10.2 have dependencies with both librt and libc?

根据https://docs.oracle.com/cd/E36784_01/html/E36873/librt-3lib.html

Historically, functions in this library provided many of the interfaces specified by the POSIX.1b Realtime Extension. See standards(5). This functionality now resides in libc(3LIB).

This library is maintained to provide backward compatibility for both runtime and compilation environments. The shared object is implemented as a filter on libc.so.1. New application development need not specify –lrt.

所以目前它应该 link 只适用于 libc,它应该包含 librt 中的所有内容。 libc 中包含的 libdl 依赖项也是如此。

这是在 Trac #8713 中提出的(两年前!),其中包括一个补丁 ghc-libs.patch,它从 GHC 运行时系统中删除了 librt 要求。 (运行时系统正在引入 librt。)不幸的是,在讨论进行时,补丁似乎破坏了 Solaris 10 或 11 上的 GHC。然后人们就离开了票,因为它经常开源项目也是如此。也许有大量空闲时间和手头有虚拟机的人会过来修复这些补丁。