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

Failure to build ocaml.5.2.1 on Windows: Sys_error("C:\\Users\\User\\AppData\\Local\\opam\\default\\lib\\toplevel:stdlib.cmi: No such file or directory") #27425

Open
MisterDA opened this issue Feb 11, 2025 · 4 comments · Fixed by #27426

Comments

@MisterDA
Copy link
Contributor

I'm using opam 2.3.0. I need a switch with OCaml 5.2. I get a build failure when creating the switch.

$ opam switch create ocaml.5.2 --packages 'ocaml<5.3'

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><>  🐫
Switch invariant: ["ocaml" {< "5.3"}]

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
∗ installed arch-x86_64.1
∗ installed base-bigarray.base
∗ installed base-threads.base
∗ installed base-unix.base
∗ installed host-arch-x86_64.1
∗ installed host-system-mingw.1
⬇ retrieved flexdll.0.43  (cached)
⬇ retrieved ocaml-config.3  (cached)
∗ installed flexdll.0.43
∗ installed ocaml-options-vanilla.1
⬇ retrieved mingw-w64-shims.0.2.0  (cached)
∗ installed conf-mingw-w64-gcc-x86_64.1
∗ installed ocaml-env-mingw64.1
∗ installed system-mingw.1
⬇ retrieved ocaml-base-compiler.5.2.1  (cached)
∗ installed mingw-w64-shims.0.2.0
∗ installed ocaml-base-compiler.5.2.1
∗ installed ocaml-config.3
[ERROR] The compilation of ocaml.5.2.1 failed at "ocaml
        C:\\Users\\User\\AppData\\Local\\opam\\ocaml.5.2\\share\\ocaml-config/gen_ocaml_config.ml 5.2.1 ocaml".

#=== ERROR while compiling ocaml.5.2.1 ========================================#
# context     2.3.0 | win32/x86_64 |  | https://opam.ocaml.org#36f4d2d5ceb882a79fd7d7f956b490201da67226
# path        ~\AppData\Local\opam\ocaml.5.2\.opam-switch\build\ocaml.5.2.1
# command     ~\AppData\Local\opam\ocaml.5.2\bin\ocaml.exe C:\Users\User\AppData\Local\opam\ocaml.5.2\share\ocaml-config/gen_ocaml_config.ml 5.2.1 ocaml
# exit-code   2
# env-file    ~\AppData\Local\opam\log\ocaml-6488-1ef443.env
# output-file ~\AppData\Local\opam\log\ocaml-6488-1ef443.out
### output ###
# Fatal error: exception Sys_error("C:\\Users\\User\\AppData\\Local\\opam\\default\\lib\\toplevel:stdlib.cmi: No such file or directory")



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
┌─ The following actions failed
│ λ build ocaml 5.2.1
└─
┌─ The following changes have been performed (the rest was aborted)
│ ∗ install arch-x86_64               1
│ ∗ install base-bigarray             base
│ ∗ install base-threads              base
│ ∗ install base-unix                 base
│ ∗ install conf-mingw-w64-gcc-x86_64 1
│ ∗ install flexdll                   0.43
│ ∗ install host-arch-x86_64          1
│ ∗ install host-system-mingw         1
│ ∗ install mingw-w64-shims           0.2.0
│ ∗ install ocaml-base-compiler       5.2.1
│ ∗ install ocaml-config              3
│ ∗ install ocaml-env-mingw64         1
│ ∗ install ocaml-options-vanilla     1
│ ∗ install system-mingw              1
└─
Switch initialisation failed: clean up? ('n' will leave the switch partially installed) [y/n] n


$ opam switch
#  switch     compiler                                                                        description
   default    arch-x86_64.1,ocaml-base-compiler.5.3.0,ocaml-options-vanilla.1,system-mingw.1  ocaml >= 4.05.0
→  ocaml.5.2                                                                                  ocaml < 5.3


$ ocaml
OCaml version 5.2.1
Enter #help;; for help.

Fatal error: exception Sys_error("C:\\Users\\User\\AppData\\Local\\opam\\default\\lib\\toplevel:stdlib.cmi: No such file or directory")
@kit-ty-kate
Copy link
Member

could you show your environment? (env)

@MisterDA
Copy link
Contributor Author

MisterDA commented Feb 11, 2025

_=/usr/bin/env
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\User\AppData\Roaming
CAML_LD_LIBRARY_PATH=C:\Users\User\AppData\Local\opam\ocaml.5.2\lib\stublibs
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
COMMONPROGRAMFILES=C:\Program Files\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMSPEC=C:\WINDOWS\system32\cmd.exe
CYGWIN=winsymlinks:native
DriverData=C:\Windows\System32\Drivers\DriverData
HOME=/cygdrive/c/Users/User
HOMEDRIVE=C:
HOMEPATH=\Users\User
INFOPATH=/usr/local/info:/usr/share/info:/usr/info
LANG=en_US.UTF-8
LOCALAPPDATA=C:\Users\User\AppData\Local
MAKEFLAGS=-j12
MANPATH=:/cygdrive/c/Users/User/AppData/Local/opam/ocaml.5.2/man
MSYS=winsymlinks:native
OCAML_TOPLEVEL_PATH=
OCAMLTOP_INCLUDE_PATH=C:\Users\User\AppData\Local\opam\default\lib\toplevel:
OPAM_LAST_ENV=C:\Users\User\AppData\Local\opam\.last-env\env-d567f03af7597e56edca4619015a2b5b-0
OPAM_SWITCH_PREFIX=C:\Users\User\AppData\Local\opam\ocaml.5.2
OPAMNOENVNOTICE=true
ORIGINAL_PATH=/cygdrive/c/Program Files/Go/bin:C:\Users\User\go/bin:/cygdrive/c/Program Files/Alacritty:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Windows/System32/OpenSSH:/cygdrive/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/WINDOWS/System32/OpenSSH:/cygdrive/c/Program Files/Docker/Docker/resources/bin:/cygdrive/c/Program Files/Git/cmd:/cygdrive/c/Program Files/GitHub CLI:/cygdrive/c/Program Files/CMake/bin:/cygdrive/c/Program Files/Go/bin:/cygdrive/c/Program Files/WezTerm:/cygdrive/c/Users/User/AppData/Local/Programs/Python/Python313/Scripts:/cygdrive/c/Users/User/AppData/Local/Programs/Python/Python313:/cygdrive/c/Users/User/AppData/Local/Programs/Python/Launcher:/cygdrive/c/Users/User/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Program Files/Emacs/emacs-29.3_2/bin:/cygdrive/c/Users/User/AppData/Local/Microsoft/WinGet/Links:/cygdrive/c/Users/User/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Users/User/go/bin
OS=Windows_NT
PATH=/cygdrive/c/Users/User/AppData/Local/opam/ocaml.5.2/bin:/usr/x86_64-w64-mingw32/sys-root/mingw/bin:C:.:C:/usr/local/bin:/usr/bin:/cygdrive/c/Program Files/Go/bin:C:/cygdrive/c/Users/User/go/bin:/cygdrive/c/Program Files/Alacritty:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Windows/System32/OpenSSH:/cygdrive/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/WINDOWS/System32/OpenSSH:/cygdrive/c/Program Files/Docker/Docker/resources/bin:/cygdrive/c/Program Files/Git/cmd:/cygdrive/c/Program Files/GitHub CLI:/cygdrive/c/Program Files/CMake/bin:/cygdrive/c/Program Files/Go/bin:/cygdrive/c/Program Files/WezTerm:/cygdrive/c/Users/User/AppData/Local/Programs/Python/Python313/Scripts:/cygdrive/c/Users/User/AppData/Local/Programs/Python/Python313:/cygdrive/c/Users/User/AppData/Local/Programs/Python/Launcher:/cygdrive/c/Users/User/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Program Files/Emacs/emacs-29.3_2/bin:/cygdrive/c/Users/User/AppData/Local/Microsoft/WinGet/Links:/cygdrive/c/Users/User/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Users/User/go/bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROFILEREAD=true
ProgramData=C:\ProgramData
ProgramFiles(x86)=C:\Program Files (x86)
PROGRAMFILES=C:\Program Files
ProgramW6432=C:\Program Files
PROMPT=%(?:%{%}%1{➜%} :%{%}%1{➜%} ) %{%}%c%{%} $(git_prompt_info)
PS1=$P$G
PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
PUBLIC=C:\Users\Public
SESSIONNAME=Console
SHELL=/bin/zsh
SYSTEMDRIVE=C:
SYSTEMROOT=C:\WINDOWS
TEMP=/tmp
USER=User
USERNAME=User
USERPROFILE=C:\Users\User

@kit-ty-kate kit-ty-kate transferred this issue from ocaml/opam Feb 11, 2025
@kit-ty-kate
Copy link
Member

Thanks! This is an issue with that specific version of the ocaml package, which is missing the x-env-path-rewrite field present in both ocaml.5.2.0 and ocaml.5.3.0 but not ocaml.5.2.1

cc @Octachron @dra27

@dra27 dra27 linked a pull request Feb 11, 2025 that will close this issue
@dra27 dra27 reopened this Feb 11, 2025
@dra27
Copy link
Member

dra27 commented Feb 11, 2025

This now duplicates #25819 (comment) and is fixed by dra27#22.

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

Successfully merging a pull request may close this issue.

3 participants