Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 689336 - dev-lang/rust should use existing installation of Rust for building and cross-compiling
Summary: dev-lang/rust should use existing installation of Rust for building and cross...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement with 1 vote (vote)
Assignee: Gentoo Rust Project
URL:
Whiteboard:
Keywords:
Depends on: 703744 747760 756793 706292
Blocks:
  Show dependency tree
 
Reported: 2019-07-05 20:16 UTC by Alex
Modified: 2024-02-11 06:00 UTC (History)
4 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex 2019-07-05 20:16:54 UTC
I think it would be very wise for Rust ebuild to not depend on Rust binary distribution for building and only fall back to it in the case there is no installed rust or rust-bin packages with previous versions of Rust. Just a minor FR though.
Comment 1 Georgy Yakovlev archtester gentoo-dev 2019-07-08 16:24:59 UTC
I tried to do that and it's a bit problematic.
the main reason is that rust bootstrap has strict requirements on which version to use for initial bootstrap.

like 1.35.0 requires exactly 1.34.2 too bootstrap.
The restriction can be relaxed a bit in some cases, but not much. This will require us to always keep old versions of rust around to keep portage dependency graph consistent.

It not only depends on compiler versions, but on cargo versions as well.

this constraint is defined in src/stage0.txt file

https://github.com/rust-lang/rust/blob/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c/src/stage0.txt

I may introduce a masked use-flag called system-bootstrap which can be unmasked and set to use system-installed rust, but not sure yet. I wasn't actually able to get it to build yet with already installed rust.
Comment 2 Mark Gomersbach 2019-07-18 08:54:47 UTC
Using a local rust might be more pressing, since now I'm getting segfaults from the internally shipped version.
I can't build >=rust-1.34 for this reason.
Comment 3 Mark Gomersbach 2019-07-18 17:05:32 UTC
(In reply to Mark Gomersbach from comment #2)
> Using a local rust might be more pressing, since now I'm getting segfaults
> from the internally shipped version.
> I can't build >=rust-1.34 for this reason.

Disregard message and sorry for the noise. 
After strace it turned out to be my virus scanner.
Comment 4 Georgy Yakovlev archtester gentoo-dev 2019-07-18 18:18:37 UTC
(In reply to Mark Gomersbach from comment #3)
> (In reply to Mark Gomersbach from comment #2)
> > Using a local rust might be more pressing, since now I'm getting segfaults
> > from the internally shipped version.
> > I can't build >=rust-1.34 for this reason.
> 
> Disregard message and sorry for the noise. 
> After strace it turned out to be my virus scanner.

probably same as https://bugs.gentoo.org/683856
Comment 5 Philipp Ammann 2019-09-22 13:56:46 UTC
+1 because I'd like to use Rust on my musl systems (both x86 and arm64).

(In reply to Georgy Yakovlev from comment #1)
> like 1.35.0 requires exactly 1.34.2 too bootstrap.
Seriously? That kind of version sensitivity for *bootstrapping* is ludicrous.

Maybe we can (kindly) ask upstream to provide static binaries?
Comment 6 Georgy Yakovlev archtester gentoo-dev 2019-09-24 19:30:06 UTC
rust upstream provides binaries, even for musl(but it emits static binaries by default). those binaries are used to bootstrap and the bug is about getting rid of it.

rust that bootstraps and works on musl is available here https://github.com/smaeul/portage-overlay
Comment 7 Georgy Yakovlev archtester gentoo-dev 2020-01-06 21:54:25 UTC
system-bootstrap useflag added to rust-1.40.0-r1

please try it out and report any issues you may encounter.

likely it'll need some checks pre-emerge to verify it's using correct version selected, but otherwise both rust-bin-1.40.0 and rust-1.40.0-r1 can bootstrap a new copy without downloading tarballs at all.


please note due to way we installed rust before dev-lang/rust below 1.40.0-r1 CANNOT be used to bootstrap another compiler (but rust-bin should be fine)



rust 1.41.0 (or whatever next version is) should be bootsrap-able with previous one as intended.
Comment 8 Alex 2020-01-07 20:39:47 UTC
(In reply to Georgy Yakovlev from comment #7)
> system-bootstrap useflag added to rust-1.40.0-r1
> 
> please try it out and report any issues you may encounter.
> 
> likely it'll need some checks pre-emerge to verify it's using correct
> version selected, but otherwise both rust-bin-1.40.0 and rust-1.40.0-r1 can
> bootstrap a new copy without downloading tarballs at all.
> 
> please note due to way we installed rust before dev-lang/rust below
> 1.40.0-r1 CANNOT be used to bootstrap another compiler (but rust-bin should
> be fine)
> 
> rust 1.41.0 (or whatever next version is) should be bootsrap-able with
> previous one as intended.

I've tried new ebuild and it fails somewhere around doctest or so (use flag "system-bootstrap" not set, "system-llvm" and "doc" set). Judging by the logs, it looks for static LLVM libraries and can't find them (because there aren't any). 1.40.0 builds fine.
Comment 9 Doug Goldstein (RETIRED) gentoo-dev 2020-01-26 16:12:06 UTC
(In reply to Georgy Yakovlev from comment #1)
> I tried to do that and it's a bit problematic.
> the main reason is that rust bootstrap has strict requirements on which
> version to use for initial bootstrap.
> 
> like 1.35.0 requires exactly 1.34.2 too bootstrap.
> The restriction can be relaxed a bit in some cases, but not much. This will
> require us to always keep old versions of rust around to keep portage
> dependency graph consistent.
> 

This was a very special case that isn't the normal state of things. This should definitely work most of the time.
Comment 10 Georgy Yakovlev archtester gentoo-dev 2020-01-30 18:06:43 UTC
ok hit it today while bumping to 1.41.0

system-llvm and system-bootstrap if used together fails to find some llvm libraries

cannot find -lLLVMPowerPCDisassembler
          /usr/lib/gcc/powerpc64le-unknown-linux-gnu/9.2.0/../../../../powerpc64le-unknown-linux-gnu/bin/ld: cannot find -lLLVMPowerPCAsmParser


etc..

but the libraries are clearly present in /usr/lib/llvm/9/lib64/

checking what's going on..
Comment 11 Georgy Yakovlev archtester gentoo-dev 2020-01-30 19:30:16 UTC
1.41.0 is in the tree, 1.40.0-r1 and rust-bin-1.40.0 can be used to system-bootstap it, internal bootstrap is still supported (USE=-system-bootstrap)

should build fine with USE="doc system-llvm system-bootstrap", thanks for reporting the issue, just built it on 2 machines without hitting the llvm lib search path issue.
Comment 12 Alex 2020-01-31 11:04:01 UTC
(In reply to Georgy Yakovlev from comment #10)
> ok hit it today while bumping to 1.41.0
> 
> system-llvm and system-bootstrap if used together fails to find some llvm
> libraries
> 
> cannot find -lLLVMPowerPCDisassembler
>          
> /usr/lib/gcc/powerpc64le-unknown-linux-gnu/9.2.0/../../../../powerpc64le-
> unknown-linux-gnu/bin/ld: cannot find -lLLVMPowerPCAsmParser
> 
> 
> etc..
> 
> but the libraries are clearly present in /usr/lib/llvm/9/lib64/
> 
> checking what's going on..

It looks for static libraries (*.a), but the ones present are dynamic (*.so).
Comment 13 Alex 2020-01-31 11:05:48 UTC
(In reply to Alex from comment #12)
> (In reply to Georgy Yakovlev from comment #10)
> > ok hit it today while bumping to 1.41.0
> > 
> > system-llvm and system-bootstrap if used together fails to find some llvm
> > libraries
> > 
> > cannot find -lLLVMPowerPCDisassembler
> >          
> > /usr/lib/gcc/powerpc64le-unknown-linux-gnu/9.2.0/../../../../powerpc64le-
> > unknown-linux-gnu/bin/ld: cannot find -lLLVMPowerPCAsmParser
> > 
> > 
> > etc..
> > 
> > but the libraries are clearly present in /usr/lib/llvm/9/lib64/
> > 
> > checking what's going on..
> 
> It looks for static libraries (*.a), but the ones present are dynamic (*.so).

At least on x86_64, that is.
Comment 14 Georgy Yakovlev archtester gentoo-dev 2020-08-03 22:58:08 UTC
ok getting really close to enabling this by default.

all rust versions left in the tree can now do system boostrap.
the only 1 thing left to solve is bootstrap compiler check (#706292)
Comment 15 Larry the Git Cow gentoo-dev 2020-09-25 07:38:27 UTC
The bug has been referenced in the following commit(s):

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

commit e2701fa0f4b3b3a3d971c2274c36b4ea4bce7181
Author:     Georgy Yakovlev <gyakovlev@gentoo.org>
AuthorDate: 2020-09-25 07:26:47 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2020-09-25 07:37:58 +0000

    sys-devel/rust-std: new package, for crossdev #679878
    
    EXPERIMENTAL!
    
    Bug: https://bugs.gentoo.org/680652
    Bug: https://bugs.gentoo.org/679878
    Bug: https://bugs.gentoo.org/689336
    Package-Manager: Portage-3.0.8, Repoman-3.0.1
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 sys-devel/rust-std/Manifest               |   1 +
 sys-devel/rust-std/metadata.xml           |  21 +++++
 sys-devel/rust-std/rust-std-1.46.0.ebuild | 146 ++++++++++++++++++++++++++++++
 3 files changed, 168 insertions(+)
Comment 16 Georgy Yakovlev archtester gentoo-dev 2020-10-13 03:21:53 UTC
ok, this is complete.

rust-1.47.0 has system-bootstrap flag set by default. but still contains fallback internal bootstrap just in case.

it remains stable-masked for now, because of equal visibility requirement and bootstrap constraints.

rust requires exactly previous version to bootstrap.
but a stable package can never depend on unstable one.

so for example, we have versions 1.46.0, 1.47.0 and version 1.48.0, 
1.46.0 is stable.
but 1.47.0 contains known bugs (it happens) and never got stable keywords on all arches. we can't stabilize 1.48.0 then time comes.

well, we can, but to install 1.48.0 rust will pull rust-bin-1.48.0, as it can't pull 1.47.0 on stable system. 

So it will remain stable-masked for now, but I'll try really hard to keep system-boostrap path stable so there are no gaps in versions.

when next stabilization time comes I will consider enabling it for stable users as well.

as for cross-compilation, please use bug https://bugs.gentoo.org/679878 to track progress. this bug is only about system-bootstrap.


I see no use keeping this bug open, so closing.
again, at the time of next stabilization (in about 30 days) I will try enabling it for stable users. and maybe remove internal-bootstrap, as it's direct equivalent of installing rust-bin and using it to bootstrap source version.


cheers.
Comment 17 Larry the Git Cow gentoo-dev 2020-11-26 19:19:40 UTC
The bug has been referenced in the following commit(s):

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

commit e61ae40fcdeac8948f307c4dff57337e5d79caef
Author:     Georgy Yakovlev <gyakovlev@gentoo.org>
AuthorDate: 2020-11-26 19:18:46 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2020-11-26 19:19:32 +0000

    dev-lang/rust: don't default to system-bootstrap for now
    
    Bug: https://bugs.gentoo.org/689336
    Bug: https://bugs.gentoo.org/756793
    Package-Manager: Portage-3.0.10, Repoman-3.0.2
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 dev-lang/rust/rust-1.47.0-r1.ebuild | 2 +-
 dev-lang/rust/rust-1.47.0-r2.ebuild | 2 +-
 dev-lang/rust/rust-1.48.0.ebuild    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)