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

Write Windows batch script version of 'miri' script? #1229

Closed
JOE1994 opened this issue Mar 14, 2020 · 10 comments
Closed

Write Windows batch script version of 'miri' script? #1229

JOE1994 opened this issue Mar 14, 2020 · 10 comments
Labels
A-meta Not about any part of Miri per se, but about shaping the environment to make something in/with Miri A-windows Area: affects only Windows targets C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement

Comments

@JOE1994
Copy link
Contributor

JOE1994 commented Mar 14, 2020

With my Windows PC, I've been running the miri bash script by running
ex. sh miri run tests/run-pass/env.rs.

It's been working because I had Git for Windows installed (which comes with bash.exe & sh.exe)
and I had the sh.exe added in my Path.

Running cargo miri works in Windows, but the miri bash script itself does not work out-of-the-box in Windows. The current method I'm using is more of a workaround, rather than proper support for Windows developers.

I think it'd be nice to have a batch script version of miri script that Windows users can use out-of-the-box, without workarounds.

p.s. if there is already proper support for Windows users to run the miri script, please let me know 😉

@RalfJung RalfJung added A-meta Not about any part of Miri per se, but about shaping the environment to make something in/with Miri A-windows Area: affects only Windows targets C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement labels Mar 15, 2020
@RalfJung
Copy link
Member

RalfJung commented Mar 15, 2020

I should preface that I have not done any development on Windows for at least 15 years, so I have no idea at all what is considered a normal development environment on that platform.^^

That said, if there is a way to use the shell script we have, that seems like the best option to me. That shell script is maintained as Miri changes, and it is used by our CI, so it should just always work. Sharing code across platforms is better than re-writing things for each platform. Currently, Windows CI (via AppVeyor) does not use it; if you could help use it there that would be great. :D

I suspect most devs will have git installed on their Windows box so your method will work for them?

However, if you want to submit and maintain a Windows variant of that script, I'll happily review those patches. I just want to avoid having an outdated Windows-only script in the repository that nobody in the Miri team can fix or test.

@eddyb
Copy link
Member

eddyb commented Mar 15, 2020

Why is there a script? Rust executables are far more portable.
Anyway, if you wanted a Windows equivalent, you'd probably use PowerShell.
"Batch files" are woefully outdated and underpowered.

@RalfJung
Copy link
Member

RalfJung commented Mar 15, 2020

@eddyb well go read it yourself if you want to know what it does. ;)

Note that the rustup distribution contains no script. The script is just for development. It handles building the Miri sysroot (usually done by cargo-miri, but during development you often want to work directly with the miri driver), working around rust-lang/rust#58343, things like that.

@eddyb
Copy link
Member

eddyb commented Mar 15, 2020

@eddyb well go read it yourself if you want to know what it does. ;)

I have, it looks like the kind of thing a Rust project would write in Rust :P.

Note that the rustup distribution contains no script.

Okay so this isn't as bad as it could be.

@RalfJung
Copy link
Member

it looks like the kind of thing a Rust project would write in Rust :P.

Fair. ;) I'm somehow still reaching for shell/Python first for such things...

It's not entirely trivial though, since this sets flags for the build it would have to at least be an entirely separate crate from the main thing. And workspaces always seemed too complicated for me...^^

@eddyb
Copy link
Member

eddyb commented Mar 15, 2020

And workspaces always seemed too complicated for me...^^

Every cargo package is at most one lib crate and any number of bin crates, so you wouldn't need a workspace probably - or wait, whoops, do you mean it'd need to be a separate package?

@RalfJung
Copy link
Member

do you mean it'd need to be a separate package?

Yes. In particular it should have an independent set of dependencies. After all this sets RUSTFLAGS for the main compilation.

Now, moving to a workspace would also help with #418, but still... so far I couldn't be bothered.^^

@JOE1994
Copy link
Contributor Author

JOE1994 commented Mar 16, 2020

That said, if there is a way to use the shell script we have, that seems like the best option to me. That shell script is maintained as Miri changes, and it is used by our CI, so it should just always work. Sharing code across platforms is better than re-writing things for each platform.

I agree with your point 😺

I've just learned that the Windows Build environment of Travis CI also uses Git Bash to run builds.
I guess there isn't much motivation to write and maintain a separate batch script.

Adding a single line - windows to .travis.yml should probably suffice to make Travis CI test the build in its Windows Build environment.

miri/.travis.yml

Lines 10 to 12 in acdddc7

os:
- linux
- osx

Thank you for your feedback! I'm closing the issue now 😅

@JOE1994 JOE1994 closed this as completed Mar 16, 2020
@RalfJung
Copy link
Member

We've experimented with using Travis for Windows CI in the past and it didn't really work. Maybe it got better since then.

@RalfJung
Copy link
Member

RalfJung commented May 12, 2020

With #1407, we are now using bash miri for our Windows CI, and it actually Just Works (TM). So this should also be an option for developing on Windows (since bash comes with git, I assume most developers will have it available).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-meta Not about any part of Miri per se, but about shaping the environment to make something in/with Miri A-windows Area: affects only Windows targets C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement
Projects
None yet
Development

No branches or pull requests

3 participants