|Anonymous | Login | Signup for a new account||2015-09-02 04:29 CEST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0004410||OCaml||OCaml general||public||2007-10-01 04:38||2010-04-29 14:26|
|Target Version||Fixed in Version||3.10+dev|
|Summary||0004410: bug in ocamlbuild (building a plugin with -build flag set) plus suggested fix|
|Description||I use ocaml regularly and have been looking forward to upgrading to 3.10 and using ocamlbuild. I use a combination of windows, cygwin and mingw, and cross-compile on linux (CentOs 4) as well. I discovered a bug in ocamlbuild-0.1 (as included in the ocaml-3.10.0 distribution). When building a plugin using a myocamlbuild.ml file, if the -build-dir option is specified and the build directory does not start with an underscore ('_'), the plugin will build properly but when ocamlbuild actually compiles and executes the plugin the following error is raised:|
================ BEGIN DUMP ===============
ocamlbuild -install-lib-dir "C:\\devtools\\ocaml-3.10\\lib\\ocamlbuild" -build-dir .build -no-links -log .log src/main.byte
ocamlopt -I "C:\devtools\ocaml-3.10\lib\ocamlbuild" unix.cmxa "C:\devtools\ocaml-3.10\lib\ocamlbuild/ocamlbuildlib.cmxa" myocamlbuild.ml "C:\devtools\ocaml-3.10\lib\ocamlbuild/ocamlbuild.cmx" -o myocamlbuild
SANITIZE: a total of 6 files that should probably not be in your source tree
has been found. A script shell file "sanitize.sh" is being created. Check
this script and run it to remove unwanted files or use other options (such
as defining hygiene exceptions or using the -no-hygiene option).
IMPORTANT: I cannot work with leftover compiled files.
ERROR: Leftover dependency files:
File main.ml.depends in .build/src has suffix .ml.depends
ERROR: Leftover Ocaml compilation files:
File main.cmo in .build/src has suffix .cmo
File main.cmi in .build/src has suffix .cmi
ERROR: Leftover object files:
File myocamlbuild.o in .build has suffix .o
ERROR: Leftover Ocaml compilation files:
File myocamlbuild.cmi in .build has suffix .cmi
File myocamlbuild.cmx in .build has suffix .cmx
Exiting due to hygiene violations.
make: *** [wxO.exe] Error 1
================ END DUMP ===============
As you can see, I prefer to name my build directory ".build". This causes the above mentioned problem. Building instead using "_build" or "_bld" or any other name with an initial underscore, or not using the -build-dir flag, does not cause this problem and the plugin executes correctly. The reason for this error is the following set of lines from ocamlbuild/main.ml, in the definition of 'entry' in the proceed() function:
(String.length name > 0 && name. <> '_' && not (List.mem name !Options.exclude_dirs))
An easy fix is to add the build directory to the list of excluded paths in the invocation of ocamlbuild:
ocamlbuild -build-dir $(BUILDDIR) -X $(BUILDDIR) etc.
This seems like a less than ideal solution, however. I believe this term:
name. <> '_'
should be excluded from the conditional guard/clause, and instead it should be replaced with:
name <> !Options.build_dir
or that Options.build_dir should be added to Options.exclude_dirs (this latter solution doesn't seem as good because (though this does not currently seem to be the case) exclude_dirs could be used in other places in the system or in plugins).
I thought I might submit an actual patch but I think I will not have time to test it properly, so I decided to just describe a fix instead. I searched the archive but did not find this bug anywhere. The closest match was probably 0004387 (ocamlbuild doesn't use build directory properly), but it's not really the same issue.
|Tags||No tags attached.|
Thanks for your report.
In the next version <<name <> !Options.build_dir>> will be added.
However note that there is another way to specify the exclusion using the tag system:
$ cat _tags
|Thanks for the report. This is now fixed in the CVS (both in trunk and release310 branch).|
|2007-10-01 04:38||inalan||New Issue|
|2007-11-10 14:12||xleroy||Status||new => assigned|
|2007-11-10 14:12||xleroy||Assigned To||=> ertai|
|2007-11-14 20:29||ertai||Note Added: 0004318|
|2007-11-26 14:26||ertai||Note Added: 0004351|
|2007-11-26 14:26||ertai||Status||assigned => resolved|
|2007-11-26 14:26||ertai||Resolution||open => fixed|
|2007-11-26 14:26||ertai||Fixed in Version||=> 3.10+dev|
|2007-11-26 14:26||ertai||Description Updated|
|2010-04-29 14:26||xleroy||Status||resolved => closed|
|Copyright © 2000 - 2011 MantisBT Group|