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
automatic integration of packages used at compile time for link time #5567
Comments
Comment author: @protz I think your <.ml> only kicks at compile-time. What about a <.cm*> line that asks for the package too? |
Comment author: william I added your line : file Libs/_tags : But still the same error : ocamlbuild -use-ocamlfind -Is Libs hello.d.byte --
|
Comment author: @gasche You can understand why your build does not work by looking at ocamlbuild _log output.
What you learn by looking at this is that the flag package(xml-light) But this is not a bug: ocamlbuild behaves as you specified (xml-light If, instead of hello.d.byte, you asked to compile hello.cmo (which |
Comment author: @gasche I'm marking this as resolved to take it off the bugtracker radar. Do not hesitate, though, to ask additional questions on the matter. (There might be some change that could be done to make what you're doing work as you believe it should. Frankly, I don't think so, as I think the semantics is rather clear here. If someone comes up with a very good explanation of how it should behave to make this work, and it is as simple and easy to implement as the current one, why not, but one shouldn't count on it too much.) |
Comment author: william The log is clear indeed. |
Comment author: @gasche If I understand it correctly, the current way ocamlbuild computes tags to apply for a particular compilation command is to look at all the rules that match the target of the compilation (here hello.d.byte). What you expected is that those tags also apply to compilations that have these Libs/foo.cmo files as dependency rather that target. Or, conversely, that Libs/foo.cmo could specify tags for files that use it, in addition to its own compilation. That could make sense, but it seems it would incur some redesign of the ocamlbuild semantics (which is currently simply defined in terms of target). I mean, you don't want to add dubious heuristics that would fire in some cases but not in others: you want rules that are general and simple to describe and apply. I'm not sure what that could be here. PS: there could be cases where you want to link an ocamlfind package for compilation, but it is not needed for linking: if the ocamlfind package only exports type and interfaces, but no executable code (admittedly this is not too common). You could also include ocamlfind packages that export syntax extensions, and again once the file has been preprocessed, the next targets that depend on it need not know about this package. If you really feel that would be an important improvement to ocamlbuild, I could reflag this as a feature request. Quite frankly, it looks like it would be a lot of work to do it right (and we don't want to do it wrong and have to support it forever), and the current state is reasonable, so that would not be high-priority. On the other hand, if you are interested in experimenting with this / implementing something like this, this could be discussed -- help implementing other feature requests or fixing bugs is also appreciated, of course. |
Comment author: william ok, what you say is that this feature is not compatible with the actual design of ocamlbuild, and it does no worth making big changes for this, which I fully understand. Thanks, |
Original bug ID: 5567
Reporter: william
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2015-12-11T18:04:26Z)
Resolution: not a bug
Priority: low
Severity: feature
Version: 3.12.1
Category: -for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues
Bug description
Hello,
ocamlbuild is very handy when I want to include subdirectories :
$ ocamlbuild -Is Libs target.byte
However, if packages (lablgtk2, xml-light, ...) are used in Libs and declared in _tags files, I still need to mention them in the compile command :
file Libs/_tags :
<*.ml> : package(xml-light)
compile command I must run :
$ ocamlbuild -Is Libs -use-ocamlfind -pkgs xml-light hello.byte
ideal compile command :
$ ocamlbuild -Is Libs
Attached is the example.
Would it be possible to automatically integrate at link time packages used for compile time?
Best Regards,
William
File attachments
The text was updated successfully, but these errors were encountered: