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

ocamlbuild creates link for some files in .itarget #5305

Closed
vicuna opened this issue Jun 29, 2011 · 4 comments
Closed

ocamlbuild creates link for some files in .itarget #5305

vicuna opened this issue Jun 29, 2011 · 4 comments
Assignees

Comments

@vicuna
Copy link

vicuna commented Jun 29, 2011

Original bug ID: 5305
Reporter: Dmitry Grebeniuk
Assigned to: @lefessan
Status: closed (set by @xavierleroy on 2015-12-11T18:04:36Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 3.12.1+dev
Fixed in version: 4.00.0+dev
Category: -for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues
Monitored by: @ygrek

Bug description

ocamlbuild creates links for .cm{i,o,a,xa,xs}-files in current directory and then complains that the directory is dirty:

$ ocamlc -version
3.12.1+rc1

$ ls -lab
total 16
drwxr-xr-x 2 gds gds 4096 Jun 29 13:14 .
drwxrwxrwt 23 root root 4096 Jun 29 13:09 ..
-rw-r--r-- 1 gds gds 6 Jun 29 13:08 a.itarget
-rw-r--r-- 1 gds gds 28 Jun 29 13:03 a.ml

$ cat a.itarget
a.cma

$ cat a.ml
let () = print_string "q\n"

$ ocamlbuild a.otarget
Finished, 4 targets (0 cached) in 00:00:00.

$ ls -lab
total 20
drwxr-xr-x 3 gds gds 4096 Jun 29 13:15 .
drwxrwxrwt 23 root root 4096 Jun 29 13:09 ..
drwxr-xr-x 2 gds gds 4096 Jun 29 13:15 _build
lrwxrwxrwx 1 gds gds 12 Jun 29 13:15 a.cma -> _build/a.cma
-rw-r--r-- 1 gds gds 6 Jun 29 13:08 a.itarget
-rw-r--r-- 1 gds gds 28 Jun 29 13:03 a.ml

$ ocamlbuild a.otarget
SANITIZE: a total of 1 file that should probably not be in your source tree
has been found. A script shell file "_build/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 Ocaml compilation files:
File a.cma in . has suffix .cma
Exiting due to hygiene violations.
Compilation unsuccessful after building 0 targets (0 cached) in 00:00:00.

$

@vicuna
Copy link
Author

vicuna commented Jun 29, 2011

Comment author: Dmitry Grebeniuk

As I see now, the problem is not in the created symlinks, but in the way the ocamlbuild determines whether the directory is dirty. For example, in a slightly modified example the .byte and .native files are handled as "clean" (look at the list with "Leftover Ocaml compilation files"):

$ ls -lab
total 20
drwxr-xr-x 3 gds gds 4096 Jun 29 13:21 .
drwxrwxrwt 24 root root 4096 Jun 29 13:21 ..
drwxr-xr-x 2 gds gds 4096 Jun 29 13:21 _build
lrwxrwxrwx 1 gds gds 13 Jun 29 13:21 a.byte -> _build/a.byte
lrwxrwxrwx 1 gds gds 12 Jun 29 13:21 a.cma -> _build/a.cma
lrwxrwxrwx 1 gds gds 12 Jun 29 13:21 a.cmi -> _build/a.cmi
lrwxrwxrwx 1 gds gds 12 Jun 29 13:21 a.cmo -> _build/a.cmo
lrwxrwxrwx 1 gds gds 13 Jun 29 13:21 a.cmxa -> _build/a.cmxa
lrwxrwxrwx 1 gds gds 13 Jun 29 13:21 a.cmxs -> _build/a.cmxs
-rw-r--r-- 1 gds gds 48 Jun 29 13:20 a.itarget
-rw-r--r-- 1 gds gds 28 Jun 29 13:17 a.ml
lrwxrwxrwx 1 gds gds 15 Jun 29 13:21 a.native -> _build/a.native

$ ocamlbuild a.otarget
SANITIZE: a total of 4 files that should probably not be in your source tree
has been found. A script shell file "_build/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 Ocaml compilation files:
File a.cmo in . has suffix .cmo
File a.cmi in . has suffix .cmi
File a.cma in . has suffix .cma
File a.cmxa in . has suffix .cmxa
Exiting due to hygiene violations.
Compilation unsuccessful after building 0 targets (0 cached) in 00:00:00.

$

@vicuna
Copy link
Author

vicuna commented Jun 29, 2011

Comment author: Dmitry Grebeniuk

I've found this bug while installing "batteries": "make install" failed after "make all".

@vicuna
Copy link
Author

vicuna commented Jul 16, 2011

Comment author: elehack

Passing -no-links to ocamlbuild serves as a workround for this bug, and that is what we are currently doing in the Batteries sources.

@vicuna
Copy link
Author

vicuna commented May 15, 2012

Comment author: @lefessan

ocamlbuild won't complain anymore about remaining links to the _build/ directory.

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

2 participants