ocaml / opam-repository

Main public package repository for opam, the source package manager of OCaml.
https://opam.ocaml.org
Creative Commons Zero v1.0 Universal
516 stars 1.12k forks source link

conf-cc? #26590

Open JasonGross opened 1 week ago

JasonGross commented 1 week ago

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 ?

mseri commented 1 week 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?

JasonGross commented 1 week ago

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)

mseri commented 1 week ago

@dra27 do you know if this is a bug in windows?

dra27 commented 1 week ago

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: