Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 662842

Summary: dev-lang/rust-bin[cargo] - symlink to cargo cannot be found by firefox configure script
Product: Gentoo Linux Reporter: tt_1 <herrtimson>
Component: Current packagesAssignee: Gentoo Rust Project <rust>
Status: RESOLVED FIXED    
Severity: normal CC: djc
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: output from equery f rust-bin

Description tt_1 2018-08-05 12:49:39 UTC
The firefox configure script looks for cargo at /usr/bin/cargo, so it cannot find the current value of /usr/bin/${cargo}. If you have to have a cargo binary with the value of ${cargo} for some reasons, please add a second symlink pointing straight to /usr/bin/cargo. 

If that's not possible, please leave a note here so that someone can talk to firefox devs to upgrade their config scripts. Thanks!
Comment 1 Dirkjan Ochtman (RETIRED) gentoo-dev 2018-08-05 12:57:23 UTC
Ah, sorry -- this needs to have the tool paths (cargo, rustfmt, cargo-fmt) added to the provider file, similar to how the dev-lang/rust build does it. Would you mind adding that and testing it?
Comment 2 tt_1 2018-08-05 13:00:40 UTC
I'm not familiar with the dev-lang/rust ebuilds, but you can attach a patch for rust-bin[cargo], which I can test.
Comment 3 Dirkjan Ochtman (RETIRED) gentoo-dev 2018-08-05 13:41:09 UTC
Try with this:

diff --git a/dev-lang/rust-bin/rust-bin-1.28.0.ebuild b/dev-lang/rust-bin/rust-bin-1.28.0.ebuild
index 53d2d4e87eb..c027297ae9c 100644
--- a/dev-lang/rust-bin/rust-bin-1.28.0.ebuild
+++ b/dev-lang/rust-bin/rust-bin-1.28.0.ebuild
@@ -112,7 +112,15 @@ src_install() {
 	cat <<-EOF > "${T}/provider-${P}"
 	/usr/bin/rustdoc
 	/usr/bin/rust-gdb
+	/usr/bin/rust-lldb
 	EOF
+	if use cargo; then
+		echo /usr/bin/cargo >> "${T}/provider-${P}"
+	fi
+	if use rustfmt; then
+		echo /usr/bin/rustfmt >> "${T}/provider-${P}"
+		echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
+	fi
 	dodir /etc/env.d/rust
 	insinto /etc/env.d/rust
 	doins "${T}/provider-${P}"
Comment 4 tt_1 2018-08-05 14:19:16 UTC
Created attachment 542482 [details]
output from equery f rust-bin

That doesn't work, here is the filelist:

/opt/rust-bin-1.28.0/bin/cargo-1.28.0 symlinks to /usr/bin/cargo-1.28.0, but should be /usr/bin/cargo, or maybe both of them?
Comment 5 tt_1 2018-08-05 15:33:00 UTC
Maybe you'll first have to move rust-lldb into the apropiate folders, just as rust-bin is doing with ${rustc}, ${rustdoc}, etc. pp, before you can use it to provide something?

In the end firefox wants to see /usr/bin/rustc and /usr/bin/cargo , it is not important wether that is an actual binary or a symlink.
Comment 6 Doug Goldstein (RETIRED) gentoo-dev 2018-08-05 21:40:43 UTC
(In reply to Dirkjan Ochtman from comment #3)
> Try with this:
> 
> diff --git a/dev-lang/rust-bin/rust-bin-1.28.0.ebuild
> b/dev-lang/rust-bin/rust-bin-1.28.0.ebuild
> index 53d2d4e87eb..c027297ae9c 100644
> --- a/dev-lang/rust-bin/rust-bin-1.28.0.ebuild
> +++ b/dev-lang/rust-bin/rust-bin-1.28.0.ebuild
> @@ -112,7 +112,15 @@ src_install() {
>  	cat <<-EOF > "${T}/provider-${P}"
>  	/usr/bin/rustdoc
>  	/usr/bin/rust-gdb
> +	/usr/bin/rust-lldb
>  	EOF
> +	if use cargo; then
> +		echo /usr/bin/cargo >> "${T}/provider-${P}"
> +	fi
> +	if use rustfmt; then
> +		echo /usr/bin/rustfmt >> "${T}/provider-${P}"
> +		echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
> +	fi
>  	dodir /etc/env.d/rust
>  	insinto /etc/env.d/rust
>  	doins "${T}/provider-${P}"

Let's get this added to the tree. I'd honestly like to see us get either a 1.26.2 or 1.28.0 stable with this. 1.25 isn't a great target. I suggest 1.26.2 since a few other distros are pulling that version in.
Comment 7 tt_1 2018-08-05 22:16:32 UTC
ok, now that I understand more what the patch intends - I can confirm that it adds /usr/bin/cargo to the file /etc/env.d/rust/provider-rust-bin-1.26.2

but that doesn't solve the config bug for firefox, where the config looks for /usr/bin/cargo 

 0:14.55 checking for rustc... /usr/bin/rustc
 0:14.55 checking for cargo... not found
 0:14.66 checking rustc version... 1.28.0
 0:14.66 ERROR: Cargo package manager not found.
 0:14.66 To compile Rust language sources, you must have 'cargo' in your path.
 0:14.66 See https://www.rust-lang.org/ for more information.
 0:14.66 
 0:14.66 You can install cargo by running './mach bootstrap'
 0:14.66 or by directly running the installer from https://rustup.rs/
 0:14.66 
 0:14.71 *** Fix above errors and then restart with\
 0:14.71                "/usr/bin/gmake -f client.mk build"
 0:14.71 gmake: *** [client.mk:149: configure] Error 1


ln -s /usr/bin/cargo-1.28.0 /usr/bin/cargo solves it.
Comment 8 tt_1 2018-08-06 12:34:00 UTC
The /usr/bin/cargo symlink does exist for the case of dev-lang/rust-1.28.0[cargo], even though 'equery f rust | grep cargo' doesn't list the symlink (but 'equery b /usr/bin/cargo' lists 'dev-lang/rust-1.28.0' as its owner).
Comment 9 Dirkjan Ochtman (RETIRED) gentoo-dev 2018-08-07 08:20:48 UTC
Try this?

diff --git a/dev-lang/rust-bin/rust-bin-1.28.0.ebuild b/dev-lang/rust-bin/rust-bin-1.28.0.ebuild
index 53d2d4e87eb..ab76012ace0 100644
--- a/dev-lang/rust-bin/rust-bin-1.28.0.ebuild
+++ b/dev-lang/rust-bin/rust-bin-1.28.0.ebuild
@@ -80,23 +80,26 @@ src_install() {
 	local rustc=rustc-bin-${PV}
 	local rustdoc=rustdoc-bin-${PV}
 	local rustgdb=rust-gdb-bin-${PV}
+	local rustlldb=rust-lldb-bin-${PV}
 
 	mv "${D}/opt/${P}/bin/rustc" "${D}/opt/${P}/bin/${rustc}" || die
 	mv "${D}/opt/${P}/bin/rustdoc" "${D}/opt/${P}/bin/${rustdoc}" || die
 	mv "${D}/opt/${P}/bin/rust-gdb" "${D}/opt/${P}/bin/${rustgdb}" || die
+	mv "${D}/opt/${P}/bin/rust-lldb" "${D}/opt/${P}/bin/${rustlldb}" || die
 
 	dosym "../../opt/${P}/bin/${rustc}" "/usr/bin/${rustc}"
 	dosym "../../opt/${P}/bin/${rustdoc}" "/usr/bin/${rustdoc}"
 	dosym "../../opt/${P}/bin/${rustgdb}" "/usr/bin/${rustgdb}"
+	dosym "../../opt/${P}/bin/${rustlldb}" "/usr/bin/${rustlldb}"
 
 	if use cargo; then
-		local cargo=cargo-${PV}
+		local cargo=cargo-bin-${PV}
 		mv "${D}/opt/${P}/bin/cargo" "${D}/opt/${P}/bin/${cargo}" || die
 		dosym "../../opt/${P}/bin/${cargo}" "/usr/bin/${cargo}"
 	fi
 	if use rustfmt; then
-		local rustfmt=rustfmt-${PV}
-		local cargo_fmt=cargo-fmt-${PV}
+		local rustfmt=rustfmt-bin-${PV}
+		local cargo_fmt=cargo-fmt-bin-${PV}
 		mv "${D}/opt/${P}/bin/rustfmt" "${D}/opt/${P}/bin/${rustfmt}" || die
 		mv "${D}/opt/${P}/bin/cargo-fmt" "${D}/opt/${P}/bin/${cargo_fmt}" || die
 		dosym "../../opt/${P}/bin/${rustfmt}" "/usr/bin/${rustfmt}"
@@ -112,7 +115,15 @@ src_install() {
 	cat <<-EOF > "${T}/provider-${P}"
 	/usr/bin/rustdoc
 	/usr/bin/rust-gdb
+	/usr/bin/rust-lldb
 	EOF
+	if use cargo; then
+		echo /usr/bin/cargo >> "${T}/provider-${P}"
+	fi
+	if use rustfmt; then
+		echo /usr/bin/rustfmt >> "${T}/provider-${P}"
+		echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
+	fi
 	dodir /etc/env.d/rust
 	insinto /etc/env.d/rust
 	doins "${T}/provider-${P}"
Comment 10 tt_1 2018-08-07 12:19:24 UTC
with the new patch, this is looking pretty good: 

equery f rust-bin | grep cargo

/opt/rust-bin-1.28.0/bin/cargo-bin-1.28.0
/usr/bin/cargo-bin-1.28.0

 0:08.43 checking for rustc... /usr/bin/rustc
 0:08.43 checking for cargo... /usr/bin/cargo
 0:08.47 checking rustc version... 1.28.0
 0:08.51 checking cargo version... 1.28.0


/usr/bin/cargo is present, not listed in equery f rust-bin, but equery b /usr/bin/cargo shows: 'dev-lang/rust-bin-1.28.0 (/opt/rust-bin-1.28.0/bin/cargo-bin-1.28.0)'

the cargo symlink is removed if rust-bin is removed - this is good to go.

But could you please give me an idea of what happens here? emerge sets a symlink through env-update?
Comment 11 Dirkjan Ochtman (RETIRED) gentoo-dev 2018-08-07 12:42:00 UTC
Have a look at this file:

https://github.com/jauhien/eselect-rust/blob/master/src/modules/rust.eselect
Comment 12 tt_1 2018-08-07 13:17:01 UTC
Just noticed this - the symlinks with the patch are /usr/bin/cargo and /usr/bin/cargo-${cargo_version}, where ${cargo_version} is the same number as the rust ebuild. This is not true for point releases, where rustc is version 1.26.2 but cargo is still 1.26.0. 

No idea wether this is an actual problem?
Comment 13 Dirkjan Ochtman (RETIRED) gentoo-dev 2018-08-08 13:10:03 UTC
I think you got that wrong -- in the code path we're talking about here, it's the cargo that gets installed from the rust ebuild. So the version number is not actually the cargo version, it's more like the Rust distribution version that the cargo is part of. I don't think it will cause issues.
Comment 14 Larry the Git Cow gentoo-dev 2018-08-08 13:30:03 UTC
The bug has been closed via the following commit(s):

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

commit 598ec1ea3e6164061dea2f0f6d5ff4a7b74e3a50
Author:     Dirkjan Ochtman <djc@gentoo.org>
AuthorDate: 2018-08-08 13:19:36 +0000
Commit:     Dirkjan Ochtman <djc@gentoo.org>
CommitDate: 2018-08-08 13:29:51 +0000

    dev-lang/rust-bin: add run-time Cargo deps, fix eselect provider
    
    Closes: https://bugs.gentoo.org/662842
    Closes: https://bugs.gentoo.org/662932
    Package-Manager: Portage-2.3.40, Repoman-2.3.9

 dev-lang/rust-bin/rust-bin-1.28.0-r1.ebuild | 161 ++++++++++++++++++++++++++++
 1 file changed, 161 insertions(+)