I had some issues building cstruct-lwt. They seem to be resolved by now, but when trying to build lwt. An opam install lwt leads to the message:
[ERROR] The compilation of lwt failed at "jbuilder build -p lwt -j 4".
I attached the gzipped contents of the .env and .info file, .err and .out were empty. The file furthermore contains the output of opam config list.
I'm using here Debian sid and OCaml 4.05.0 (system provided one).
What can cause this error? Can I provide more helpful information to resolve this case?
@qbi, I don't see anything in the file that looks wrong. I just tried it on a 4.05.0 opam-provided switch, and a 4.04 system switch, and it worked for me (on darwin though, but I don't think that's likely to matter). I looked in the issue you linked (thanks), and it seems that your original Lwt installation did succeed, but a recompilation due to adding camlp4 failed. I wasn't able to reproduce that on either switch, either. I suggest trying on an opam-provided switch.
Other things to look at:
opam install lwt works on a clean switch, as suggested by comments in the linked issue?opam install camlp4 after (1) fails at recompilation of lwt, on a clean switch where neither lwt nor camlp4 are being installed as a side effect of installing other packages?opam install camlp4 and then opam install lwt instead, starting from a clean switch?As an aside, I want to note that in the near future, camlp4 won't trigger recompilation of lwt (#370).
I can largely confirm 3 works.
I was having the same error, and doing opam install camlp4 before doing opam install lwt solved the issue in a largely clean switch
(By largely clean I meant removing the entire .opam folder and only installed some irrelevant packages and a failed lwt installation before trying the above solution)
System : Linux
@darrenldl Thanks. Was this on the system switch? Was it also an Lwt reinstall that failed? I'm still not able to reproduce the problem, but I suspect it's somehow a problem with the the opam repository rather than Lwt, and also eventually a vanishing problem (#370).
@aantron Yes and yes.
I will give it another shot later today with completely clean system switch and 4.05.0 switch, in case the result is useful.
Test results
==========================================================
Completely clean & system switch(4.05.0), installing lwt.3.1.0 has no issues
Completely clean & system switch(4.05.0), installing package(nocrypto) that depends on lwt.3.1.0 has no issues
Completely clean & 4.05.0 switch, installing lwt.3.1.0 has no issues
Completely clean & 4.05.0 switch, installing package(nocrypto) that depends on lwt.3.1.0 has no issues
==========================================================
.opam is removed entirely before each test to ensure completely clean state
I am not able to reproduce the errors now, I did do a system upgrade,
so I am not sure if it is because the repo is fixed or because of my system upgrade now.
@darrenldl Thanks for trying it!
I did the following steps on my system:
> opam update
> opam upgrade
> opam remove lwt
[NOTE] lwt is not installed.
Nothing to do.
> opam remove camlp4
The following actions will be performed:
⊘ remove camlp4 4.05+system
=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
⊘ removed camlp4.4.05+system
Done.
> opam switch show
system
An lwt install (opam install lwt) succeeds now, but installing camlp4 directly after the installation of lwt fails.
[ERROR] The compilation of lwt failed at "jbuilder build -p lwt -j 4".
However if lwt and camlp4 are removed, an installation of camlp4 succeeds:
> opam install camlp4
The following actions will be performed:
∗ install camlp4 4.05+system
=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[camlp4] Archive in cache
=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
∗ installed camlp4.4.05+system
Done.
When I run a opam install lwt direct after the step above, lwt fails:
[ERROR] The compilation of lwt failed at "jbuilder build -p lwt -j 4".
File "src/unix/jbuild", line 33, characters 0-81:
Warning: File lwt_config is both generated by a rule and present in the source tree.
I still can't reproduce these errors (my system switch is at 4.04 though, not sure if that's significant). Camlp4 is on the way out, however, and will become a separate package in 4.0.0 (#370), so installing Camlp4 should no longer trigger recompilation of package lwt. I suspect that might happen before we figure out how to fix the issue :/
Thanks for the new instructions, though!
@qbi, @darrenldl I am closing this issue for now, as in https://github.com/mirage/ocaml-cstruct/issues/181#issuecomment-351554313. Let me know if you are still having trouble.
The "common" way to resolve Camlp4 problems on a system switch is not to use a system switch anymore: opam switch 4.05.0, then set everything up. The switches created fully by opam tend not to be broken as easily.