Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005868OCamlOCaml tools (ocaml{lex,yacc,dep,browser,debug})public2013-01-01 15:462013-01-07 08:37
Reporterjderque 
Assigned Tomeyer 
PrioritylowSeveritytrivialReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version4.00.1 
Target VersionFixed in Version 
Summary0005868: ocamldep with -native option displays byte dependencies
DescriptionThe -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
}}}
TagsNo tags attached.
Attached Filespatch file icon ocamldep-native-flag.patch [^] (568 bytes) 2013-01-01 15:46 [Show Content]

- Relationships

-  Notes
(0008675)
meyer (developer)
2013-01-01 16:10

Fixed on trunk (commit 13194).
(0008676)
jderque (reporter)
2013-01-01 16:54

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.
(0008677)
meyer (developer)
2013-01-01 17:18

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
(0008686)
meyer (developer)
2013-01-03 18:36
edited on: 2013-01-03 18:38

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.

(0008690)
jderque (reporter)
2013-01-04 08:35

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.

- Issue History
Date Modified Username Field Change
2013-01-01 15:46 jderque New Issue
2013-01-01 15:46 jderque File Added: ocamldep-native-flag.patch
2013-01-01 15:59 meyer Assigned To => meyer
2013-01-01 15:59 meyer Status new => assigned
2013-01-01 16:10 meyer Note Added: 0008675
2013-01-01 16:54 jderque Note Added: 0008676
2013-01-01 17:18 meyer Note Added: 0008677
2013-01-03 18:36 meyer Note Added: 0008686
2013-01-03 18:38 meyer Note Edited: 0008686 View Revisions
2013-01-04 08:35 jderque Note Added: 0008690
2013-01-07 08:37 meyer Status assigned => closed
2013-01-07 08:37 meyer Resolution open => fixed
2013-08-19 15:58 doligez Category OCaml tools (ocaml{lex,yacc,dep,browser}) => OCaml tools (ocaml{lex,yacc,dep,browser,debug})


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker