Open JasonGross opened 1 month ago
Afaik this was missing since the presence of opam and an ocaml compiler should guarantee the presence of a c compiler. Have you encountered situations where this was not the case?
On Windows, it seems that there may be gcc
installed without cc
being symlinked. (I'm in fact not sure what cygwin package needs to be installed to get cc
symlinked. See this log for more details (full logs at logs_28626321033.zip in case github ever deletes the logs)
@dra27 do you know if this is a bug in windows?
It's not a bug with Windows per se, it's the assumption - it's not portable to assume the C compiler is called "cc"!
My instinct (that is to say my strong opinion) is that randomly symlinking these things in opam is a bad idea (also bear in mind that "symlinking" is not a guaranteed thing in Windows, so it can also mean "shimming"). The mingw-w64-shims package does this exceptionally for mingw-w64 under Cygwin only (with both MSVC and mingw-w64 accessed via MSYS2 this is done much more naturally by adding an appropriate bin
directory to PATH
).
But, two practical thoughts:
%{conf-cc:cc}%
expanding to the correct name of the C compiler.ocamlopt -config-var c_compiler
gives you the name of the C compiler used to build OCaml. IIRC it is supposed to give strictly the command (i.e. no additional flags). On Windows, this gives anything from cl
(MSVC), gcc
(mingw-w64 via MSYS2), i686-w64-mingw32-gcc
/x86_64-w64-mingw32-gcc
(mingw-w64 via Cygwin).
Would it be possible to add a conf- package for the presence of any C compiler addressable by
cc
, a la https://github.com/ocaml/opam-repository/blob/master/packages/conf-c%2B%2B/conf-c%2B%2B.1.0/opam ?