GCC package lacks librt.so (and instead only provides versioned librt.so.1)

  • Open
  • quality assurance status badge
Details
3 participants
  • Antero Mejr
  • Josselin Poiret
  • Mekeor Melire
Owner
unassigned
Submitted by
Mekeor Melire
Severity
normal
Merged with
M
M
Mekeor Melire wrote on 4 May 2023 11:16
(address . bug-guix@gnu.org)
87ttwscuow.fsf@posteo.de
The "gcc" package (as well as the "gcc-toolchain" package) (since
version 12?) lacks the librt.so file which some stuff links to.

As a consequence, in bug#63012, Josselin Poiret (CC) had to patch
Zig to not link to that file. Another consequence is that I had to
install gcc-toolchain:static in order to make GHC compile XMonad.

On #guix IRC channel, Josselin Poiret stated that we should
include an empty librt.a in the output of the "gcc" package. And
Ludo (CC) suggested to temporarily include that file only in
gcc-toolchain, in order to avoid world rebuild.

Here's the full relevant IRC log:

Toggle snippet (35 lines)
2023-05-04 09:49:54 mekeor: bjc: for me, gcc-toolchain@12 is
shipped with librt.so.1 which is present in my ~/.guix-profile/lib
folder which is listed in my $LIBRARY_PATH variable. still, ghc
can't find it :/
2023-05-04 09:56:15 jpoiret: mekeor: that's because ghc and others
look for librt.so, not librt.so.1
2023-05-04 09:56:31 jpoiret: we forgot to include an empty librt.a
in the out output of gcc unfortunately
2023-05-04 09:56:59 jpoiret: you can add gcc-toolchain:static for
now
2023-05-04 09:57:04 mekeor: jpoiret: is there a workaround? :)
also, is there a patch already
2023-05-04 09:57:08 mekeor: oh cool
2023-05-04 09:57:12 jpoiret: I don't think so
2023-05-04 09:57:50 jpoiret: basically librt.so.1 is empty now,
since everything is provided by libc
2023-05-04 09:59:43 mekeor: the "static" output fixes my problem.
thank you very much, jpoiret!
2023-05-04 09:59:47 jpoiret: the problem is that it'll require a
world rebuild so it's not an easy change to make now. But we'll
probably have to do it anyway
2023-05-04 10:00:01 jpoiret: might as well batch some other
important changes like updating the glibc again
2023-05-04 10:00:08 jpoiret: just to break everything again :)
2023-05-04 10:00:41 civodul: jpoiret: we could add an empty
librt.a in gcc-toolchain, rather than gcc?
2023-05-04 10:01:00 civodul: that would address most practical
issues, no?
2023-05-04 10:01:26 jpoiret: ah, that's right :)
2023-05-04 10:01:55 jpoiret: but still, it's probably a good idea
to have it in gcc, zig wanted it and I had to patch out -librt
2023-05-04 10:01:59 jpoiret: -lrt *
2023-05-04 10:02:54 civodul: yes, that'd be the right fix, but in
the meantime we could have the easy fix :-)
J
J
Josselin Poiret wrote on 4 May 2023 21:50
[PATCH] gnu: gcc-toolchain: Add empty librt.a.
a7e33ea2f29b930d4782932ea733ccf9ca7f76da.1683229790.git.dev@jpoiret.xyz
From: Josselin Poiret <dev@jpoiret.xyz>

* gnu/packages/commencememnt.scm (make-gcc-toolchain): Add empty librt.a.
* gnu/packages/base.scm (gcc): Add a warning regarding the missing librt.a.
---
Hi,

This patch should be enough for -lrt to work with gcc-toolchain. This doesn't
fix the underlying issue for the gcc package though, as it would incur a world
rebuild.

Best,
Josselin

gnu/packages/base.scm | 4 ++++
gnu/packages/commencement.scm | 7 +++++++
2 files changed, 11 insertions(+)

Toggle diff (37 lines)
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 6911ea78be..4350fd4041 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -945,6 +945,10 @@ (define-public glibc
;; library is empty by some criterion (such as their file
;; size equaling eight bytes) rather than hardcoding them
;; by name.
+
+ ;; XXX: We forgot librt.a for the current version! In
+ ;; the meantime, gcc-toolchain provides it, but remove
+ ;; that fix once librt.a is added here.
(define empty-static-libraries
'("libpthread.a" "libdl.a" "libutil.a" "libanl.a"))
(define (empty-static-library? file)
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 25e96b1aa6..26d5eb3819 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -3452,6 +3452,13 @@ (define* (make-gcc-toolchain gcc
(union-build (assoc-ref %outputs "static")
(list (assoc-ref %build-inputs
"libc-static")))
+ ;; XXX Remove once an empty librt.a is added to
+ ;; libc:out.
+ (copy-file
+ (string-append (assoc-ref %outputs "out")
+ "/lib/libpthread.a")
+ (string-append (assoc-ref %outputs "out")
+ "/lib/librt.a"))
#t))))
(native-search-paths

base-commit: f14d3944cc699d1426c31b304fb49b72a579666a
--
2.39.2
A
A
Antero Mejr wrote on 26 May 2023 17:16
(no subject)
(address . control@debbugs.gnu.org)(address . 63728@debbugs.gnu.org)
87lehbw2bj.fsf@mailbox.org
merge 63258 63728
J
J
Josselin Poiret wrote on 25 Aug 2023 18:36
Re: [PATCH] gnu: gcc-toolchain: Add empty librt.a.
(name . Ludovic Courtès)(address . ludo@gnu.org)
87fs47t6z1.fsf@jpoiret.xyz
Hi everyone,

Josselin Poiret <dev@jpoiret.xyz> writes:

Toggle quote (5 lines)
> From: Josselin Poiret <dev@jpoiret.xyz>
>
> * gnu/packages/commencememnt.scm (make-gcc-toolchain): Add empty librt.a.
> * gnu/packages/base.scm (gcc): Add a warning regarding the missing librt.a.

Pushed as 6c447ababfb11581a75cff8281e96f701e216692.

This does not fully fix this bug though, since the gcc package still
doesn't provide it. It will incur a world rebuild if we also do that,
so that should be kept for core-updates.

Best,
--
Josselin Poiret
-----BEGIN PGP SIGNATURE-----

iQHEBAEBCgAuFiEEOSSM2EHGPMM23K8vUF5AuRYXGooFAmTo2HIQHGRldkBqcG9p
cmV0Lnh5egAKCRBQXkC5FhcaiqeyC/wJL1WQw7MqHvgenwxIRMeWNPM7pqCUxVoM
gVHSz84imyo4JBbLNbwkpz+mXVEB+eVTY0X1wz7K5rU0LXWoL8x28WkwslcMtWoi
xsQGhyJVDfy4K8mBEyZ6iTIwOQtobg/sWLH2fiFunulBHrLQ+jZ6orneFYDQ4twJ
VaTV5GyVJ5ejuYL/inHCD7NuiV7MTAU3qhRdoawymD4AtZ6sALpwKe+m7VNALK18
6y+oHRJekSZN2qk6nVuOo3X1ITqKxpkLBTacOusZ/JITI1GvzGe1JS3CrM/y2Ijz
gHXx1uNRT09BSyjN1HrB13xliZ5IgwbToUMxY5fLo+mpmBlSxkAMmvcJsIpH+PZT
DeqC/vEvgWzj0B2bW7BrfT75iflwOKBNayiRlTvmoFzoZYWbEbOtJmEg0H3sKBAE
9gwrqsUz+ZEVH+IEJLDBT0xiYPpkgonE+NquV6TCR5J8BzIIXARq+m+chbQEDT/g
9Kgwd+zncT8PGYIhNVi0ACriRxj4Pq0=
=jyCw
-----END PGP SIGNATURE-----

?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 63258@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 63258
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