issue linking to librt

  • Open
  • quality assurance status badge
Details
3 participants
  • Ava Hahn
  • Brian Cully
  • semilin
Owner
unassigned
Submitted by
Ava Hahn
Severity
normal
A
A
Ava Hahn wrote on 2 May 2023 22:01
(address . bug-guix@gnu.org)
bde5cd5a-e029-4243-8668-f59b4a8d5237@app.fastmail.com
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": "librt.so.1 ... => /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/librt.so.1 to /my-folder/librt.so
- 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
S
S
semilin wrote on 4 May 2023 05:40
(no subject)
(address . 63238@debbugs.gnu.org)
0579ac0dfb2cbf24b0375185eb0f4665@disroot.org
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
B
B
Brian Cully wrote on 26 May 2023 17:58
Re: bug#63238: issue linking to librt
(name . semilin)(address . semilin@disroot.org)(address . 63238@debbugs.gnu.org)
87r0r3xex5.fsf_-_@psyduck.jhoto.kublai.com
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 63238@debbugs.gnu.org

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