The PATH is strange… multiple opam directories…
$which -a opam
/cygdrive/c/Users/frede/AppData/Local/Programs/opam/bin/opam
$which -a dune
/cygdrive/c/Users/frede/AppData/Local/opam/default/bin/dune
/cygdrive/c/Users/frede/AppData/Local/opam/5.1.0/bin/dune
/cygdrive/c/Users/frede/AppData/Local/opam/5.1.0/bin/dune
/cygdrive/c/Users/frede/AppData/Local/opam/5.1.0/bin/dune
But the c_compiler of the default switch is:
c_compiler: x86_64-w64-mingw32-gcc.exe
While from the other switches:
c_compiler: x86_64-w64-mingw32-gcc
This could explain the difference of behaviour.
I have rebuild Ocaml (opam reinstall ocaml-base-compiler
), and now, I have:
c_compiler: x86_64-w64-mingw32-gcc
And opam reinstall base
(which uses the C compiler) succeeds to compile without the wrapper.
I guess I had a bad environment while boostraping OCaml with opam init
.
Now, if I get rid of my opam directory and rebuild it (opam init
), I have the good c_compiler
value.
Note, my PATH is really weird.
/cygdrive/c/Users/frede/AppData/Local/opam/default/bin:/usr/x86_64-w64-mingw32/sys-root/mingw/bin:C:.:C:C:/cygdrive/c/Users/frede/AppData/Local/opam/default/bin:.:C:/usr/x86_64-w64-mingw32/sys-root/mingw/bin:C:/cygdrive/c/Users/frede/AppData/Local/opam/default/bin:.:C:/usr/x86_64-w64-mingw32/sys-root/mingw/bin:C:/cygdrive/c/Users/frede/AppData/Local/opam/default/bin:.:C:/usr/x86_64-w64-mingw32/sys-root/mingw/bin:/cygdrive/c/Users/frede/AppData/Local/opam/default/bin:/usr/x86_64-w64-mingw32/sys-root/mingw/bin:/usr/local/bin:/usr/bin:/cygdrive/c/Program Files/Eclipse Adoptium/jdk-17.0.6.10-hotspot/bin:/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/PuTTY:/cygdrive/c/Program Files/IcedTeaWeb/WebStart/bin:/cygdrive/c/Program Files/Microsoft VS Code/bin:/cygdrive/c/Program Files/Git/cmd:/cygdrive/c/Users/frede/.cargo/bin:/cygdrive/c/Users/frede/AppData/Local/Programs/DiskuvOCaml/0/bin:/cygdrive/c/Users/frede/AppData/Local/Programs/opam/bin:/cygdrive/c/Users/frede/AppData/Local/Programs/DiskuvOCaml/0/usr/bin:/cygdrive/c/Users/frede/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/texlive/2023/bin/win32:/cygdrive/c/Users/frede/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/users/frede/appdata/local/packages/pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0/localcache/local-packages/python39/scripts:/cygdrive/c/users/frede/.local/bin:/cygdrive/c/texlive/2023/bin/windows:/usr/local/bin:/cygdrive/c/Users/frede/AppData/Local/Coursier/data/bin
There are some .
in it which prevents ocamlfind
to install (./INSTALL
is executed instead of /usr/bin/install
). There are some C:
which should have been spelt /cygwin/c
or something like this. The PATH corruption comes from /cygdrive/c/Users/frede/AppData/Local/opam/opam-init/init.sh
(executed from .bash_profile
… installed by opam init
). It appears /cygdrive/c/Users/frede/AppData/Local/opam/opam-init/variables.sh
is updated by opam switch
, but fails to use the Cygwin convention about directory paths.