Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 756793 - dev-lang/rust-1.48.0 USE=system-bootstrap circular dependency
Summary: dev-lang/rust-1.48.0 USE=system-bootstrap circular dependency
Status: IN_PROGRESS
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Georgy Yakovlev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 689336
  Show dependency tree
 
Reported: 2020-11-26 07:49 UTC by Oskari Pirhonen
Modified: 2020-12-12 15:50 UTC (History)
6 users (show)

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


Attachments
emerge --info output (emerge_info.txt,15.63 KB, text/plain)
2020-11-26 07:49 UTC, Oskari Pirhonen
Details
emerge dev-lang/rust virtual/rust -pvud > emerge-rust-bin-debug.txt 2>&1 (emerge-rust-bin-debug.txt.bz2,67.64 KB, application/octet-stream)
2020-11-26 20:34 UTC, Georgy Yakovlev
Details
emerge debug output (emerge_ask_verbose_invalid_update_deep_bdeps_pretend_debug_world.log.xz,89.25 KB, application/x-xz)
2020-11-27 04:01 UTC, Oskari Pirhonen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oskari Pirhonen 2020-11-26 07:49:23 UTC
Created attachment 675022 [details]
emerge --info output

Portage is trying to update the rust compiler and have the system-bootstrap USE flag set, but I'm greeted with the following error:

* Error: circular dependencies

(dev-lang/rust-1.48.0:stable/1.48::gentoo, ebuild scheduled for merge) depends on
 (dev-lang/rust-1.48.0:stable/1.48::gentoo, ebuild scheduled for merge) (buildtime)


I have dev-lang/rust-1.47.0-r1 installed, but if I'm understanding the ebuild for 1.48.0 correctly, it should only depend on 1.47:

# to bootstrap we need at least exactly previous version, or same.
# most of the time previous versions fail to bootstrap with newer
# for example 1.47.x, requires at least 1.46.x, 1.47.x is ok,
# but it fails to bootstrap with 1.48.x
# https://github.com/rust-lang/rust/blob/${PV}/src/stage0.txt
BOOTSTRAP_DEPEND="||
	(
		=dev-lang/rust-$(ver_cut 1).$(($(ver_cut 2) - 1))*
		=dev-lang/rust-bin-$(ver_cut 1).$(($(ver_cut 2) - 1))*
		=dev-lang/rust-$(ver_cut 1).$(ver_cut 2)*
		=dev-lang/rust-bin-$(ver_cut 1).$(ver_cut 2)*
	)
"

BDEPEND="${PYTHON_DEPS}
	app-eselect/eselect-rust
	|| (
		>=sys-devel/gcc-4.7
		>=sys-devel/clang-3.5
	)
	system-bootstrap? ( ${BOOTSTRAP_DEPEND} )
	!system-llvm? (
		dev-util/cmake
		dev-util/ninja
	)
"
Comment 1 Georgy Yakovlev gentoo-dev 2020-11-26 19:09:18 UTC
can you please send exact accept_keywords for rust you have. (including virtual if any)
exact command you run


and attach output of your 'emerge --<yourargs> -pvd'
Comment 2 William Hubbs gentoo-dev 2020-11-26 19:12:14 UTC
I saw weird behavior related to this as well.
When I upgraded from rust 1.47.0-r1 to 1.48.0, rust-bin-1.48.0 was
pulled in to bootstrap rust-1.48.0. I'm not sure why that was necessary
since I already had rust 1.47.0-r1 on my system.
Comment 3 Larry the Git Cow gentoo-dev 2020-11-26 19:19:41 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(-)
Comment 4 Georgy Yakovlev gentoo-dev 2020-11-26 19:21:59 UTC
yeah something strange is going on.

on stable system I have rust-1.46.0 installed

accepted keywords for =dev-lang/rust-1.47* =virtual/rust-1.47*

and portage tries to pull rust-bin-1.46.0 for installation... very strange.


disabled by default for now.
Comment 5 Georgy Yakovlev gentoo-dev 2020-11-26 20:34:03 UTC
Created attachment 675193 [details]
emerge dev-lang/rust virtual/rust -pvud > emerge-rust-bin-debug.txt 2>&1

another weirdness


stable system has:
dev-lang/rust-1.46.0
virtual/rust-1.46.0


accept_keywords:
=dev-lang/rust-1.47*
=virtual/rust-1.47*


trying to emerge it:

# emerge dev-lang/rust virtual/rust -pvu

These are the packages that would be merged, in order:

Calculating dependencies  .... done!
[ebuild  N     ] dev-lang/rust-bin-1.46.0:stable::gentoo  USE="-clippy -doc -rls -rustfmt" ABI_X86="(64) -32 (-x32)" CPU_FLAGS_X86="sse2" 0 KiB
[ebuild     U ~] dev-lang/rust-1.47.0-r2:stable/1.47::gentoo [1.46.0:stable/1.46::gentoo] USE="clippy rustfmt system-bootstrap -debug (-doc) -libressl -miri -nightly -parallel-compiler -rls -system-llvm -test% -wasm" ABI_X86="(64) -32 (-x32)" CPU_FLAGS_X86="sse2" LLVM_TARGETS="(X86) -AArch64 -AMDGPU -ARM -AVR% -BPF -Hexagon -Lanai -MSP430 -Mips -NVPTX -PowerPC -RISCV -Sparc -SystemZ -WebAssembly -XCore" 0 KiB
[ebuild     U ~] virtual/rust-1.47.0::gentoo [1.46.0::gentoo] ABI_X86="(64) -32 (-x32)" 0 KiB

Total: 3 packages (2 upgrades, 1 new), Size of downloads: 0 KiB


so for some reason it pulls rust-bin-1.46.0, despite having rust-1.46.0 installed and available.


output of 

> emerge dev-lang/rust virtual/rust -pvud > emerge-rust-bin-debug.txt 2>&1

attached.
Comment 6 Georgy Yakovlev gentoo-dev 2020-11-26 20:37:48 UTC
depstring we are dealing here is

> ||
>   (
>     =dev-lang/rust-1.46*
>     =dev-lang/rust-bin-1.46*
>     =dev-lang/rust-1.47*
>     =dev-lang/rust-bin-1.47*
> )
Comment 7 Zac Medico gentoo-dev 2020-11-26 21:25:10 UTC
(In reply to Georgy Yakovlev from comment #5)
> Created attachment 675193 [details]
> emerge dev-lang/rust virtual/rust -pvud > emerge-rust-bin-debug.txt 2>&1
> 
> another weirdness

I've opened bug 756961 for this, and it looks like a misbehavior of this change related to bug 705986:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=ef66aab178180288132177011ad0e910fb2cd55e
Comment 8 Oskari Pirhonen 2020-11-27 03:59:40 UTC
(In reply to Georgy Yakovlev from comment #1)
> can you please send exact accept_keywords for rust you have. (including
> virtual if any)
> exact command you run
> 
> 
> and attach output of your 'emerge --<yourargs> -pvd'

Sure. The accept_keywords I have are

virtual/rust ~amd64
dev-lang/rust ~amd64


The exact command I ran was (expanded out through an function in my .bashrc and my EMERGE_DEFAULT_OPTS)

emerge --ask --verbose --ask-enter-invalid --update --deep --with-bdeps=y @world
Comment 9 Oskari Pirhonen 2020-11-27 04:01:30 UTC
Created attachment 675241 [details]
emerge debug output

Output of my emerge command with -pd appended
Comment 10 Zac Medico gentoo-dev 2020-11-27 05:00:43 UTC
(In reply to Oskari Pirhonen from comment #9)
> Created attachment 675241 [details]
> emerge debug output
> 
> Output of my emerge command with -pd appended

This looks like a similar problem to the log attached in comment #5. If you have masked dev-lang/rust-bin, then due to the issue described in bug 756961 it will fail with a circular dependency error and this suggestion:

It might be possible to break this cycle
by applying the following change:
- dev-lang/rust-1.48.0 (Change USE: -system-bootstrap)
Comment 11 Larry the Git Cow gentoo-dev 2020-11-28 20:52:20 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=b991f23ad915d1fc37088f11ca855c8c8374f5ae

commit b991f23ad915d1fc37088f11ca855c8c8374f5ae
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-11-28 01:57:14 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2020-11-28 20:50:13 +0000

    Allow a package to replace its own buildtime dependency
    
    If a package has a buildtime dependency on a previous version that
    it will replace, then do not treat it as a slot conflict. This
    solves inappropriate behavior for dev-lang/rust[system-bootstrap].
    
    This requires adjustments to package selection logic in several
    locations, in order to ensure that an installed package instance
    will be selected to satisfy a buildtime dependency when
    appropriate. Dependencies of the installed package will be
    entirely ignored, but that has already been the case when using
    installed package to break cycles, as discussed in bug 199856.
    
    Bug: https://bugs.gentoo.org/756793
    Bug: https://bugs.gentoo.org/756961
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/_emerge/depgraph.py                            | 68 +++++++++++++---
 lib/portage/dep/dep_check.py                       | 24 +++---
 .../tests/resolver/test_circular_choices_rust.py   | 94 ++++++++++++++++++++++
 3 files changed, 164 insertions(+), 22 deletions(-)
Comment 12 Larry the Git Cow gentoo-dev 2020-11-28 21:17:22 UTC
The bug has been referenced in the following commit(s):

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

commit d77f07243dac0d12e44d0b0c5e6ab79c76111809
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-11-28 21:10:27 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2020-11-28 21:17:14 +0000

    sys-apps/portage: Bump to version 3.0.11
    
     #756961 handle dev-lang/rust[system-bootstrap] dependency cycle
     #757306 backtracking: fix virtual choices for circular deps
    
    Bug: https://bugs.gentoo.org/756793
    Bug: https://bugs.gentoo.org/756961
    Bug: https://bugs.gentoo.org/757306
    Bug: https://bugs.gentoo.org/756028
    Package-Manager: Portage-3.0.11, Repoman-3.0.2
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 sys-apps/portage/Manifest              |   1 +
 sys-apps/portage/portage-3.0.11.ebuild | 267 +++++++++++++++++++++++++++++++++
 2 files changed, 268 insertions(+)
Comment 13 Georgy Yakovlev gentoo-dev 2020-11-29 19:17:39 UTC
Thanks Zac!

I confirm it behaves fine with portage-3.0.11

now to re-enable system-bootstrap I'll have to wait a bit before it goes stable and sits in the tree for a while.
Comment 14 Oskari Pirhonen 2020-11-29 23:53:27 UTC
Yup, I pulled in portage 3.0.11 and I can also confirm that it worked. The pre-existing rust 1.47 was used to build rust 1.48 with USE=system-bootstrap enabled. Which is great, because that lets me use "nightly" with -Zthreads=16 when building the compiler.

Thanks a bunch Zac!