MSVC 2022
Opened this issue · 3 comments
I already have MSVC 2022 and Git for Windows installed. According to Microsoft, MSVC 2015 through 2022 are binary compatible, so it should be possible for the installer to use the already installed MSVC 2022 instead. However, I did not find any option to configure this behaviour; the installer starts by automatically installing MSVC 2019 without any prompt. Is there a workaround for this?
Git for Windows should automatically be detected and skipped, as long as it is recent enough and in the PATH. That logic is here: https://github.com/diskuv/dkml-component-ocamlcompiler/blob/34895c257a3bf98fb469696b0b22132f5ae80b73/assets/staging-files/win32/setup-userprofile.ps1#L541-L656
MSVC is not binary compatible. OCaml is not a plain C/C++ program but a compiler. It uses the assembler extensively, patches DLL files and lots of other tricks. I've encountered too many problems with specific versions of MSVC (even within MSVC 2019), and I don't have the infrastructure to test which work and which don't. However, the versions that are tested are automatically skipped. The precise logic for how MSVC is checked for compatibility, and one historical example of a MSVC incompatibility, is in https://github.com/diskuv/dkml-runtime-distribution/blob/8bd318b33ac2ef06a20a24d480362f1e128607ac/src/windows/Machine/Machine.psm1
I don't mind keeping this (some version of MSVC 2022) open at low-priority as a feature request.
Thanks for the detailed explanation. I did not know that the OCaml compiler need to mess with assembler and DLL files. That's a very unfortunate fact to know about, considering especially how much disk space a MSVC installation would take. Having an MSVC, two versions of rustc, and two versions of GHC already installed, I think I'm currently running low on my disk space budget. 😂
Is it possible to manually specify the path for the installation (for both MSVC 2019 and DKML)? (And would that be easier to achieve than having the release be compatible with MSVC 2022?) That would also partly solve my problem because I can try and install those on my external hard drive.
Custom MSVC path
Oh yes, you can definitely pre-install MSVC 2019 on your external drive. Example: When DkML runs in GitLab and GitHub, it does not re-install MSVC ... it just uses what is already there.
Just make sure you have the exact components that DkML needs. Do Method 2 of https://diskuv.com/dkmlbook/windows_admin_install/
DkML
You will need the 2.0.2 preview to do a custom path installation. Download the Native 64-bit installer from https://gitlab.com/dkml/distributions/dkml/-/releases/2.0.2, and then you will need to run it from the command line.
There are options; you can use the --help
option to see them. I believe the one you need is --prefix D:\dkml
where "D:" (etc.) is your external drive.