Support for out-of-source builds by make scripts of this software
How do you think about to benefit from parallel build trees also for your software? Would you like to support out-of-source (VPATH) builds?
I don't think there is any practical benefit to almost any ocamlbuild user or developer but any PRs implementing this are welcome.
Hi Markus,
From my point of view, these features are low-priority. The vast majority of ocamlbuild users use it through OPAM, so they don't care how it is build internally as long as the build is not embarrassingly slow. The features of its Makefile are only relevant to its developers, and I personally don't care much about improving it -- my time is limited and there are many other things that I feel are more important. So I won't invest time to support these features; but of course I am not opposed to others doing so if they see a need for it. If you have pull requests / patch proposals to support these, I would be happy to merge them as long as they don't make the codebase harder to maintain or inconvenience people not using them.
Would you ever like to store your source files for this special build tool in a read-only directory?
No one builds ocamlbuild like that.
- How should your software be built if the corresponding source files will be distributed on a medium like CD-ROM?
- Do other packagers need also a writeable target directory while the sources should be kept unmodified in a different and protected folder?
We are not interested in discussing the merits of out-of-tree builds, which are well-understood. We do not have any plans to support out-of-tree builds in ocamlbuild. You are welcome to implement them.
- How much can corresponding development efforts depend on functionality by the tool “GNU Make”?
- Do you care for portability of make scripts?
OCaml itself can be built with nmake; I'm not sure about ocamlbuild but so long as OCaml can be built with nmake it would be nice if ocamlbuild could also be built with nmake.
However, I've heard that OCaml is being migrated to GNU autotools (which of course precludes using nmake). @gasche, do you know anything about this? Was that just about the configure script?
I think that it is now a consensus among the OCaml development team that it is ok to rely on features of GNU make that do not exist in, say, BSD make. I think there is indeed a plan to use autotools for configuration, but I don't know the details.
(Given that most systems have GNU Make available these days, I was under the impression that assuming it does not restrict portability.)
I imagine that the special variable “VPATH” could be supported together with other usual make variables already. But you are using conditional directives in the affected make script already. So I am unsure if you would like to support the software “Automake” then because of portability concerns.
I have achieved a bit of progress with building your software by the approach “Automake”. Unfortunately, I stumbled on the following error situation.
elfring@Sonne:~/Projekte/Bau/OCamlbuild> LANG=C make -r V=1
…
man/options_man.byte > man/ocamlbuild.options.1
Fatal error: exception Invalid_argument("String.sub / Bytes.sub")
make: *** [Makefile:856: man/ocamlbuild.options.1] Error 2
How can the affected source code be improved?
I cannot reproduce the fact that man/options_man.byte fails on my machine. What is you OCaml version, and your OCamlbuild version/patchset?
I am trying to get the Automake approach working based on your commit (from 2017-06-23) together with the software “OCaml 4.03.0-3.1” on my openSUSE Tumbleweed system.
It seems that my knowledge is incomplete for another software dependency so far.
elfring@Sonne:~/Projekte/Bau/OCamlbuild> LANG=C make -r V=1
…
ocamlc.opt -w L -w R -w Z -I src/ -I +unix -safe-string -bin-annot -c -o src/ocamlbuild.cmo src/ocamlbuild_pack.cmo /home/elfring/Projekte/OCaml/OCamlbuild/lokal/src/ocamlbuild.ml
File "/home/elfring/Projekte/OCaml/OCamlbuild/lokal/src/ocamlbuild.ml", line 17, characters 0-25:
Error: Unbound module Ocamlbuild_pack.Main
make: *** [Makefile:802: src/ocamlbuild.cmo] Error 2
How should this issue be tackled?
It seems that your experiment to improve the build system have broken the build. I don't know what you are trying to do, so I'm afraid I don't know how to help you.
Note that, as mentioned earlier, I'm not sure that the feature you are trying to implement will actually be useful to our users. (It might be useful to you, but you haven't yet explained why.) If you want to contribute to OCamlbuild, you are of course free to work on anything you choose, but there are other features that our users asked for and that I hope would not be too difficult to implement, and could be a good use of your time/effort; see #226 and #215 for example.
It seems that your experiment … have broken the build.
This software build alternative is just evolving as usual. I find that the make script which is used so far does not express a direct source dependency on the file “ocamlbuild.cmo”. Do I need to add any other compilation (or linking) parameter to the mentioned command?
It might be useful to you, but you haven't yet explained why.
Are you aware of benefits from using Automake for safer software builds?
See the opam file for the build sequence that most users use. First make -f configure.make all (plus user-provided configuration options) and then make all install.
There is a dependency from ocamlbuild.byte to ocamlbuild.cmo in the makefile. man/options_man.byte only depends on src/ocamlbuild_pack.cmo, I think.
The file “ocamlbuild.ml” is using the specification “Ocamlbuild_pack.Main”. Do you get any further ideas why this reference is not resolved so far by the generated compilation command as expected at the moment?
Can any progress be achieved for the following information?
elfring@Sonne:~/Projekte/Bau/OCamlbuild> rm -f man/options_man.byte && LANG=C OCAMLRUNPARAM=b make man/ocamlbuild.options.1
…
ocamlc.opt -I 'o/bin/' -o 'man/options_man.byte' 'o/bin/ocamlbuild_pack.cmo' '/home/elfring/Projekte/OCaml/OCamlbuild/lokal/man/options_man.ml'
man/options_man.byte > man/ocamlbuild.options.1
Fatal error: exception Invalid_argument("String.sub / Bytes.sub")
Called from unknown location
Called from unknown location
make: *** [Makefile:858: man/ocamlbuild.options.1] Error 2
The command variant “make -r byte native” seems to work on my test system at the moment successfully.
- Would it make sense to contribute another pull request?
- Can remaining software surprises be clarified better then?