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

opam switch create 5.0.0 fails #26050

Closed
fpottier opened this issue Jun 10, 2024 · 6 comments
Closed

opam switch create 5.0.0 fails #26050

fpottier opened this issue Jun 10, 2024 · 6 comments

Comments

@fpottier
Copy link
Contributor

Hello,
The creation of a fresh 5.0.0 switch fails with the following error message. I have just run opam update and I have removed the pre-existing 5.0.0 switch prior to running opam switch create 5.0.0. I am running MacOS with an Apple processor.

⬇ retrieved ocaml-config.3  (cached)
∗ installed base-bigarray.base
∗ installed base-threads.base
∗ installed base-unix.base
∗ installed host-arch-arm64.1
∗ installed host-system-other.1
∗ installed ocaml-options-vanilla.1
⬇ retrieved ocaml-base-compiler.5.0.0  (cached)
∗ installed ocaml-base-compiler.5.0.0
∗ installed ocaml-config.3
[ERROR] The compilation of ocaml.5.0.0 failed at "ocaml
        /Users/fpottier/.opam/5.0.0/share/ocaml-config/gen_ocaml_config.ml
        5.0.0 ocaml".

#=== ERROR while compiling ocaml.5.0.0 ========================================#
# context     2.1.5 | macos/arm64 | ocaml-base-compiler.5.0.0 | https://opam.ocaml.org#25082ca0
# path        ~/.opam/5.0.0/.opam-switch/build/ocaml.5.0.0
# command     ~/.opam/opam-init/hooks/sandbox.sh build ocaml /Users/fpottier/.opam/5.0.0/share/ocaml-config/gen_ocaml_config.ml 5.0.0 ocaml
# exit-code   2
# env-file    ~/.opam/log/ocaml-68161-44c623.env
# output-file ~/.opam/log/ocaml-68161-44c623.out
### output ###
# Cannot find file /Users/fpottier/.opam/5.0.0/share/ocaml-config/gen_ocaml_config.ml.
@fpottier
Copy link
Contributor Author

And running opam 2.1.6.

@fpottier
Copy link
Contributor Author

Actually, I am seeing a similar problem with 5.2.0...

@rleonid
Copy link
Contributor

rleonid commented Jun 10, 2024

I've also tried several switches and the problem seems to be that either the share or ocaml-config directory in ~/.opam/<switch>share/ocaml-config/gen_ocaml_config.ml is not created or correctly unpacked.

@hannesm
Copy link
Member

hannesm commented Jun 11, 2024

Dear @fpottier and @rleonid, sorry for your inconvenience.

It seems to be caused by the removal of files, and discussed in #25961 and https://discuss.ocaml.org/t/the-compilation-of-ocaml-5-1-1-failed-at-ocaml-gen-ocaml-config-ml-5-1-1-ocaml/14731

So, the quick workaround: rm -rf ~/.opam/repo/default{,.tar.gz} && opam update default -- in the long run, ensure that you have a GNU patch installed (via homebrew or macports).

@fpottier
Copy link
Contributor Author

Thanks @hannesm for the work-around, which worked. I had installed gpatch already but did not know how to fix my broken state. I am closing this issue.

@rleonid
Copy link
Contributor

rleonid commented Jun 11, 2024

Thank you @hannesm !!!

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

3 participants