issue linking to librt

  • Open
  • quality assurance status badge
3 participants
  • Ava Hahn
  • Brian Cully
  • semilin
Submitted by
Ava Hahn
Ava Hahn wrote on 2 May 2023 22:01
(address .
Hello All,

I believe I have stumbled on an issue with how the libraries in glibc are stored.
If I run "ld -lrt" it reports "ld: cannot find -lrt: No such file or directory"
Meanwhile, I can find librt with "ldconfig -p | grep librt": " ... => /gnu/store/...".

In order to get ld to find librt I need to take the following steps:
- make a folder I can write to (not .~/guix-profile/lib)
- symlink ~/.guix-profile/lib/ to /my-folder/
- add the corresponding option to ld: "ld -lrt -L ~/lib"
Then ld is able to find librt.

I stumbled on this while trying to compile a rust project with "cargo build".
Compiling any dependency that relied on libc failed on linking to librt.

Feel free to let me know if there is some Guix facility I should be using instead. I am pretty new to this. I tried using cargo in a Guix shell but the same problem persisted.
Attachment: file
semilin wrote on 4 May 2023 05:40
(no subject)
(address .
I encountered the same issue recently. I used to be able to compile with
`cargo build` just fine just a few days ago. I recently upgraded my
system from glibc 2.33 to 2.35, and I'd guess it's related to that.
However, running it in `guix shell glibc@2.33` results in the same
problem, so I'm not sure.
Attachment: file
Brian Cully wrote on 26 May 2023 17:58
Re: bug#63238: issue linking to librt
(name . semilin)(address . .
librt and libpthread were merged into libc with glibc 2.34, however, for
compatibility, there exist empty .a files to satisfy the linker. But
because Guix has a separate output for the static libraries, they need
to be explicitly installed from ‘glibc:static’, which allows Cargo to do
its thing.

Cargo itself should probably be fixed so that it no longer tries to link
with these libraries, but until that time, the above work-around suffices.
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to

To respond to this issue using the mumi CLI, first switch to it
mumi current 63238
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch