As of now, the installation of 'rust-bin' does not include the installation of rust source code. This is a hindrance in some cases, such as usage of rust-analyzer, which needs the source code to work correctly. I suggest rust-bin can come with an optional USE flag 'src', to include rust source code alongside the pre-built binaries, without having to use dev-lang/rust. I post this since I have been stuck with the following error message while attempting to use 'rust-analyzer' : rust-analyzer failed to load workspace: Failed to find sysroot for Cargo.toml file <censored>/Cargo.toml. Is rust-src installed?: can't load standard library from sysroot /opt/rust-bin-1.55.0 (discovered via `rustc --print sysroot`) try installing the Rust source the same way you installed rustc I have gone to them and have gotten confirmation that this is not a rust-analyzer issue, but a rust installation one. I have searched the specified sysroot and have found no source files, even when installing using the rls use flag. Finally, using dev-lang/rust this error does not occur.
Upon further search, it should be a 'source' flag, as more packages use that name.
*** Bug 822297 has been marked as a duplicate of this bug. ***
I will see if it's possible to add it. what's ugly about src component is tarball comes from a date-prefixed url > curl https://static.rust-lang.org/dist/channel-rust-stable.toml | grep "xz_url.*rust-src" https://static.rust-lang.org/dist/2021-11-01/rust-src-1.56.1.tar.xz Currently I don't know a way to programmatically predict it or get url of an old release. just installing source tarball from github is not what we want, we need the tarball linked above.
I found the follow way of reliably extracting the "rust-src" download url from `static.rust-lang.org`. Seems to work with any release version, stable and nightly: > curl -L static.rust-lang.org/dist/channel-rust-${PV}.toml 2>/dev/null | grep "xz_url.*rust-src" For example, to get the xz_url for rust-src from release 1.22.0: > curl -L static.rust-lang.org/dist/channel-rust-1.22.0.toml 2>/dev/null | grep "xz_url.*rust-src" Might I suggest calling the proposed USE flag `rust-src`, as it is a Rust component. Just as there already exists USE flags for the Rust components `clippy`, `rls` and `rustfmt`, to be consistent with the USE flag convention already in place for these ebuilds, I think it make sense if this flag named after the Rust component it includes, `rust-src`. Med vänliga hälsningar, Mikael Henriksson
thanks for that! that's good enough. I'll poke it as I get more time. another problem to solve is rust-src component comes with it's own installer, we need to run main installer and src installer, or maybe join the installers. idk how they interact yet or overwrite files or not.
(In reply to Georgy Yakovlev from comment #5) > thanks for that! that's good enough. > > I'll poke it as I get more time. > another problem to solve is rust-src component comes with it's own > installer, we need to run main installer and src installer, or maybe join > the installers. idk how they interact yet or overwrite files or not. Tell me if there is something I can do to help. In the mean time I'll see if I can find out how rust-src is installed with Rustup and try to make a mookup ebuild replicating the behaviour.
Created attachment 750240 [details] Ebuild with added support for USE flag 'rust-src'
Created attachment 750243 [details, diff] Diff for proposed Ebuild
I've attached an Ebuild for rust-bin-1.56.1, with diff between it and original ebuild, which I've used to successfully install rust-bin-1.56.1 with the Rust component `rust-src` on my system. It is still lacking in that it uses hardcoded uri of the rust-src tarball in the SRC_URI variable, this due to the annoying date stamp in the upstream source url. I don't know how to get Ebuild + Manifest working together without hardcoding the SRC_URI variable. This is of-course tedious as the package-maintainer of rust-bin would have to manually update the link in SRC_URI each time a new version of rust is released. Anyway, I hope this can come to some help. Med vänliga hälsningar, Mikael Henriksson
thanks I test once I have a spare minute. my main interest is what happens to installed files after 2 installers run. there are some MANIFESTS and other files. does it merge it or replaces file? Basically I'll be looking at diff of the installation image, what changes besides addition of src component directory itself. if you wanna dig it - feel free to, help is always appreciated. that's just my plan and I'll do it anyways.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=144bf206556b77df750f5c79917d9dc8c4322242 commit 144bf206556b77df750f5c79917d9dc8c4322242 Author: Georgy Yakovlev <gyakovlev@gentoo.org> AuthorDate: 2021-11-12 19:37:22 +0000 Commit: Georgy Yakovlev <gyakovlev@gentoo.org> CommitDate: 2021-11-12 19:41:11 +0000 dev-lang/rust-bin: add rust-src useflag This is useful for many developer tools and for build-std too. linux-next rust code also requires this to be installed. Bug: https://bugs.gentoo.org/800785 Bug: https://bugs.gentoo.org/819786 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org> dev-lang/rust-bin/Manifest | 1 + dev-lang/rust-bin/metadata.xml | 1 + dev-lang/rust-bin/rust-bin-1.56.1.ebuild | 30 ++++++++++++++++++++++++++---- 3 files changed, 28 insertions(+), 4 deletions(-)
found a better way of installing it. basically I just combine installers, adding src component to original installer and use single installer invocation. will probably add a bit of sanity-check, like comparing 'git-commit-hash' file in both installers to match.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d2e9fc2c57ca98303914d5632c20edce74f846a6 commit d2e9fc2c57ca98303914d5632c20edce74f846a6 Author: Georgy Yakovlev <gyakovlev@gentoo.org> AuthorDate: 2021-11-12 19:56:17 +0000 Commit: Georgy Yakovlev <gyakovlev@gentoo.org> CommitDate: 2021-11-12 20:01:35 +0000 dev-lang/rust: add rust-src useflag previously 'src' component was installed by 'rls' useflag. let's split it out for people who want 'src' but don't need rls. Bug: https://bugs.gentoo.org/800785 Bug: https://bugs.gentoo.org/819786 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org> dev-lang/rust/metadata.xml | 1 + dev-lang/rust/rust-1.56.1.ebuild | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-)
I believe this can be closed. no plans on backporting to versions prior to 1.56.1 as they'll be gone in about a month.