Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Rust binary rust-bin, binary-free, binary chains experience
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
trickygnome
n00b
n00b


Joined: 17 May 2017
Posts: 12

PostPosted: Mon Nov 18, 2024 12:54 am    Post subject: Rust binary rust-bin, binary-free, binary chains experience Reply with quote

I have been doing “emerge --update” recently and noticed installation
of dev-lang/rust-bin package.

Bootstrapping compiler is a multi-stage compilation of compiler that
is written in the same programming language (self-hosting).

GCC is the default C, C++ compiler in Gentoo that installed with Stage 1 tarball.

The initial step version of compiler:
- Rust = OCaml, but this approach was abandoned long ago.
- Go = C
- LLVM/Clang = C++
- GCC = C
- Python = C

As you can see, all compilers, except of Rust, may be build from sources.

Today, Rust bootstrap with an existing Rust compiler, typically a beta
or stable version of “rustc”. Alternatives:
- OCaml :: this method is no longer practical or maintained.
- mrustc and dtolnay/bootstrap :: not an official part of the Rust
project. C++-based Rust compiler that can compile an early version
of the Rust compiler.
- gccrs and Cranelift :: experimental and not yet fully developed.

But the main problem I faced is not Rust, but Gentoo emerge that
download binary rust-bin and run it *without my approvement*. I see
that Gentoo is getting old and lazy, that is not right. I don't know
for shure, but manually installing “dev-lang/rust” package will use
old version to update.

One solution to block binaries is to use file “/etc/portage/package.mask/all” with:
: */*-bin
: */*-bootstrap

“-bin” suffix for binary package naming is not strict and just recommended:
https://devmanual.gentoo.org/ebuild-writing/file-format/index.html
Who knows which packages have binaries, also? Ex. google-chrome.

For updating GCC, Gentoo don't download a binary
version of the compiler. Instead, it update GCC by compiling the new
version from source code.

From this perspective *Go compiler* looks better, because may be build with help of “gcc-go” or
“gollvm” parts of GCC and LLVM. But Gentoo download binary Go 1.20 dev-lang/go-bootstrap from
https://dev.gentoo.org/~williamh/dist

[b]I suggest: to make “-bin” strict and always ask before installing such things.[/b]
_________________
if posts > 50 then; eat(shit); fi


Last edited by trickygnome on Mon Nov 18, 2024 4:56 am; edited 2 times in total
Back to top
View user's profile Send private message
eschwartz
Developer
Developer


Joined: 29 Oct 2023
Posts: 228

PostPosted: Mon Nov 18, 2024 1:36 am    Post subject: Reply with quote

trickygnome wrote:

But the main problem I faced is not Rust, but Gentoo emerge that
download binary rust-bin and run it *without my approvement*. I see
that Gentoo is getting old and lazy, that is not right. I don't know
for shure, but manually installing “dev-lang/rust” package will use
old version to update.


This is a grave misunderstanding. Gentoo doesn't download a binary rust-bin without your approval.

It actually used to, and we just fixed that bug. Previously, there was a USE flag: "system-bootstrap". With that USE flag:


- enabled, rust would depend on an existing /usr/bin/rustc to compile the new version of rust. This might be dev-lang/rust, or it might be dev-lang/rust-bin.
- disabled, rust would unconditionally download a SRC_URI tarball of a prebuilt rust-bin, unpack it into a temporary directory, and compile the new copy of rust. It would then delete the temporary prebuilt rust-bin copy in the temporary directory.


The recent change to how rust is packaged means the USE=system-bootstrap flag has been ***removed***, and is now mandatory. The dev-lang/rust package no longer permits downloading a SRC_URI tarball containing a prebuilt rust-bin. You MUST bootstrap using a system-bootstrap compiler for rust.

If you have dev-lang/rust installed, it will use that. If you do not have it, you must bootstrap it somehow -- most commonly, this requires using rust-bin, but it is fully under your control as it no longer happens hidden inside of SRC_URI, but happens as an emerge dependency.

Your conspiracy theory about "old and lazy" is misplaced. Sorry.


trickygnome wrote:

For updating GCC, Gentoo don't download a binary
version of the compiler. Instead, it update GCC by compiling the new
version from source code.


GCC and rust are exactly the same here. Including the fact that before you can update GCC, you must first install a copy of GCC. If you don't have a GCC yet, the only way to get GCC on Gentoo is to download a prebuilt gcc bin, which is usually provided inside the stage3 tarball. (A stage3 tarball is literally a tarball containing lots of prebuilt bins that together make up a base install.)

There is another small difference -- GCC typically can be compiled with older versions of GCC going back several versions. Currently, GCC 13 and 14 support being compiled with a preexisting copy of GCC 4.8. In contrast, Rust requires the previous most recent version of rust in order to compile a new version -- so rust 1.82.0 only supports being compiled with rust 1.81 (or 1.82).
Back to top
View user's profile Send private message
sam_
Developer
Developer


Joined: 14 Aug 2020
Posts: 1972

PostPosted: Mon Nov 18, 2024 6:11 am    Post subject: Reply with quote

Eli is, of course, completely right. If this situation causes you distress, please donate or otherwise contribute to the gccrs effort.

In future, please start with asking a question in good faith, rather than presuming "laziness".

I'll also note the following:

  • I think there's an inconsistency between it being supposedly lazy to have the status quo (which it decidedly is not, not least because of the progress made here actually facilitates a proper bootstrap chain) and also noting the difficulty, as you did, in your post wrt the messy and poor situation even outside of Gentoo wrt bootstrapping Rust.
  • The truly "lazy" thing for us to do would've been to: a) not slot Rust; b) not make this system-bootstrap change so that dev-lang/rust continued to download a binary and nobody would complain.
  • We've not always packaged every single version of Rust given Rust requires work to maintain. Occasionally because of people being busy, a version wasn't packaged, so this will have happened (several times) before, just nobody noticed because of the behaviour of dev-lang/rust in the past.
  • Prior to slotting, there was no real way to have a proper chain because you couldn't have multiple Rusts installed, nor could you control properly which ones are available for use to bootstrap.
  • I have a proposal I need to finish wrt making it easier to identify binaries, see bug 885827.
  • GCC is not the same as Rust, given that (for one) to include Rust in stages would inevitably make various people upset, and would also imply we need something in stage3s that hard-require Rust. That has obvious downsides I'm sure I don't need to repeat.
  • The situation was described in detail in the commit message that made this change. See also bug 943144. I recommend checking git log if you're interested in process and rationale.
  • bug 943706 was filed earlier to handle adding the missing slots for the current range of Rust versions in Gentoo and also to discuss going back to mrustc and having a path from there. Perhaps you're interested in volunteering?
  • Within that same bug, I explain the issue with Go, and I note that I'd like to get that fixed too. I also filed bug 941769 to that end.
  • With regard to Go, I've no idea how viable gollvm for this, although gccgo is indeed viable for bootstrapping once slotting is sorted.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum