I have been running into issues with my gcc compiler (gcc-9) when installing eigen on Ubuntu 20 recently. I was wondering if there was a way to specify which C compiler to use when running the “opam install command”, or to change the default C compiler used by opam? I can do it within my environment by setting CC=gcc-7 (for instance) but it does not seem to transfer to opam.
I hope the question is clear, happy to give more clarifications if not!
ocamlopt and ocamlc have a -cc option which enables you to specify the C compiler/linker. If you are using dune, you should be able to add a flags field to your executable/library stanza. If not you can apply it in your Makefile.