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

Support for out-of-source builds by make scripts of this software #245

Open
elfring opened this issue Jul 1, 2017 · 19 comments
Open

Support for out-of-source builds by make scripts of this software #245

elfring opened this issue Jul 1, 2017 · 19 comments

Comments

@elfring
Copy link

elfring commented Jul 1, 2017

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?

@whitequark
Copy link
Member

I don't think there is any practical benefit to almost any ocamlbuild user or developer but any PRs implementing this are welcome.

@gasche
Copy link
Member

gasche commented Jul 1, 2017

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.

@elfring
Copy link
Author

elfring commented Jul 1, 2017

Would you ever like to store your source files for this special build tool in a read-only directory?

@whitequark
Copy link
Member

No one builds ocamlbuild like that.

@elfring
Copy link
Author

elfring commented Jul 1, 2017

  • 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?

@whitequark
Copy link
Member

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.

@elfring
Copy link
Author

elfring commented Jul 1, 2017

@whitequark
Copy link
Member

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?

@gasche
Copy link
Member

gasche commented Jul 1, 2017

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.)

@elfring
Copy link
Author

elfring commented Jul 1, 2017

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.

@elfring
Copy link
Author

elfring commented Jul 5, 2017

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?

@gasche
Copy link
Member

gasche commented Jul 5, 2017

I cannot reproduce the fact that man/options_man.byte fails on my machine. What is you OCaml version, and your OCamlbuild version/patchset?

@elfring
Copy link
Author

elfring commented Jul 5, 2017

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.

@elfring
Copy link
Author

elfring commented Jul 6, 2017

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?

@gasche
Copy link
Member

gasche commented Jul 6, 2017

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.

@elfring
Copy link
Author

elfring commented Jul 6, 2017

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?

@gasche
Copy link
Member

gasche commented Jul 6, 2017

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.

@elfring
Copy link
Author

elfring commented Jul 6, 2017

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?

@elfring
Copy link
Author

elfring commented Jul 15, 2017

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?

elfring added a commit to elfring/ocamlbuild that referenced this issue Jul 17, 2017
…on working together with Autoconf and Automake

The provided make script contained restrictions for storage locations
according to the combination of source files and the corresponding generation
of further file variants. These software limitations were lifted by the
addition of two build scripts which use functionality from the tools
“Autoconf” and “Automake” to some degree.

Some build settings were adjusted in the way that make rules are automatically
constructed by special function calls.
The dependency on the tool “GNU Make” was expressed then.


This development result is published despite of known open issues.

Examples:

1) Generation approach for the manual with the version “OCaml 4.03.0-3.1”
   on an openSUSE Tumbleweed system

   elfring@Sonne:~/Projekte/Bau/OCamlbuild> rm -f man/options_man.byte && LANG=C OCAMLRUNPARAM=b make man/ocamlbuild.options.1
   …
   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: *** [GNUmakefile:859: man/ocamlbuild.options.1] Error 2

2) Difficulties with parallel software builds

   A command like “ocamlc.opt -pack” will be called by a make rule.
   It has got the property that three output files can be generated.
   Such a detail causes recurring challenges for the safe application of
   the involved software so far.
   https://www.cmcrossroads.com/article/rules-multiple-outputs-gnu-make
   https://lists.gnu.org/archive/html/help-make/2014-11/msg00013.html

3) The test scripts for this evolving tool will need related updates.
   They were left over for further development considerations.

4) The selection of default values for a working build configuration could
   eventually become more convenient and safer then.

Signed-off-by: Markus Elfring <[email protected]>
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

3 participants