Open patricoferris opened 2 years ago
The compiler itself is something abstract for opam. It only knows about a package that have the flag compiler
, and that need to perform specific actions with it (for switch eg.). What makes ocaml-system
detect ocamlc
move, is that ocaml-system config file contains the detected path, and this path (and its checksum) is checked afterwards by opam. As long the file is unchanged, opam won't notice.
What can be done is to check if it is an executable, and in this case check if it is reachable from PATH
.
Whenever using system OCaml compilers in switches it can be easy to accidentally have the wrong system compiler in
PATH
when you have multiple compilers. This leads to accidentally creating a new switch with say a4.13.1
compiler and then installing packages with a4.12.1
compiler. I realise thePATH
management is the user's responsibility but (if possible) it might be useful for opam to be able to detect that something isn't quite right when using a different system compiler?More concretely assume I have a
4.13.1
switch in/foo/bin
and a4.12.1
compiler in the more conventional/usr/local/bin
with the former not inPATH
. I create a new switch:Opam creates a new switch called
system
with the4.13.1
compiler it found inPATH
. Now I install sayocaml-lsp-server
forgetting to setPATH
correctly such that the4.13.1
compiler is the first compiler that will be found:I realise this is pretty niche but I was just wondering if there is some sort of check that could be done to provide a better error message perhaps? Opam does catch if the system compiler is no longer in the right place i.e. if you
mv /foo/bin /bar/bin
and thenopam install
you get:Thanks :))
Config Report