Re: Removing Camlp4 dependency from OPAM package

Jacques Garrigue <[email protected]> Sun, 6 Mar 2016 23:50:30 +0900
Newsgroups gmane.comp.lang.ocaml.lib.gtk
Message-ID <[email protected]>
I have just committed a fix that removes the dependency on camlp4 to the git repository (either github or ocamlforge).
This just adds the preprocessed files to the repository, so that one doesn't have to process them locally.
Can you give it a try?

Basically, camlp4 is only used for stream parsers, which were available in ocaml before the merge of camlp4
(and subsequent removal). It would be nice if they were supported again natively.
Note that this is a problem of parsing, so ppx is of no help there.

Cheers,

Jacques


On 2016/03/04 01:02, Andre Maroneze wrote:
> 
> Hello,
> 
> I'm debugging a segmentation fault related to OCaml 4.03 + Lablgtk, and due to several factors it becomes incredibly painful to recompile and reinstall Camlp4 every time I change the OCaml code:
> 
> - The (currently available) Camlp4 opam package does not work with OCaml 4.03, so it is necessary to use an `opam pin`, which re-downloads the package from Git every time (and Github, for some reason, limits the connection to 600kB/s, which is doubly frustrating); granted, it can be done otherwise, but it's still time-consuming to do it manually (note: apparently a new package has just been released, but even after making `opam update`, it was still not available to me);
> 
> - Even with "make -j", it still only uses one core, and its compilation takes almost as much time as compiling OCaml itself (which uses all of my 8 cores).
> 
> - Most importantly, it is *very* hard to obtain a version of Camlp4 that works with a specific, non-released OCaml commit (e.g. for git bisecting); I even tried cloning Camlp4's git to find out which commit would be compatible to a given commit of the OCaml source, but without success. All other packages I'm using remain mostly unmodified between these two versions, so I can just keep using them without problems.
> 
> Dropping the Camlp4 dependency from lablgtk has been discussed on November 2014 (https://lists.ocamlcore.org/pipermail/lablgtk-list/2014-November/002069.html), but it seems it hasn't been done yet. I wonder if recent developments in ppx would simplify the conversion nowadays?
> 
> Otherwise, I believe a OPAM-specific solution might be an interesting alternative (though I haven't looked the exact details of the processing done by Camlp4 to understand if this is really viable).
> 
> So far, I'm resorting to manually preprocessing the files using a stable OCaml+camlp4 to obtain the .ml sources, then `opam pin`ning those to a local lablgtk package that does not require camlp4, and then installing this package when compiling an unstable OCaml. It seems to work so far.
> 
> Therefore, I would suggest something similar to creating a "lablgtk-full" package, that would require all optional dependencies (gtksourceview, gnomecanvas, glade and lablgl) but no camlp4, and that would contain all preprocessed files (modulo a sed script for HAS_PRINTEXC_BACKTRACE, if necessary). It would be less trouble for me to include the unused gtk dependencies than having to compile camlp4.
> 
> This solution would certainly complicate things for some users (e.g. packages depending on lablgtk would have to add constraints such as "lablgtk | lablgtk-full"), but it might be worthwhile in this age of demise of camlp4.