Skip to content
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

Internal error in OCamlbuild when using non_dependency #6755

Closed
vicuna opened this issue Jan 20, 2015 · 3 comments
Closed

Internal error in OCamlbuild when using non_dependency #6755

vicuna opened this issue Jan 20, 2015 · 3 comments

Comments

@vicuna
Copy link

vicuna commented Jan 20, 2015

Original bug ID: 6755
Reporter: dario
Status: resolved (set by @damiendoligez on 2017-02-24T12:26:11Z)
Resolution: suspended
Priority: normal
Severity: minor
Version: 4.02.1
Target version: later
Category: -for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues
Monitored by: @gasche @hcarty

Bug description

I wanted to let OCamlbuild know that the module "src/foo.ml" has actually zero dependencies, instead of depending on Foo_a, Foo_b, and Foo_c as determined by OCamldep. I have used the extensionless notation described in the OCamlbuild API, as exemplified below:

let my_dispatcher = function
| After_rules ->
non_dependency "src/foo" "Foo_a";
non_dependency "src/foo" "Foo_b";
non_dependency "src/foo" "Foo_c"
| _ -> ()

This fails with an internal error:

INTERNAL ERROR: Invalid argument non_dependency: no extension
This is likely to be a bug, please report this to the ocamlbuild
developers.

(Replacing "src/foo" with "src/foo.ml" does work, though)

@vicuna
Copy link
Author

vicuna commented Jan 24, 2015

Comment author: @gasche

I just reproduced your issue. I think there is a mistake in the API documentation (signatures.mli) which currently says:

(** [non_dependency module_path module_name]
Example:
[non_dependency "foo/bar/baz" "Goo"]
Says that the module [Baz] in the file [foo/bar/baz.*] does
not depend on [Goo]. *)
val non_dependency : Pathname.t -> string -> unit

while the implementation actually requires the first parameter to be a pathname, rather than a module_path, that is a path to an actual file of the project.

Could you confirm that using "src/foo.ml" instead of "src/foo" in your myocamlbuild.ml fixes the issue? If it works, then I will correct the .mli documentation.

I'll also try to see if there is a reasonable way to lift this restriction, and give a semantics to the module_path version. It seems to me that, morally, considering "src/foo" as a glob pattern for "src/foo.*" and calling non_dependency on all matching files in the projet would be a reasonable choice.

@vicuna
Copy link
Author

vicuna commented Jan 25, 2015

Comment author: dario

Yes, I mentioned at the end of my initial report, replacing "src/foo" with "src/foo.ml" does work. I think it's okay to categorise this as just a documentation problem. Lifting the restriction would be welcome, but given that there's little burden on using pathname instead of module_path, just fixing the documentation might be the most sensible approach.

@vicuna
Copy link
Author

vicuna commented Feb 24, 2017

Comment author: @damiendoligez

ocamlbuild is now a separate project that lives on GitHub.
PR transferred to ocaml/ocamlbuild#150

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant