I am trying to create a new opam switch with OCaml 4.06.0. I can successfully create a switch with the latest OCaml version. But I encountered bad checksum error when I created an old branch. My opam version 2.1.2. The log is shown below.
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
∗ installed base-bigarray.base
∗ installed base-threads.base
∗ installed base-unix.base
[ERROR] Failed to get extra source “alt-signal-stack.patch” of ocaml-base-compiler.4.06.0: Bad checksum
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ fetch ocaml-base-compiler 4.06.0
└─
┌─ The following changes have been performed (the rest was aborted)
│ ∗ install base-bigarray base
│ ∗ install base-threads base
│ ∗ install base-unix base
└─
I am not sure, but I can reproduce the error on three machines: my laptop and two servers.
I attach the logs from two servers, air01 and dai05. The versions opam of them are 2.1.2 and 2.0.5
zhangliao@dai-05:~$ opam switch create 4.06.0
[NOTE] It seems you have not updated your repositories for a while. Consider updating them with:
opam update
<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Switch invariant: [“ocaml-base-compiler” {= “4.06.0”} | “ocaml-system” {= “4.06.0”}]
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
∗ installed base-bigarray.base
∗ installed base-threads.base
∗ installed base-unix.base
[ERROR] Failed to get extra source “alt-signal-stack.patch” of ocaml-base-compiler.4.06.0: Bad checksum
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ fetch ocaml-base-compiler 4.06.0
└─
┌─ The following changes have been performed (the rest was aborted)
│ ∗ install base-bigarray base
│ ∗ install base-threads base
│ ∗ install base-unix base
└─
(base) zhangliao@air-01:~$ opam switch create 4.06.0
<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ocaml-base-compiler.4.06.0] downloaded from cache at https://opam.ocaml.org/cache
[ERROR] The sources of the following couldn’t be obtained, aborting:
- ocaml-base-compiler.4.06.0: Bad checksum
If I download and check the file, the hash appears to be correct. Note that the ?full_index=1 is important. Without it the file has a different hash.
$ curl -L -O "https://github.com/ocaml/ocaml/commit/137a4ad167f25fe1bee792977ed89f30d19bcd74.patch?full_index=1"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6135 100 6135 0 0 18331 0 --:--:-- --:--:-- --:--:-- 18313
$ sha256sum 137a4ad167f25fe1bee792977ed89f30d19bcd74.patch
c0c1c64bed4cc2413be21ce8bfe52bb9caff4d1bcd7e7a72f9bcb113c231bc91 137a4ad167f25fe1bee792977ed89f30d19bcd74.patch
It seems indeed related to an old repository.
My lap and servers have installed some local opam packages, and there is some problem with opam update. After I remove the installed local packages, I can run opam update and create 4.06.0 switch.
Just to check something here, and my apologies if you already know this–but 4.06 is a very old version of the language. The latest version in the 4.x series is 4.14, and in the 5.x series 5.1. If you are not strongly tied to the old version, you might want to consider using one of the new versions.