Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 944835 - dev-lang/rust: gcc-less systems unable to upgrade to slotted version
Summary: dev-lang/rust: gcc-less systems unable to upgrade to slotted version
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Randy Barlow
URL:
Whiteboard:
Keywords: PATCH, PullRequest
: 945157 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-11-25 01:44 UTC by mojyack
Modified: 2024-12-15 07:02 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
diff rust-bin-1.81.0-{r100,r101}.ebuild (rust-bin-remove-gcc-dep.patch,196 bytes, patch)
2024-11-25 01:44 UTC, mojyack
Details | Diff
0001-dev-lang-rust-bin-support-llvm-systems.patch (0001-dev-lang-rust-bin-support-llvm-systems.patch,9.00 KB, patch)
2024-11-26 02:01 UTC, mojyack
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mojyack 2024-11-25 01:44:20 UTC
Created attachment 911789 [details, diff]
diff rust-bin-1.81.0-{r100,r101}.ebuild

dev-lang/rust requires previous minor release of the rust toolchain since the recent transition to slotted versions.
And for the first bootstrap, we have to use rust-bin.
But rust-bin depends on gcc, so pure-llvm systems cannot upgrade rust anymore.
This is a huge regression.

I've wrote a patch for rust-bin to remove gcc dependency: rust-bin-remove-gcc-dep.patch
That is what non-slotted ebuilds do in esetup_unwind_hack,
and I confirmed that it also works for rust-bin on amd64 and aarch64.

If this hack is acceptable, I would make a PR.
But it may not be a good idea to install such a hack on the whole system.
I need the maintainer's comments.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-11-25 02:11:52 UTC
Please always give unified diffs (`diff -u`) but also the truncated headers make it kind of hard to read. `git am`-able patches generated by `git format-patch` are even better.

Anyway, the patch as a concept is fine, but:
a) needs commentary (even better with a commit message too);
b) hardcoding /usr/lib isn't right; need a proper way of finding the path.
Comment 2 mojyack 2024-11-25 08:24:04 UTC
(In reply to Sam James from comment #1)
> Please always give unified diffs (`diff -u`) but also the truncated headers
> make it kind of hard to read. `git am`-able patches generated by `git
> format-patch` are even better.
Thanks for the advice! I will do so next time.
> Anyway, the patch as a concept is fine, but:
> a) needs commentary (even better with a commit message too);
Sure, I'll write comments when creating a commit.
> b) hardcoding /usr/lib isn't right; need a proper way of finding the path.
Is `dosym libunwind.so ${EPREFIX}/usr/$(get_libdir)/libgcc_s.so` sufficient?
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-11-25 14:43:45 UTC
Wonder if `gcc -print-file-name=libgcc_s.so` would be better, but wait, now I've confused myself.

(I worry I misread the diff in bed.)

Can we use patchelf instead here? Or make the symlink somewhere else (+ patchelf it) where nothing else is going to find it?
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-11-25 14:46:04 UTC
Or maybe I'm misunderstanding a bit. The hack in dev-lang/rust was only in the work directory and didn't apply to the live filesystem. But dosym is for the image.

But the issue we're hitting here is that we need dev-lang/rust-bin to work for real when using it in dev-lang/rust, as we're no longer stuffing it in dev-lang/rust.

So, two options:
1) Add a hack in dev-lang/rust when using rust-bin, but this will leave rust-bin broken otherwise (this is a bad option);
2) Something like I suggested in https://bugs.gentoo.org/944835#c3.
Comment 5 mojyack 2024-11-26 02:01:13 UTC
Created attachment 911921 [details, diff]
0001-dev-lang-rust-bin-support-llvm-systems.patch

patchelf works.
Please take look at this.
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-11-26 02:23:57 UTC
That looks good to me! One small issue is 'eend $?' won't work as intended there because of the pipeline, we need to use assert or something instead (not sure assert is actually supposed to interact with eend; there's some discussion ongoing about replacing assert because of this kind of issue).
Comment 7 mojyack 2024-11-26 03:39:30 UTC
Thanks!
I'm going to replace `eend $?` with `eend ${PIPESTATUS[0]}`.
And I think this fix should be applied to line 147 too.
Comment 8 Matt Jolly gentoo-dev 2024-11-27 00:08:42 UTC
Agree that dev-lang/rust-bin should be fixed/patched, however there is a parallel effort to enable bootstrapping dev-lang/rust from source via mrustc (and filling in gaps in the bootstrap chain). Added to see-also.

Since the 'get rust 1.54.0 building' step is ready to go it may be time to investigate mrustc.
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-11-27 21:21:41 UTC
*** Bug 945157 has been marked as a duplicate of this bug. ***
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-11-27 21:25:26 UTC
Please make a PR with that updated patch when ready -- thanks!
Comment 11 Larry the Git Cow gentoo-dev 2024-12-09 05:01:31 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0a2e3e056ba70d19df59f2a22a44e3a53abe933e

commit 0a2e3e056ba70d19df59f2a22a44e3a53abe933e
Author:     mojyack <mojyack@gmail.com>
AuthorDate: 2024-11-28 01:59:18 +0000
Commit:     Matt Jolly <kangie@gentoo.org>
CommitDate: 2024-12-09 04:49:42 +0000

    dev-lang/rust-bin: remove hard gcc dependency
    
    Instead of depending to gcc, patch binaries to use libunwind.so when
    `llvm-libunwind` USE flag is enabled.
    
    Signed-off-by: mojyack <mojyack@gmail.com>
    Closes: https://bugs.gentoo.org/944835
    Closes: https://github.com/gentoo/gentoo/pull/39495
    Signed-off-by: Matt Jolly <kangie@gentoo.org>

 dev-lang/rust-bin/rust-bin-1.71.1-r101.ebuild | 245 ++++++++++++++++++++++++
 dev-lang/rust-bin/rust-bin-1.74.1-r101.ebuild | 255 +++++++++++++++++++++++++
 dev-lang/rust-bin/rust-bin-1.75.0-r101.ebuild | 255 +++++++++++++++++++++++++
 dev-lang/rust-bin/rust-bin-1.77.1-r101.ebuild | 257 +++++++++++++++++++++++++
 dev-lang/rust-bin/rust-bin-1.79.0-r101.ebuild | 260 +++++++++++++++++++++++++
 dev-lang/rust-bin/rust-bin-1.80.1-r101.ebuild | 264 ++++++++++++++++++++++++++
 dev-lang/rust-bin/rust-bin-1.81.0-r101.ebuild | 262 +++++++++++++++++++++++++
 dev-lang/rust-bin/rust-bin-1.82.0-r101.ebuild | 264 ++++++++++++++++++++++++++
 8 files changed, 2062 insertions(+)
Comment 12 Larry the Git Cow gentoo-dev 2024-12-15 07:02:37 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=053fb81af3f45277e1869d993c240f38d0346a71

commit 053fb81af3f45277e1869d993c240f38d0346a71
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-12-15 06:59:42 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-12-15 07:01:52 +0000

    Revert "dev-lang/rust-bin: remove hard gcc dependency"
    
    This reverts commit 0a2e3e056ba70d19df59f2a22a44e3a53abe933e.
    
    This (clearly) doesn't work if symbols from libgcc_s are relied upon,
    like __popcountdi2. Needing sys-devel/gcc for now for rust-bin is better
    than having it entirely broken.
    
    Discussions on a broader fix are in progress on the bug.
    
    Bug: https://bugs.gentoo.org/944835
    Bug: https://bugs.gentoo.org/946321
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-lang/rust-bin/rust-bin-1.71.1-r101.ebuild | 15 ++-------------
 dev-lang/rust-bin/rust-bin-1.74.1-r101.ebuild | 15 ++-------------
 dev-lang/rust-bin/rust-bin-1.75.0-r101.ebuild | 15 ++-------------
 dev-lang/rust-bin/rust-bin-1.77.1-r101.ebuild | 15 ++-------------
 dev-lang/rust-bin/rust-bin-1.79.0-r101.ebuild | 15 ++-------------
 dev-lang/rust-bin/rust-bin-1.80.1-r101.ebuild | 15 ++-------------
 dev-lang/rust-bin/rust-bin-1.81.0-r101.ebuild | 15 ++-------------
 dev-lang/rust-bin/rust-bin-1.82.0-r101.ebuild | 15 ++-------------
 8 files changed, 16 insertions(+), 104 deletions(-)