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

ocamldep with -native option displays byte dependencies #5868

Closed
vicuna opened this issue Jan 1, 2013 · 5 comments
Closed

ocamldep with -native option displays byte dependencies #5868

vicuna opened this issue Jan 1, 2013 · 5 comments

Comments

@vicuna
Copy link

vicuna commented Jan 1, 2013

Original bug ID: 5868
Reporter: jderque
Assigned to: meyer
Status: closed (set by meyer on 2013-01-07T07:37:54Z)
Resolution: fixed
Priority: low
Severity: trivial
Version: 4.00.1
Category: tools (ocaml{lex,yacc,dep,debug,...})
Monitored by: meyer meurer

Bug description

The -native flag of ocamldep is documented as preventing any dependencies regarding cmo files from being displayed. The following happens though:

{{{
$ ./byterun/ocamlrun ./tools/ocamldep -native stdlib/pervasives.ml
stdlib/pervasives.cmo : stdlib/pervasives.cmi
stdlib/pervasives.cmx : stdlib/pervasives.cmi
}}}

File attachments

@vicuna
Copy link
Author

vicuna commented Jan 1, 2013

Comment author: meyer

Fixed on trunk (commit 13194).

@vicuna
Copy link
Author

vicuna commented Jan 1, 2013

Comment author: jderque

meyer: I'm not sure about your fix, here is what outputs ocamldep now:

$ ./byterun/ocamlrun ./tools/ocamldep -native stdlib/pervasives.ml
: stdlib/pervasives.cmi
stdlib/pervasives.cmx : stdlib/pervasives.cmi

The whole line should be discarded, not just the part before the colon sign.

@vicuna
Copy link
Author

vicuna commented Jan 1, 2013

Comment author: meyer

Ah apologises.. yes, I missed somewhat that from my sight today, thanks for reporting back so quickly!

Now commit 13195 fixes it:

$ ./byterun/ocamlrun ./tools/ocamldep -native stdlib/pervasives.ml
stdlib/pervasives.cmx : stdlib/pervasives.cmi

$./byterun/ocamlrun ./tools/ocamldep stdlib/pervasives.ml
stdlib/pervasives.cmo : stdlib/pervasives.cmi
stdlib/pervasives.cmx : stdlib/pervasives.cmi

@vicuna
Copy link
Author

vicuna commented Jan 3, 2013

Comment author: meyer

After consulting the issue thouroughly, the conclusion is that it's not a real bug but really a misunderstanding how the -native flag should work (and perhaps the documentation should clarify this better). Here is a short explanation why:

-native flag semantics are currently different to that what the user expects, and what was attempted to be fixed. The semantics of -native
are not to completely disable generation of dependencies for bytecode instead make the compilation to native code more efficient.

Most of the project are expected to be buildable with both versions of the compiler. So ocamldep is expected to always generate the
dependencies in both cases. When the .mli file is absent ocamldep needs to still generate dependencies in bytecode to build the cmi only
and to build cmi and cmx for the dependent compilation unit . Because of some make tool pecularities, handling of two different rules that
include the same depenency is problematic, so instead when the -native flag is not used the cmo file is used as a proxy to build cmi, when
the -native enabled however, the cmx file is used as proxy to build cmi file for the dependencies to avoid recompilation of the dependent
.cmo file just to get .cmi file.

Hope it makes sense. I'm putting this into suspended state, and instead the documentation will be considered to be improved.

@vicuna
Copy link
Author

vicuna commented Jan 4, 2013

Comment author: jderque

That's fine with me. I think I'll go with 'ocamldep -one-line ... | grep myfile.cmx' for my particular use case. Feel free to revert any relevant changes and close the issue.

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