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
mlpack file not included correctly #6326
Comments
Comment author: spyder I've just found #5752 which indicates the original fix hasn't been released yet. I did a build of trunk and my particular issue still exists. |
Comment author: @gasche On my machine, adding the -r option to ocamlbuild, or adding an empty _tags or myocamlbuild.ml (which is another way to enable recursive traversal by default) makes your code compile fine. |
Comment author: spyder That does fix it, but I was avoiding recursive traversal because I thought that would add the entire triangle subfolder to the namespace. However when I attempt to use module Green within main.ml, it gives me an error even with -r. What are the rules around recursive traversal? |
Comment author: @gasche There is a different between "include" and "traverse" that is more or less explained in the manual ( http://caml.inria.fr/pub/docs/manual-ocaml/ocamlbuild.html#sec388 ):
"traverse" is set to true whenever there is either a _tags or myocamlbuild.ml file at the directory from which you launch the ocamlbuild command, and false otherwise -- to avoid the "ocamlbuild takes hour to do nothing if I mistakenly run it from my /home" effect. |
Comment author: spyder ok. That's a little bit confusing, I didn't understand include vs traverse at all from my reading of the docs until you pointed it out. But I can see the difference now. Now that I know what's happening, I added "true: traverse" to my src/_tags file (not present in the example) which also solves the problem without asking ocamlbuild to traverse my entire project. |
Comment author: @gasche Thanks for the feedback. If you have concrete suggestions for a clearer rewording of the documentation, I'm all ears. |
Comment author: spyder That's a tough one. I don't think I've seen any other build system that can traverse for dependencies to build with but not include them in the namespace; the concepts are usually linked and that's what I expected when I was reading the docs. They didn't really explain how traversal was different to include, so I assumed they were basically the same. You could copy/paste what you wrote here to the start of the subdirectories documentation and it would be a massive help :) |
Comment author: @gasche The distinction is important in OCaml if/when several subdirectories have compilation units of the same (base)name: the compiler itself, but also the tool around it, will react very badly if a single "compilation run" see them at the same time. With the current design, you may have a prog.x86.mlpack that refers to x86/Backend, and prog.x86-64.mlpack that refer to x86-64/Backend, with both subdirectories traversed but not included at each run. |
Comment author: spyder I'm getting it now :) These are all concepts that are probably familiar to experienced OCaml developers but I'm still very new, having spent most of my career developing in Java. For someone like me that traversal vs include explanation you gave above would be invaluable to include in the docs. |
Original bug ID: 6326
Reporter: spyder
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2015-12-11T18:25:44Z)
Resolution: not a bug
Priority: high
Severity: minor
Platform: Mac OS X
OS: Mac OS X
OS Version: 10.9.1
Version: 4.01.0
Category: -for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues
Related to: #5752
Monitored by: @gasche
Bug description
I am new to OCaml, and attempting to make ocamlbuild fit in with my existing project structure. Everything appeared to be going well until I made an mlpack file.
Rather than a flat structure as most projects seem to have, I keep my source code in a "src" folder and run ocamlbuild like this:
ocamlbuild src/main.native
This fails when main depends on a packed module that is also in the src folder.
Steps to reproduce
Extract the attached packdep.zip, open a terminal in the packdep folder
run:
ocamlbuild src/main.native
Additional information
I found the solution in this email report from 2010:
https://groups.google.com/forum/#!topic/fa.caml/c5Q8q6ZdvDw
If you rename "notmyocamlbuild.ml" to "myocamlbuild.ml" then the build works. This is not an acceptable workaround for my issue as any subfolders of src containing mlpack files must be added to the hard coded list in myocamlbuild.ml.
It looks like the patch from that old email was merged:
a3c8cd0
However I suspect my issue is subtly different (perhaps modules is not an empty list) and thus my issue still exists.
File attachments
The text was updated successfully, but these errors were encountered: