Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pass information about C compiler to OCaml switch #3017

Closed
hannesm opened this issue Aug 8, 2017 · 6 comments
Closed

pass information about C compiler to OCaml switch #3017

hannesm opened this issue Aug 8, 2017 · 6 comments

Comments

@hannesm
Copy link
Member

hannesm commented Aug 8, 2017

please see https://discuss.ocaml.org/t/troubles-after-compiler-installed-via-opam/676/5 -- OCaml contains some magic to locate your gcc, and opam does (atm) not allow to pass the C compiler to a switch.

@dra27
Copy link
Member

dra27 commented Aug 8, 2017

This is not entirely unrelated to Windows-stuff for opam 2 (#2930, and some stuff following it)

@bschommer
Copy link

In general wouldn't it be easier to allow the user to specify the configure flags for the ocaml compilation in some way?

@remexre
Copy link

remexre commented May 16, 2020

got a similar case; can't install a musl switch (without adding extra symlinks etc) since it assumes CC=musl-gcc, rather than the correct (for my system) x86_64-linux-musl-gcc

@Jesse-Millwood
Copy link

Would this help with cross compiling too?

@hyphenrf
Copy link

hyphenrf commented Oct 2, 2020

what's the status on this? I've had issues installing certain opam package (eigen) with gcc due to internal compiler errors. Resorted to manually symlinking clang to coerce opam into using that.

Having the ability to say CC=clang CXX=clang++ opam ... would be much better

@kit-ty-kate
Copy link
Member

7 years later and this issue seems to have been fixed somewhere along the line (opam 2.0.0 probably).

$ cat opam
opam-version: "2.0"
build: ["sh" "-c" "env | grep CC"]
$ CC=clang-18 opam reinstall -v .

<><> Synchronising pinned packages ><><><><><><><><><><><><><><><><><><><><><><>
[test.dev] synchronised (no changes)

The following actions will be performed:
=== recompile 1 package
  ↻ test dev (pinned)

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
⬇ retrieved test.dev  (no changes)
+ /home/kit_ty_kate/.opam/opam-init/hooks/sandbox.sh "build" "sh" "-c" "env | grep CC" (CWD=/home/kit_ty_kate/.opam/5.3/.opam-switch/build/test.dev)
- CC=clang-18
λ compiled  test.dev
⊘ removed   test.dev
∗ installed test.dev
Done.

If it still doesn't work, specifically for the compiler packages in opam-repository it should be something to change in opam-repository instead of opam (e.g. https://github.com/ocaml/opam-repository/blob/9f26a2181d2f46e23b62061679bdddb92684f204/packages/ocaml-base-compiler/ocaml-base-compiler.5.2.1/opam#L71)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants