Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004613OCamlOCamlbuild (the tool)public2008-09-14 10:452013-06-17 15:57
Reporterjessicah 
Assigned Togasche 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionduplicate 
PlatformOSOS Version
Product Version3.11+dev 
Target Version4.02.0+devFixed in Version 
Summary0004613: Tries to build cmo files for native target(s)
DescriptionInvoking: ocamlbuild snowflake/asm.cmx, it tries to build snowflake/asm.cmo

I have also seen this issue in 3.10.0 & 3.10.2.

From what I can tell, ocamlbuild forces building of cmo when building cmi if no mli file is present.

Not only is it unnecessary work, ocamlbuild appears to throw away the cmo at some point, and rebuilds the cmo everytime ocamlbuild is run on a target that invokes this behaviour.
Additional InformationPart of the output from ocamlbuild with -verbose 10

Doing sanity checks
include directories are: [ "." ]
==> kernel/asm.cmx
====> kernel/asm.mlpack
====> kernel/asm.ml
kernel/asm.ml exists and up to date
====> kernel/asm.ml.depends
======> kernel/asm.ml
kernel/asm.ml already built
start rule ocaml dependencies ml (%=kernel/asm )
....
new dyndep for "ocaml: ml -> cmo & cmi (%=kernel/asm )"([ kernel/asm.cmo;
                                                          kernel/asm.cmi ]): "libraries/stdlib/pervasives.cmi"
TagsNo tags attached.
Attached Filespatch file icon ocamlbuild.snowflake.patch [^] (946 bytes) 2008-09-14 23:42 [Show Content]

- Relationships
related to 0004421closedertai ocamlbuild uses wrong compiler for C files 
has duplicate 0005282assignedxclerc .cmo files are generated even for native compilation 

-  Notes
(0004614)
jessicah (reporter)
2008-09-15 01:13

Attached a patch to avoid use of ocamlc in native-only projects.

Also tested building ocaml source tree with patch applied using build/fastworld.sh without error.

This should also resolve issue 0004421.

Might also be better to make condition more explicit, e.g. (Tags.mem "native" tags) and not (Tags.mem "byte" tags).
(0005256)
ygrek (reporter)
2010-03-04 18:07

Wouldn't it be sufficient to add native counterpart for the following rule (the only one that produces cmi currently, hence the problem):

rule "ocaml: ml -> cmo & cmi"
  ~tags:["ocaml"]
  ~prods:["%.cmo"; "%.cmi"]
  ~deps:["%.ml"; "%.ml.depends"]
  (Ocaml_compiler.byte_compile_ocaml_implem "%.ml" "%.cmo");;

i.e.

rule "ocaml: ml -> cmx & o & cmi"
  ~tags:["ocaml"; "native"]
  ~prods:["%.cmx"; x_o; "%.cmi"]
  ~deps:["%.ml"; "%.ml.depends"]
  (Ocaml_compiler.native_compile_ocaml_implem "%.ml");;

And add "%.mli" to the ~deps of rule "ocaml: ml & cmi -> cmx & o" (for the same purpose it is done for byte rules, to handle the situation when mli is provided).

Currently default rules suggest that cmi is required to build cmx, but this is not true, isn't it?
(0005434)
jessicah (reporter)
2010-05-01 12:03

That doesn't work. There is also the rule "ocaml: mli -> cmi" that'll trigger ocamlc over ocamlopt as well.

Given in normal circumstances, it doesn't affect anybody, might as well close issue.
(0009519)
gasche (developer)
2013-06-16 21:14

I just integrated in trunk the remaining bit of snowflake.patch that was not already in. Compiling .cmi from .mli now uses ocamlopt when the tag "native" is set.

If I understand the issue correctly, that was the last issue remaining for ygrek's proposal to be a satisfying solution to the original problem. However, I do not understand the reasons why the present implementation takes care to force using the ".cmi & .cmo" rule (as explicitly said in comments: "no cmi here you must make the byte version to have it"), so I don't want to rush implementing this.

ygrek, can you comment on why do you think the current implementation is as it is, and do you have confidence that your proposed change has no negative side-effects? Otherwise I'll try to ping Nicolas on this.

In any case, I relegate the remaining work to 4.02+dev.
(0009523)
ygrek (reporter)
2013-06-16 23:27

Sorry, no, I don't have enough expertise here, my proposal was based on a superficial glance over source.
(0009536)
gasche (developer)
2013-06-17 15:57

As the problem of the .cmo being built is also the topic of PR#5282, I will close this one to facilitate bugtracking.

- Issue History
Date Modified Username Field Change
2008-09-14 10:45 jessicah New Issue
2008-09-14 23:42 jessicah File Added: ocamlbuild.snowflake.patch
2008-09-15 01:13 jessicah Note Added: 0004614
2008-09-23 02:09 doligez Status new => assigned
2008-09-23 02:09 doligez Assigned To => ertai
2010-03-04 18:07 ygrek Note Added: 0005256
2010-05-01 12:03 jessicah Note Added: 0005434
2010-07-22 11:40 ertai Assigned To ertai => xclerc
2011-06-06 09:08 xclerc Relationship added has duplicate 0005282
2012-02-02 15:17 protz Category OCamlbuild => OCamlbuild (the tool)
2012-07-04 13:54 doligez Relationship added related to 0004421
2012-07-06 16:38 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 14:05 frisch Target Version 4.00.1+dev => 4.00.2+dev
2013-06-16 21:14 gasche Note Added: 0009519
2013-06-16 21:15 gasche Target Version 4.00.2+dev => 4.02.0+dev
2013-06-16 21:15 gasche Assigned To xclerc => gasche
2013-06-16 21:25 gasche Severity major => minor
2013-06-16 23:27 ygrek Note Added: 0009523
2013-06-17 15:57 gasche Note Added: 0009536
2013-06-17 15:57 gasche Status assigned => resolved
2013-06-17 15:57 gasche Resolution open => duplicate


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker