|Anonymous | Login | Signup for a new account||2017-05-30 05:33 CEST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0005548||OCaml||-for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues||public||2012-03-20 11:07||2017-03-03 15:26|
|Target Version||Fixed in Version|
|Summary||0005548: ocamlbuild's ocamlfind integration doesn't support syntax extensions|
|Description||OCamlbuild's ocamlfind integration includes -I-options and stuff from ocamlfind in the "compile" and "link" ocamlbuild steps but, to my knowledge, does not include them during preprocessing ("pp"). This means that while ocamlfind libraries can be used, I don't know how to use their attached syntax extensions (ocamlfind's predicate "syntax"). It would be nice if that was fixed.|
|Steps To Reproduce||With some ocamlfind package "foo.syntax" that enables syntax extensions, and some file "test.ml" using the extension,|
ocamlfind ocamlc -syntax camlp4o -package foo.syntax test.ml
does not raise a syntax error, while for instance
ocamlbuild -use-ocamlfind -tag "package(foo.syntax)" test.pp.ml
does (because neither ocamlfind's -I-option nor the camlp4 extension archive name are included in the camlp4o invocation).
|Additional Information||I have discussed this with Anil Madhavapeddy which mentioned a related need on the mailing list:|
|Tags||No tags attached.|
I discussed this with xclerc and therefore mark this as "acknowledged".
If someone in the respected audience has a patch, please submit it! (Sane) contributions to fix ocamlbuild deficiencies are always welcome.
|So ocamlbuild just does not use ocamlfind in this case. This definetely needs fixing.|
This PR has in fact seen invisible progress: in the SVN commit 13262, Wojciech implemented a "-syntax <foo>" command-line option for ocamlbuild, meant to be used exactly as for ocamlfind. It is equivalent to passing the tag "syntax(foo)".
You can therefore use
ocamlbuild -use-ocamlfind -syntax camlp4o -package foo.syntax test.byte
to compile test.ml into test.byte.
For example for test.ml as such:
IFDEF BLAH THEN print_endline "foo" END
You can use the two equivalent commands:
ocamlbuild -use-ocamlfind -tag "syntax(camlp4o -DBLAH)" -package camlp4.macro test.byte
ocamlbuild -use-ocamlfind -syntax "camlp4o -DBLAH" -package camlp4.macro test.byte
However, the target .pp.ml still does not work as expected. I know of no easy way to call ocamlfind for only the preprocessing phase, and get source code as a result (in particular there is no "ocamlfind camlp4* -package ..." invocation possible.
Options for implementing this would be to:
(1) re-implement the build-camlp4-invocation-command logic in ocamlbuild (reusing the ocamlfind-like logic that was present before -use-ocamlfind was implemented), by calling "ocamlfind query" to get the right option to pass to the preprocessor; painful and probably not the best solution
(2) work-around the issue the issue by internally calling "ocamlfind ocamlc -syntax camlp4o ... -dsource" to convince ocamlfind that he's invoking a compiler, but actually get the postprocessed source code from ocaml. Not satisfying right now as there is no "-stop-after-parsing" flag to feed to the compiler, and it would still e.g. fail on ill-typed files. It's still a credible option, and in particular could be the best one if we want pp.ml to also perform -ppx rewritings.
(3) implement the "ocamlfind camlp4*" command. I have not contacted Gerd to know whether that would be possible, but I would suspect that if this (rather natural) feature is not present, he possibly has already considered that and has good reason not to do it.
In any case, none of those options are realistic during a feature freeze, so I'm moving the .pp.ml part of this bug (the rest I consider solved) to 4.02+dev.
ocamlbuild is now a separate project that lives on GitHub.
PR transferred to https://github.com/ocaml/ocamlbuild/issues/213 [^]
|2012-03-20 11:07||gasche||New Issue|
|2012-03-20 11:09||gasche||Note Added: 0007112|
|2012-03-20 11:09||gasche||Status||new => acknowledged|
|2012-07-10 11:27||doligez||Target Version||=> 4.01.0+dev|
|2012-07-31 13:36||doligez||Target Version||4.01.0+dev => 4.00.1+dev|
|2012-09-10 05:16||meyer||Note Added: 0008042|
|2012-09-10 05:16||meyer||Assigned To||=> meyer|
|2012-09-10 05:16||meyer||Status||acknowledged => assigned|
|2012-09-21 13:50||doligez||Target Version||4.00.1+dev => 4.01.0+dev|
|2013-06-16 19:38||gasche||Note Added: 0009518|
|2013-06-16 19:38||gasche||Assigned To||meyer => gasche|
|2013-06-16 19:38||gasche||Target Version||4.01.0+dev => 4.02.0+dev|
|2013-06-16 21:26||gasche||Severity||minor => feature|
|2013-07-12 18:15||doligez||Target Version||4.02.0+dev => 4.01.1+dev|
|2013-07-29 18:36||gasche||Relationship added||related to 0006102|
|2014-05-25 20:24||doligez||Target Version||4.01.1+dev => 4.02.0+dev|
|2014-08-21 11:52||doligez||Target Version||4.02.0+dev =>|
|2017-02-23 16:34||doligez||Category||OCamlbuild (the tool) => for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues [^]|
|2017-02-23 16:44||doligez||Category||for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues [^] => -for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues [^]|
|2017-03-03 15:26||doligez||Note Added: 0017544|
|2017-03-03 15:26||doligez||Status||assigned => resolved|
|2017-03-03 15:26||doligez||Resolution||open => suspended|
|Copyright © 2000 - 2011 MantisBT Group|