Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding targets for packaged rust installations is very hacky #108819

Closed
yogo1212 opened this issue Mar 6, 2023 · 9 comments
Closed

Adding targets for packaged rust installations is very hacky #108819

yogo1212 opened this issue Mar 6, 2023 · 9 comments
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues.

Comments

@yogo1212
Copy link

yogo1212 commented Mar 6, 2023

Having installed rust through the package manager on Endeavour OS, adding targets like wasm32-unknown-unknown is very painful.

The compiler suggests the installation through rustup:

error[E0463]: can't find crate for `core`
  |
  = note: the `wasm32-unknown-unknown` target may not be installed
  = help: consider downloading the target with `rustup target add wasm32-unknown-unknown`

error[E0463]: can't find crate for `compiler_builtins`

But rustup is incompatible with the rust package.
Installing a target without rustup is apparently not documented publicly or at all intended.
The manual installation involves listing files on static.rust-lang.org, picking an appropriate version of rust-std, and extracting parts of the archive into the Rust installation dir.
The installation resides in /usr/include/rustlib/ so packaging is advised and then it really gets out of hand.

I don't suppose Rust will become easily packagable any time soon but it would be nice to integrate targets with cargo so they can be used with system installations more nicely.

@ChrisDenton
Copy link
Member

Hm, I think this is really up to the package maintainers. They could add additional targets options if they desired. But I guess they don't because they only have a rustc system package for the purposes of building rust applications for that system.

And I do not think rust should be messing with a system install either. That sounds like it may cause more problems than it solves. Fortunately rustup is aware of system rustc so can be used alongside it.

@yogo1212
Copy link
Author

yogo1212 commented Mar 6, 2023

@ChrisDenton Hello and thanks for your remark!
I'll have to check with Arch Linux then why they made the rustup package conflict with rust.

@ChrisDenton
Copy link
Member

Maybe because this wasn't always the case? Not sure. There's a documentation page on using a manual install of rustup with distribution managed rustc. It requires a little bit of setup but I'm not aware of any reason why a package maintainer couldn't do this for you. If there are any issues then these should probably be reported on https://github.com/rust-lang/rustup so the relevant team can look into it.

@workingjubilee
Copy link
Member

@yogo1212 Hello, I also use Arch Linux with a rustup installation (and I am a Rustup contributor). If you use the rustup package, you can use the latest stable rustc, managed by rustup, and have Rustup managed by pacman. Since Rustup takes care of itself when it's uninstalled, and pacman knows where to find Rustup, this means everything is ultimately still fully managed by the package manager. And from the perspective of the distro tools, such as build scripts, etc., essentially the difference is completely invisible. So you can replace the rust package with the rustup package just fine.

@yogo1212
Copy link
Author

yogo1212 commented Mar 7, 2023

i think i'll have to give up the idea of sharing the toolchain across users :-D

@ChrisDenton
Copy link
Member

Ah, sharing toolchains between users is not something that rustup currently supports. The closest we have is doing a manual install of the toolchains you want. But you'd still need to also add any cross-target libs you need.

@workingjubilee
Copy link
Member

Yes, it's very hard to reconcile "rustup allows you to install a toolchain without escalated privileges" with "you need superuser privileges to invoke the package manager" here. That sort of thing would probably need special support from the package manager, as well.

Honestly, it is fairly unreasonable for a package manager to fully support installing all of the 100 releases that Rustup supports installing.

@jyn514
Copy link
Member

jyn514 commented Apr 8, 2023

I'm going to close this as not a bug; support for multiple rustup users is tracked in rust-lang/rustup#313 and the Rust project can't control what targets Arch packages.

@jyn514 jyn514 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 8, 2023
@jyn514 jyn514 added the C-discussion Category: Discussion or questions that doesn't represent real issues. label Apr 8, 2023
@Kreijstal
Copy link

are there like user packages that add targets?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues.
Projects
None yet
Development

No branches or pull requests

5 participants