-
Notifications
You must be signed in to change notification settings - Fork 362
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
ocamlopt
defaults to system install on OCaml 5 bytecode-only architectures
#5872
Comments
Well yes in general having a mix of tools of the same toolchain from different installs in your If you really want something reliable that copes with these mixed installs we would need a) A binary that is guaranteed to be present in every configuration of an OCaml install b) a way for this binary to point to a file or output that has precise information about every bit of the OCaml install that is configurable so that build system only access the tools that actually exist in this configuration. Note that ages ago, already well aware of this exact issue, I had requested for
No (Also given the mess we see in opam end-users environments I rather not do something as brittle as checking that tools are in the same directory) |
opam could detect this particular case (has ocamlc but no ocamlopt in the current switch, but ocamlopt is in the previous PATH) and display a warning, but i don't think we can do much more |
Yeah the system install is definitively an issue here, but as a non-root user it's awkward to vanish a) Can we assume that Regarding the native compiler support, which options should be favored?
|
@art-w Responding to your question:
but you will have have to customize |
As pointed out during the dev meeting this might not be so easy as this would be against the idea of opam being OCaml agnostic (modulo FormatUpgrade and opamInit) |
I'm running into a compilation issue on the
ppc64
architecture, which is bytecode-only since OCaml 5 (= does not provideocamlopt
, onlyocamlc
):This machine happens to have a system install of OCaml 4.13.1, so
ocamlopt
is still found during the compilation ofcmdliner
but with a version that's incompatible with the opam switch expectation:$ ocamlc -version 5.1.0 $ ocamlopt -version 4.13.1 $ .opam/5.1.0/bin/ocamlobjinfo .opam/5.1.0/lib/cmdliner/cmdliner.cmi Wrong magic number: this tool only supports object files produced by compiler version 5.1.0 This seems to be a compiled interface file (cmi) for an older version of OCaml. $ /bin/ocamlobjinfo .opam/5.1.0/lib/cmdliner/cmdliner.cmi Unit name: Cmdliner Interfaces imported: 2f078433075037f22235ff84d6f9b58c Cmdliner ...
I'm not sure if opam could prevent this... I found a couple of different strategies in the wild for how people are checking for native support:
dune
appears to be unaffected by this issue... I heard rumors that it searches forocamlopt
in$OPAM_SWITCH_PREFIX/bin
(?)cmdliner
is only checking for the existence of anocamlopt
executable (cc @dbuenzli)topkg
delegates toocamlfind
andocamlbuild
(?)ocamlfind
doesn't have the concept thatocamlopt
could be missing (? cc @gerdstolpmann)ocamlbuild
checks if theARCH
is unsupported from the$(ocamlc -where)/Makefile.config
, which isn't quite correct as hereARCH=power
is supported but withNATIVE_COMPILER=false
(cc @gasche)I'm afraid a fix would be required in each of those build systems (I don't think opam could hide the system install of ocamlopt?). But does someone has recommendation on the right way to address this issue? (do we need to check the ocamlc/ocamlopt versions explicitly or trust the
NATIVE_COMPILER
or check that the binaries are in the same directory or ...?)The text was updated successfully, but these errors were encountered: