-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add vtargetrun (run executables with qemu) and vcompletion (install helper for shell completions); use them in rustup and starship #22785
Conversation
I think |
I think this is fine, and it doesn't add too much complexity but I do think a revbump would be good - its not like rustup is a very heavy package. NB i am not sgn |
So, just to make sure I'm reading this right: This installs rustup as a dependency on cross builds, which might give out of date completions, if the package for the source architecture isn't already available. I think outdated/wrong completions are potentially worse than no completions. As an alternative approach, we could generate the as an INSTALL shell snippet. This would have the drawback of the completions files not being searchable with |
@jcgruenhage it wouldn't be out of date, because xbps-src will use the version of rustup that it can find in the git repo. If the x86_64 builders have already built it, it will download it, but there's a chance the aarch64 builder (for example) will build it by itself. It won't ever use an out of date version, though. The issue with a INSTALL snippet is that At this point, running the binary with qemu during the build step might make more sense. |
Ah right, that makes sense. Thanks for clearing this up. In that case, I agree that this solution is definitely the better way to solve it. |
Great! If we were generating outdated completions it would definitely suck :p |
@ericonr Use qemu-user-static is the better solutions +1 from my side. |
Ok, so I added |
In this case, I would be interested in adding an xlint for manual installation of shell completions as well. |
cb54f1e
to
48b88df
Compare
The title of this PR really should be changed, lol. How would the xlint work? I believe that that needs to go over in https://github.com/leahneukirchen/xtools, too (please do correct me if I am wrong). |
@fosslinux tried to do some renaming :p And yeah, xlint changes go in leah's repo. |
I'm getting
in the armv6l-musl build. There's a chance it's a broken package for that arch. Current rustup in my Pi:
The triple it complains about and the valid example it gives are the same, too, so it's kind of weird. |
It is indeed unsupported, they only ship |
I don't think that means that rustup should be unavailable for those architectures, it just means that there are no precompiled binaries for it. |
Isn't rustup pretty much useless without precombiled binaries? If you don't have cargo and rustc compiled for that architecture, there isn't anything for rustup to download. Also, current rustup doesn't even know that the |
Oh, I forgot that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, vcompletion is useful. I like cmd argument that unifies usage with all shells.
common/environment/setup/install.sh
Outdated
return 1 | ||
fi | ||
|
||
: "${file:=${cmd}.${shell}}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default value is specific for completions generated by these two packages. Currently most of completions are installed from some subdir, so maybe let's make file
first argument, like other vinstall based functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default value is specific for completions generated by these two packages. Currently most of completions are installed from some subdir, so maybe let's make
file
first argument, like other vinstall based functions.
Agree, then we could guess shell
from filename, and cmd
from pkgname
file="$1"
cmd="${2:-$pkgname}"
shell="${3:-${file##*.}}"
Should we guess cmd
part from file
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmd from pkgname
Sure, but then check for existing target file is needed to prevent overwriting by consecutive calls.
shell from filename
shell="${3:-${file##*.}}"
It would need to be more like *.fish => fish, *bash* => bash, _* => zsh, else error
to fit real world, which is too unpredictable and matching nothing too often imo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left the order as file shell command
, with only command being optional, since it can be taken from pkgname
. As @Chocimier said, guessing the shell from the filename will be a bit of a pain for little gain.
@Chocimier thanks, I will get around to fixing those! @fosslinux running something like
can bypass the issue, but I don't think anyone is going around downloading binaries for other archs in an armv6l device. I might just disable completion for that arch instead, for now. |
So, which are the platform triplets that void supports that rust doesn't ship cargo and rustc for? AFAICT it's these:
IIRC, shipping cargo and rustc for those platform triplets is just a matter of enabling it in their CI, since we can build cargo and rustc for those ourselves without problems. I can't see how ARM+musl is the same support wise as fuchsia and android on x86 (as in, you're only expected to compile for it, not on it). |
common/environment/setup/install.sh
Outdated
return 1 | ||
fi | ||
|
||
: "${file:=${cmd}.${shell}}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default value is specific for completions generated by these two packages. Currently most of completions are installed from some subdir, so maybe let's make
file
first argument, like other vinstall based functions.
Agree, then we could guess shell
from filename, and cmd
from pkgname
file="$1"
cmd="${2:-$pkgname}"
shell="${3:-${file##*.}}"
Should we guess cmd
part from file
as well?
Gotta wait for the llvm update to propagate, I guess. |
@ericonr tried aarch64-musl on my pinebook, it still breaks because the target is unavailable. I'd assume the same to be the case for armv7l-musl then. |
@jcgruenhage got it. Since it's not completely broken in any of those platforms and can be used to download for another arch, I say we should keep it. If you want to open an issue about it with upstream, we might be able to get them to ship more toolchains. |
The thing is, I'm not sure where exactly those issues should be opened. Otherwise, I'd already have done it. Might be worth coordinating with the alpine people though, since they're also doing musl on arm things. |
I wouldn't ask to enable Rust for armv6l, that thing is slow as hell. For armv7l and aarch64 it makes much more sense. I couldn't find where to ask that, either. |
They already have that when running on glibc though, so I don't see why they shouldn't enable it on musl libc too. There'll be that person that wants to compile something on a zerophone or something like that, and they'll be stuck without a compiler from rustup then, which IMO shouldn't be. |
Well, fair enough. They can take a rust learning course on their phone c: (they should really use the compiler we ship, though). Just need to find where to report this. |
@jcgruenhage according to folks on ##rust on IRC, a good place might be the rust repo. https://github.com/rust-lang/rust/issues I don't think this is a blocker for merging this, though. |
Def not a blocker just related. I'll contact the rustup maintainer at alpine to get which targets they're missing and open an issue upstream afterwards. |
Nevermind, alpine seems to only support rustup on x86. |
Rebased to remove conflicts. |
cd05974
to
4663597
Compare
@sgn, @Chocimier would you mind doing a final review? |
Manual.md
Outdated
@@ -963,7 +970,9 @@ additional paths to be searched when linking target binaries to be introspected. | |||
- `qemu` sets additional variables for the `cmake` and `meson` build styles to allow | |||
executing cross-compiled binaries inside qemu. | |||
It sets `CMAKE_CROSSCOMPILING_EMULATOR` for cmake and `exe_wrapper` for meson | |||
to `qemu-<target_arch>-static` and `QEMU_LD_PREFIX` to `XBPS_CROSS_BASE` | |||
to `qemu-<target_arch>-static` and `QEMU_LD_PREFIX` to `XBPS_CROSS_BASE`. | |||
It also creates the `vtargetrun` function to call the target architecture |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicks: the target architecture -> the target architecture's?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're going to reword, "[...] function to call the qemu-<arch>-static
executable for the target architecture." Possessive inanimate objects are weird.
Or maybe better, "[...] function to wrap commands in a call to qemu-<arch>-static
for the the target architecture."
@@ -13,19 +14,25 @@ homepage="https://www.rustup.rs" | |||
distfiles="https://github.com/rust-lang/${pkgname}/archive/${version}.tar.gz" | |||
checksum=ad46cc624f318a9493aa62fc9612a450564fe20ba93c689e0ad856bff3c64c5b | |||
|
|||
post_build() { | |||
# rustup errors out because it doesn't know about armv6l-musl | |||
if [ "$XBPS_TARGET_MACHINE" != armv6l-musl ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are a bunch more than just armv6l-musl. Going off https://forge.rust-lang.org/release/platform-support.html:
- armv5tel
- armv5tel-musl
- armv7l-musl (??)
- aarch64-musl (??)
- i686-musl
- mips* (we don't have glibc variants for mips)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, the problem here is that rustup
doesn't even know that armv6l-musl
exists, so it errors out with a rather cryptic error. For the others, we might not have upstream binaries, but rustup
knows about them and can work normally. I can try to build it for mips / armv5 to check those too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't go too crazy here. If you try building for archs that don't have binary packages, you are going to go crazy building a bunch of stuff just to get to the point where you can test your package. The main idea should be to prevent issues with trying to build official binary packages. If somebody wants to try building rustup for mips, let the user with the problem get involved with resolving any problems that shake out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, both good points
Install function for installing shell completions in the appropriate place according to the shell used.
It's a function to call the qemu executable for the target arch, or a noop if the build isn't a cross build.
Use qemu build_helper and vcompletion. Completion generation is broken for armv6l-musl due to rustup not knowing about the architecture.
Use qemu build_helper and vcompletion.
Ping? I am waiting on this one in order to update arduino-cli. |
Inspired by #22761 . Pinging @sgn
Not revbumping because I don't think it's urgent. I could see the case for making this procedure part of the cargo build style, configurable with some variable like
clap_completions=yes
.If you feel it adds too much complexity for little gain, I can close the PR.