-
-
Notifications
You must be signed in to change notification settings - Fork 259
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
feature sha1/asm
is enabled on windows
#917
Comments
Thanks a lot for letting me know! Is this something you would feel comfortable to contribute? It seems like this project's CI is missing that environment or configuration. I will also take a stab at it and at least try to get a reproduction on this project's CI, from there fixing it should get easier. |
Yes, I will have a try once I have time. |
To be honest, I think this might be a upstream bug. Given that |
I think we can workaround this by doing not(target = "x86_64-windows-msvc"), not(target = "aarch64-windows-msvc") instead of not(target_env = "msvc") given that sha1/asm only supports arm 64 and x86 anyway. But that will require quite a list of targets since there are many x86 targets (i686, i484) |
What I don't understand about this is that as per the [target.'cfg(all(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64"), not(target_env = "msvc")))'.dependencies]
sha1 = { version = "0.10.0", optional = true, features = ["asm"] } Clearly, To me this looks like something My recommendation, in the meantime, is to use Some other strangeness is that CI already builds that platform - it will install the When looking at the Maybe an avenue would be to understand why my CI seems to work on that environment, whereas the one at |
Yeah I think this could be a bug in cargo.
I agree, though I would probably still turns on flate2/zlib-ng since in cargo-bins/cargo-binstall#1184 we turned on support for custom registry and test it by pulling the crates.io git index. It took much longer than I'd imagine, on my M1 it took at least 2m and on CI it took 11m. |
Yeah that's really strange, because our CI also build binstall in debug and release and they both failed.
Yeah, I will have another look at it once I'm free, it's really really strange. |
You mean shallow cloning took 2m and 11m respectively? It should be much faster, even without
Above it shows that |
Yes, I think it could be because the test is run in debug mode. Even in release, cargo-binstall is compiled using O2, so a better option might be to always compile gix and its dependencies with O3, probably more reliable than max-performance. |
Yeah setting:
speedup the cloning to 2m. |
Building gix directly with:
always succeed in dev and release mode, with or without But somehow when building from |
Running
But doing the same in
|
Maybe there is a way to narrow down the cause of this by adding |
I am trying to do this, but it's really hard to setup env on windows. Specifically, I have problem installing |
That's interesting, I thought such an environment is already available on the CI of I also failed to setup the microsoft toolchain, and just barely got my own VM to work with the GNU toolchain, if that's somehow related. In any case, I wouldn't be able to help here :/. |
Yeah I could just use the Github Action for this. |
I was able to reproduce it on my arch64 windows by running
(in additional to failure to build |
This error I got on my aarch64 windows is very similar to our CI, it failed at link-time after Looking at the
It should pass just a name instead and msvc would deal with that:
|
Thanks so much for pushing forward on the resolution for this issue, I appreciate it! Being able to reproduce it locally makes a fix possible! I never managed to get a VM that has MSVC installed (and I tried), it never worked with Rust and I thought the whole process is insane.
It's certainly worth fixing that as it may help to make it build better in general, but I have some doubts that it's going to make a difference as the problem is that it tries to use these ASM files at all. As far as I know, they don't exist for all platforms and builds should never be attempted, falling into the realm of cargo features. I absolute hope I am misunderstanding this though, it would be great if the attached PR could fix this. Let me again thank you for your efforts and apologize for just cheering you on from the side-lines. I think once this issue is fixed for |
Thanks for your help with this! I remember that I tried to reduce the amount of checkboxes on the right to safe space, but maybe that's the cause of my trouble in the first place. Could you also tell me how you get a development shell that also includes git? I think that might also have been the reason it never worked out for me - either I have git, or the MS tool suite, but not both (maybe). Thanks again |
I uses "Git Bash", downloaded from https://git-scm.com/download/win |
I also installed strawberry perl for |
It's so interesting that these compiler tools are visible in a standard |
Yeah it look like an env with patched bash and there're a few catch with it:
BTW, the windows CI on GHA demonstrates the same behaviour, so I suppose they might be also using the Git Bash. |
Did anything change now that #1007 is merged? To me it looks like it all should work now, but I am definitely not sure. Thanks for chiming in. |
Thanks, I will try it again in cargo-binstall later |
The current upstream fix in place throws a blanket compile error on all windows targets, rather than just with MSVC. This causes MSYS2/{MingW,Clang}-{32,64} environments to fail the build, despite not even touching the compiler that breaks the build. This is currently also preventing builds of dependents (such as starship in my case). I'll also open an issue over at the asm-hashes repo, but this should be noted so it can (temporarily) be disabled as dep in gix-features as well. Scratch that, turns out it doesn't produce correct results on Windows regardless of the toolchain |
Just to keep note, I ran into the issue described above and quick-fixed it by building the pure Rust version of An actual fix would now be in order to prevent the asm hashes to be enabled on Windows at all, something that would have to happen in the I am planning to create a new release today or tomorrow and definitely hope to get this issue fixed there as well. |
The new release to fix this issue could simply change the That said, I wonder why no attention was paid to explicit warnings, or why it wasn't made opt-in (or out) instead. Perhaps an oversight or forgetting Windows is the special kid on the block? Looking at the upstream RustCrypto/hashes repo it seems like the current release candidate is removing the feature entirely so this should not be a problem in the near future. I've run into this before, and the easiest workaround is building with MSVC, but special-casing a few builds because of a mismatch in cfg directives just feels off to me. |
Is this one-line change something you could contribute (and ideally verify)? It seems a build-test is missing on Windows as well that could catch this, as right now the only time MSVC is built is during installation (which was neutered in 52f203a). I am quite afraid of meddling with this as I remember it as quite painful to deal with, over time, so any help here is greatly appreciated. |
Thanks so much! I will apply this change right away. As for the compile-errors, I actually don't know what CI does differently. It all relies on lock-files, of course, but from what I can tell you did the same. It's a good hint at updating those dependencies before making a release.
I didn't plan to upgrade as the new version seems to be slower in my tests, I don't think it has assembly anymore. |
It seems to be using SHA hardware capabilities available on all consumer CPUs since Intel Goldmont(E-cores)/Ice Lake(normal cores) or AMD Zen1. Is the performance hit there as well, or only on older systems? Would be interesting if manual ASM was faster than a dedicated impl |
Maybe I am just unlucky as I tested it on M1 only - there it was definitely slower, and too slow for Probably over time that will change. Maybe there should be more conditional compilation at some point, using the ASM version on MacOS and the latest one on other platforms. |
Duplicates
Current behavior 😯
Compiling on windows failed failed with errors from
sha1-asm
, which is known in RustCrypto/asm-hashes#17 and should be migrated bygix-features
by disablingsha1/asm
on windows:Expected behavior 🤔
Build should succeed.
Steps to reproduce 🕹
Compiling
gix
on x64/arm windows with featuresmax-performance
enabled.The text was updated successfully, but these errors were encountered: