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

[windows] opam hints to use eval after install #5644

Closed
Alizter opened this issue Aug 24, 2023 · 24 comments · Fixed by #5797
Closed

[windows] opam hints to use eval after install #5644

Alizter opened this issue Aug 24, 2023 · 24 comments · Fixed by #5797

Comments

@Alizter
Copy link

Alizter commented Aug 24, 2023

I was using opam on windows with dkml and noticed that opam switch would correctly write the windows version of eval $(opam env) however the hint you get after installing a package still stayed the unix version.

@rjbou rjbou added this to the 2.2.0~alpha3 milestone Aug 28, 2023
@rjbou
Copy link
Collaborator

rjbou commented Aug 28, 2023

Which version of opam do you have ?
Here is the output in cmd with opam 2.2.0~alpha2
Untitled

@Alizter
Copy link
Author

Alizter commented Aug 28, 2023

Maybe this was fixed recently:
image

@kit-ty-kate
Copy link
Member

Which terminal are you using? cmd.exe or something else?

@Alizter
Copy link
Author

Alizter commented Aug 29, 2023

This is windows terminal which I believe runs PowerShell.

@kit-ty-kate
Copy link
Member

I just tried locally and there is definitely something funky going on with Windows Terminal.
On my machine running opam.exe will raise an Invalid_argument("Filename.chop_prefix") coming from

(shell_of_string (Filename.chop_suffix name ".exe"))

Looking at the values returned by OPAMW_GetProcessAncestry I get, in order:

opam.exe
windowsterminal.exe
sihost.exe
.
.
.

the obvious cause are the three last elements of the list "." but I'm not versed in Windows API enough to understand what's going on.

cc @jonahbeckford @dra27 do you have any idea?

@Alizter
Copy link
Author

Alizter commented Aug 29, 2023

In the windows terminal, you do not need to give the .exe extension. I'm not sure if that makes a difference. This is a feature of PowerShell.

@kit-ty-kate
Copy link
Member

In the windows terminal, you do not need to give the .exe extension. I'm not sure if that makes a difference. This is a feature of PowerShell.

i tried it already but it does not make a difference. The issue is the last three "." elements in my case. I think in yours it somehow succeeded but didn't manage to detect Powershell either and defaulted on sh. I'm not sure how it did that though. Do you have the SHELL environment variable set by any chance?

@Alizter
Copy link
Author

Alizter commented Aug 29, 2023

Well I am running all this with with-dkml so that probably makes a difference?

@jonahbeckford
Copy link
Contributor

Sounds like two issues.

First is what was originally reported. The display of Unix eval $(opam env) does not surprise me. The detection logic is heuristics which, by definition, was never 100%; the PR #4816 had it as "reasonable first cut". Of course it is possible there is a regression somewhere, so @Alizter does your output resemble one of the 3 test cases in that PR?

Second is what @kit-ty-kate reported. And I have no clue why dots would be appearing!

@Alizter
Copy link
Author

Alizter commented Aug 29, 2023

@jonahbeckford So I get the powershell case but only after opam switch. It doesn't appear with opam install.

@rjbou
Copy link
Collaborator

rjbou commented Nov 2, 2023

I just tried locally and there is definitely something funky going on with Windows Terminal. On my machine running opam.exe will raise an Invalid_argument("Filename.chop_prefix") coming from

(shell_of_string (Filename.chop_suffix name ".exe"))

Does #5714 fixes that point ?

@kit-ty-kate
Copy link
Member

@Alizter is this problem fixed in 2.2.0~alpha3 ? (currently being released) The archive should be available in:

https://github.com/ocaml/opam/releases/tag/2.2.0-alpha3

@kit-ty-kate
Copy link
Member

kit-ty-kate commented Nov 14, 2023

If you have problems compiling on Windows you can now use the pre-built binary for windows available here: https://github.com/ocaml/opam/releases/download/2.2.0-alpha3/opam-2.2.0-alpha3-preview-for-windows.exe

Disclamer: this prebuilt binary is experimental. Use at your own risk.

@Alizter
Copy link
Author

Alizter commented Nov 14, 2023

@kit-ty-kate Unfortunately, it doesn't appear to be fixed:
image

@kit-ty-kate kit-ty-kate removed this from the 2.2.0~alpha3 milestone Nov 14, 2023
@kit-ty-kate
Copy link
Member

What does with-dkml do?

@Alizter
Copy link
Author

Alizter commented Nov 14, 2023

I think it mostly configures the environment variables. I ran opam by overwriting the one dkml adds to the environment when running with-dkml with the downloaded one. I'm not sure if it is causing opam to wrongly detect the system however. Perhaps @jonahbeckford can shed some light on this.

@kit-ty-kate
Copy link
Member

Just in case, could you try to launch C:\Users\ali\AppData\Local\Programs\DiskuvOCaml\bin\opam.exe switch directly? (you might need to set OPAMROOT to the correct directly if with-dkml does that)

@rjbou
Copy link
Collaborator

rjbou commented Nov 15, 2023

just a note, as i tested on a powershell
image

@Alizter
Copy link
Author

Alizter commented Nov 15, 2023

Yes, it appears that with-dkml is what was causing the issue. Should opam be detecting with-dkml as windows? If so, then it shows that the syspoll is a bit flaky in this area.

image

@rjbou
Copy link
Collaborator

rjbou commented Nov 15, 2023

ok, thanks! Now that we know the origin, it's simpler to detect what's happening.

@jonahbeckford
Copy link
Contributor

You can see what modifications to the PATH with-dkml.exe is doing with the following in PowerShell:

$env:DKML_BUILD_TRACE="ON"; $env:DKML_BUILD_TRACE_LEVEL="2"

I'll admit I am surprised about the eval detection in this scenario ... I was expecting with-dkml.exe to have no influence.

Detail: with-dkml opam ... spawns with-dkml > env.exe > opam-real.exe

The original shell detection logic (which was suggested to me by @dra27 a couple years ago) walked up the process tree to find which cmd.exe, powershell.exe, etc. was the nearest ancestor of the current process. If a process was an ancestor but not in a known list of shells the process (ex. with-dkml.exe) was skipped.

The only thing I can think of:

  1. Maybe you were using an old opam-real.exe? If you turn on tracing (DKML_BUILD_TRACE*) you will see which opam is being executed.
  2. The env.exe is being spawned so that the PAGER works. It was super-annoying that opam on Windows had a broken pager ... all the help manpages were useless. Perhaps the env.exe is interfering with the (new?) eval logic.

Source code: https://github.com/diskuv/dkml-runtime-apps/blob/a1c9ea70ac9cbb52f51ad257af3f9fe1d21fdb7f/src/with-dkml/with_dkml.ml

@Alizter
Copy link
Author

Alizter commented Nov 18, 2023

Yes I see:

with-dkml.exe: [DEBUG] DKML home directory: C:\Users\ali\AppData\Local\Programs\DISKUV~1
with-dkml.exe: [INFO] Running command: C:\Users\ali\AppData\Local\Programs\DISKUV~1\tools\MSYS2\usr\bin\env.exe
                                         opam switch

Which looks to me like opam being run in env is tricking it into thinking its on unix.

Here is the full log:

Details
PS C:\Users\ali> $env:DKML_BUILD_TRACE="ON"; $env:DKML_BUILD_TRACE_LEVEL="2"
PS C:\Users\ali> with-dkml.exe opam switch
with-dkml.exe: [DEBUG] Windows: 1. Adjusting temp variables
with-dkml.exe: [EXEC:300] ["C:\Windows\system32\cmd.exe" "/C" "for" "%i" "in"
                           "(" "C:\Users\ali\AppData\Local\Temp" ")" "do"
                           "@echo" "%~si"]
with-dkml.exe: [DEBUG] Windows: DOS 8.3 var = C:\Users\ali\AppData\Local\Temp
with-dkml.exe: [INFO] Loading compiler cache entry C:\Users\ali\AppData\Local\Programs\DISKUV~1\dkml\.dkml\compiler-cache\f3ef93c660d968b6233393e1fdacf85174926419d7ee5a4f6dce8cb4d8c0f7aa.sexp
with-dkml.exe: [DEBUG] Prepending PATH_COMPILER to PATH. (prefix <|> existing) = (C:\DiskuvOCaml\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64;C:\DiskuvOCaml\BuildTools\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\;C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\DiskuvOCaml\BuildTools\MSBuild\Current\Bin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\DiskuvOCaml\BuildTools\Common7\IDE\;C:\DiskuvOCaml\BuildTools\Common7\Tools\ <|> C:\Users\ali\AppData\Local\Programs\DISKUV~1\tools\MSYS2\clang64\bin;C:\Users\ali\AppData\Local\Programs\DISKUV~1\tools\MSYS2\usr\bin;C:\Program Files\Microsoft\jdk-11.0.16.101-hotspot\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files\GitHub CLI\;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\Gpg4win\..\GnuPG\bin;C:\Program Files\dotnet\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\ali\.cargo\bin;C:\Users\ali\AppData\Local\Programs\DISKUV~1\bin;C:\Users\ali\AppData\Local\Programs\DISKUV~1\usr\bin;C:\Users\ali\AppData\Local\Microsoft\WindowsApps;C:\tools\neovim\nvim-win64\bin;C:\Users\ali\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\ali\.dotnet\tools)
with-dkml.exe: [DEBUG] Setting (name,value) = (DevEnvDir,C:\DiskuvOCaml\BuildTools\Common7\IDE\)
with-dkml.exe: [DEBUG] Setting (name,value) = (Framework40Version,v4.0)
with-dkml.exe: [DEBUG] Setting (name,value) = (FrameworkDir,C:\Windows\Microsoft.NET\Framework64\)
with-dkml.exe: [DEBUG] Setting (name,value) = (FrameworkVersion,v4.0.30319)
with-dkml.exe: [DEBUG] Setting (name,value) = (FrameworkVersion64,v4.0.30319)
with-dkml.exe: [DEBUG] Setting (name,value) = (INCLUDE,C:\DiskuvOCaml\BuildTools\VC\Tools\MSVC\14.26.28801\include;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt)
with-dkml.exe: [DEBUG] Setting (name,value) = (LIB,C:\DiskuvOCaml\BuildTools\VC\Tools\MSVC\14.26.28801\lib\x64;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x64)
with-dkml.exe: [DEBUG] Setting (name,value) = (LIBPATH,C:\DiskuvOCaml\BuildTools\VC\Tools\MSVC\14.26.28801\lib\x64;C:\DiskuvOCaml\BuildTools\VC\Tools\MSVC\14.26.28801\lib\x86\store\references;C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.18362.0;C:\Program Files (x86)\Windows Kits\10\References\10.0.18362.0;C:\Windows\Microsoft.NET\Framework64\v4.0.30319)
with-dkml.exe: [DEBUG] Setting (name,value) = (UCRTVersion,10.0.18362.0)
with-dkml.exe: [DEBUG] Setting (name,value) = (UniversalCRTSdkDir,C:\Program Files (x86)\Windows Kits\10\)
with-dkml.exe: [DEBUG] Setting (name,value) = (VCIDEInstallDir,C:\DiskuvOCaml\BuildTools\Common7\IDE\VC\)
with-dkml.exe: [DEBUG] Setting (name,value) = (VCINSTALLDIR,C:\DiskuvOCaml\BuildTools\VC\)
with-dkml.exe: [DEBUG] Setting (name,value) = (VCToolsInstallDir,C:\DiskuvOCaml\BuildTools\VC\Tools\MSVC\14.26.28801\)
with-dkml.exe: [DEBUG] Setting (name,value) = (VCToolsRedistDir,C:\DiskuvOCaml\BuildTools\VC\Redist\MSVC\14.29.30133\)
with-dkml.exe: [DEBUG] Setting (name,value) = (VCToolsVersion,14.26.28801)
with-dkml.exe: [DEBUG] Setting (name,value) = (VisualStudioVersion,16.0)
with-dkml.exe: [DEBUG] Setting (name,value) = (VS160COMNTOOLS,C:\DiskuvOCaml\BuildTools\Common7\Tools\)
with-dkml.exe: [DEBUG] Setting (name,value) = (VSINSTALLDIR,C:\DiskuvOCaml\BuildTools\)
with-dkml.exe: [DEBUG] Setting (name,value) = (WindowsLibPath,C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.18362.0;C:\Program Files (x86)\Windows Kits\10\References\10.0.18362.0)
with-dkml.exe: [DEBUG] Setting (name,value) = (WindowsSdkBinPath,C:\Program Files (x86)\Windows Kits\10\bin\)
with-dkml.exe: [DEBUG] Setting (name,value) = (WindowsSdkDir,C:\Program Files (x86)\Windows Kits\10\)
with-dkml.exe: [DEBUG] Setting (name,value) = (WindowsSDKLibVersion,10.0.18362.0\)
with-dkml.exe: [DEBUG] Setting (name,value) = (WindowsSdkVerBinPath,C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\)
with-dkml.exe: [DEBUG] Setting (name,value) = (WindowsSDKVersion,10.0.18362.0\)
with-dkml.exe: [DEBUG] Setting (name,value) = (MSVS_PREFERENCE,VS16.11)
with-dkml.exe: [DEBUG] Setting (name,value) = (CMAKE_GENERATOR_RECOMMENDED,Visual Studio 16 2019)
with-dkml.exe: [DEBUG] Setting (name,value) = (CMAKE_GENERATOR_INSTANCE_RECOMMENDED,C:\DiskuvOCaml\BuildTools)
with-dkml.exe: [DEBUG] DKML_3P_PREFIX_PATH =
with-dkml.exe: [DEBUG] DKML_3P_PROGRAM_PATH =
with-dkml.exe: [DEBUG] MSYS2 directory: C:\Users\ali\AppData\Local\Programs\DISKUV~1\tools\MSYS2
with-dkml.exe: [DEBUG] Environment:
                       {("ALLUSERSPROFILE", "C:\\ProgramData")
                        ("APPDATA", "C:\\Users\\ali\\AppData\\Roaming")
                        ("CMAKE_GENERATOR_INSTANCE_RECOMMENDED",
                         "C:\\DiskuvOCaml\\BuildTools")
                        ("CMAKE_GENERATOR_RECOMMENDED",
                         "Visual Studio 16 2019")
                        ("COMPUTERNAME", "VBOX")
                        ("ChocolateyInstall", "C:\\ProgramData\\chocolatey")
                        ("ChocolateyLastPathUpdate", "133372471832096415")
                        ("ChocolateyToolsLocation", "C:\\tools")
                        ("ComSpec", "C:\\Windows\\system32\\cmd.exe")
                        ("CommonProgramFiles",
                         "C:\\Program Files\\Common Files")
                        ("CommonProgramFiles(x86)",
                         "C:\\Program Files (x86)\\Common Files")
                        ("CommonProgramW6432",
                         "C:\\Program Files\\Common Files")
                        ("DKML_TARGET_ABI", "windows_x86_64")
                        ("DevEnvDir",
                         "C:\\DiskuvOCaml\\BuildTools\\Common7\\IDE\\")
                        ("DiskuvOCamlHome",
                         "C:\\Users\\ali\\AppData\\Local\\Programs\\DISKUV~1")
                        ("DiskuvOCamlVersion", "1.2.0")
                        ("DriverData",
                         "C:\\Windows\\System32\\Drivers\\DriverData")
                        ("Framework40Version", "v4.0")
                        ("FrameworkDir",
                         "C:\\Windows\\Microsoft.NET\\Framework64\\")
                        ("FrameworkVersion", "v4.0.30319")
                        ("FrameworkVersion64", "v4.0.30319")
                        ("HOMEDRIVE", "C:") ("HOMEPATH", "\\Users\\ali")
                        ("INCLUDE",
                         "C:\\DiskuvOCaml\\BuildTools\\VC\\Tools\\MSVC\\14.26.28801\\include;C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\include\\um;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\ucrt;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\shared;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\um;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\winrt;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\cppwinrt")
                        ("LIB",
                         "C:\\DiskuvOCaml\\BuildTools\\VC\\Tools\\MSVC\\14.26.28801\\lib\\x64;C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\lib\\um\\x64;C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.18362.0\\ucrt\\x64;C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.18362.0\\um\\x64")
                        ("LIBPATH",
                         "C:\\DiskuvOCaml\\BuildTools\\VC\\Tools\\MSVC\\14.26.28801\\lib\\x64;C:\\DiskuvOCaml\\BuildTools\\VC\\Tools\\MSVC\\14.26.28801\\lib\\x86\\store\\references;C:\\Program Files (x86)\\Windows Kits\\10\\UnionMetadata\\10.0.18362.0;C:\\Program Files (x86)\\Windows Kits\\10\\References\\10.0.18362.0;C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319")
                        ("LOCALAPPDATA", "C:\\Users\\ali\\AppData\\Local")
                        ("LOGONSERVER", "\\\\VBOX")
                        ("MINGW_CHOST", "x86_64-w64-mingw32")
                        ("MINGW_PACKAGE_PREFIX", "mingw-w64-clang-x86_64")
                        ("MINGW_PREFIX", "/clang64")
                        ("MSVS_PREFERENCE", "VS16.11")
                        ("MSYS2_ARG_CONV_EXCL", "*") ("MSYSTEM", "CLANG64")
                        ("MSYSTEM_CARCH", "x86_64")
                        ("MSYSTEM_CHOST", "x86_64-w64-mingw32")
                        ("MSYSTEM_PREFIX", "/clang64")
                        ("NUMBER_OF_PROCESSORS", "4") ("OS", "Windows_NT")
                        ("OneDrive", "C:\\Users\\ali\\OneDrive")
                        ("PATHEXT",
                         ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL")
                        ("PROCESSOR_ARCHITECTURE", "AMD64")
                        ("PROCESSOR_IDENTIFIER",
                         "Intel64 Family 6 Model 154 Stepping 3, GenuineIntel")
                        ("PROCESSOR_LEVEL", "6")
                        ("PROCESSOR_REVISION", "9a03")
                        ("PSModulePath",
                         "C:\\Users\\ali\\Documents\\WindowsPowerShell\\Modules;C:\\Program Files\\WindowsPowerShell\\Modules;C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules")
                        ("PUBLIC", "C:\\Users\\Public")
                        ("Path",
                         "C:\\DiskuvOCaml\\BuildTools\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX64\\x64;C:\\DiskuvOCaml\\BuildTools\\MSBuild\\Current\\bin\\Roslyn;C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v10.0A\\bin\\NETFX 4.8 Tools\\x64\\;C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.18362.0\\x64;C:\\Program Files (x86)\\Windows Kits\\10\\bin\\x64;C:\\DiskuvOCaml\\BuildTools\\MSBuild\\Current\\Bin;C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319;C:\\DiskuvOCaml\\BuildTools\\Common7\\IDE\\;C:\\DiskuvOCaml\\BuildTools\\Common7\\Tools\\;C:\\Users\\ali\\AppData\\Local\\Programs\\DISKUV~1\\tools\\MSYS2\\clang64\\bin;C:\\Users\\ali\\AppData\\Local\\Programs\\DISKUV~1\\tools\\MSYS2\\usr\\bin;C:\\Program Files\\Microsoft\\jdk-11.0.16.101-hotspot\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\GitHub CLI\\;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files (x86)\\Gpg4win\\..\\GnuPG\\bin;C:\\Program Files\\dotnet\\;C:\\Program Files (x86)\\Windows Kits\\10\\Windows Performance Toolkit\\;C:\\Users\\ali\\.cargo\\bin;C:\\Users\\ali\\AppData\\Local\\Programs\\DISKUV~1\\bin;C:\\Users\\ali\\AppData\\Local\\Programs\\DISKUV~1\\usr\\bin;C:\\Users\\ali\\AppData\\Local\\Microsoft\\WindowsApps;C:\\tools\\neovim\\nvim-win64\\bin;C:\\Users\\ali\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\ali\\.dotnet\\tools")
                        ("ProgramData", "C:\\ProgramData")
                        ("ProgramFiles", "C:\\Program Files")
                        ("ProgramFiles(x86)", "C:\\Program Files (x86)")
                        ("ProgramW6432", "C:\\Program Files")
                        ("SESSIONNAME", "Console") ("SystemDrive", "C:")
                        ("SystemRoot", "C:\\Windows")
                        ("TEMP", "C:\\Users\\ali\\AppData\\Local\\Temp")
                        ("TMP", "C:\\Users\\ali\\AppData\\Local\\Temp")
                        ("UCRTVersion", "10.0.18362.0")
                        ("USERDOMAIN", "vbox")
                        ("USERDOMAIN_ROAMINGPROFILE", "vbox")
                        ("USERNAME", "ali") ("USERPROFILE", "C:\\Users\\ali")
                        ("UniversalCRTSdkDir",
                         "C:\\Program Files (x86)\\Windows Kits\\10\\")
                        ("VCIDEInstallDir",
                         "C:\\DiskuvOCaml\\BuildTools\\Common7\\IDE\\VC\\")
                        ("VCINSTALLDIR", "C:\\DiskuvOCaml\\BuildTools\\VC\\")
                        ("VCToolsInstallDir",
                         "C:\\DiskuvOCaml\\BuildTools\\VC\\Tools\\MSVC\\14.26.28801\\")
                        ("VCToolsRedistDir",
                         "C:\\DiskuvOCaml\\BuildTools\\VC\\Redist\\MSVC\\14.29.30133\\")
                        ("VCToolsVersion", "14.26.28801")
                        ("VS160COMNTOOLS",
                         "C:\\DiskuvOCaml\\BuildTools\\Common7\\Tools\\")
                        ("VSINSTALLDIR", "C:\\DiskuvOCaml\\BuildTools\\")
                        ("VisualStudioVersion", "16.0")
                        ("WITHDKML_GUARD", "1")
                        ("WSLENV", "WT_SESSION:WT_PROFILE_ID:")
                        ("WT_PROFILE_ID",
                         "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}")
                        ("WT_SESSION",
                         "51f680fd-7df0-42d2-9f72-0566e69a8624")
                        ("WindowsLibPath",
                         "C:\\Program Files (x86)\\Windows Kits\\10\\UnionMetadata\\10.0.18362.0;C:\\Program Files (x86)\\Windows Kits\\10\\References\\10.0.18362.0")
                        ("WindowsSDKLibVersion", "10.0.18362.0\\")
                        ("WindowsSDKVersion", "10.0.18362.0\\")
                        ("WindowsSdkBinPath",
                         "C:\\Program Files (x86)\\Windows Kits\\10\\bin\\")
                        ("WindowsSdkDir",
                         "C:\\Program Files (x86)\\Windows Kits\\10\\")
                        ("WindowsSdkVerBinPath",
                         "C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.18362.0\\")
                        ("windir", "C:\\Windows")}
with-dkml.exe: [DEBUG] Current directory: C:\Users\ali
with-dkml.exe: [DEBUG] DKML home directory: C:\Users\ali\AppData\Local\Programs\DISKUV~1
with-dkml.exe: [INFO] Running command: C:\Users\ali\AppData\Local\Programs\DISKUV~1\tools\MSYS2\usr\bin\env.exe
                                         opam switch
with-dkml.exe: [EXEC:272] ["C:\Users\ali\AppData\Local\Programs\DISKUV~1\tools\MSYS2\usr\bin\env.exe"
                           "opam" "switch"]
#  switch                                                compiler             description
   5.1.0                                                                      5.1.0
   C:\Users\ali\AppData\Local\Programs\DiskuvOCaml\dkml  ocaml-system.4.14.0  C:\Users\ali\AppData\Local\Programs\DiskuvOCaml\dkml
   C:\Users\ali\dune                                     ocaml.4.14.0         C:\Users\ali\dune
→  coq                                                                        coq
   playground                                            ocaml-system.4.14.0  playground

[WARNING] The environment is not in sync with the current switch.
          You should run: eval $(opam env)
PS C:\Users\ali>

@kit-ty-kate
Copy link
Member

kit-ty-kate commented Jan 22, 2024

with-dkml.exe: [EXEC:272] ["C:\Users\ali\AppData\Local\Programs\DISKUV~1\tools\MSYS2\usr\bin\env.exe"
                           "opam" "switch"]

that looks to me like the reason why. The call to opam switch is done through /usr/bin/env from MSYS2 which makes opam detect it as a Unix environment

(EDIT addition/side-note: this comes from #4816)

@jonahbeckford
Copy link
Contributor

jonahbeckford commented Jan 22, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants