ok that works. But we are not supposed to know that using "pkgs" option also requires "use-ocamlfind" option. If "pkgs" is an ocamlfind feature, then why not activate "use-ocamlfind" at the same time? Or why not activate ocamlfind all the time?

Since the problem will go away after we implement -use-ocamlfind by default, I think the good fix for that would be to document the command line options that are not available with -no-ocamlfind, but also implement proper messages for all of them, and just halt the compilation with error if they are used with -no-ocamlfind.

Recording which command-line options and tags depend on the `-use-ocamlfind` option and reporting an error when they're used otherwise should be reasonably easy (marked as "junior job"). The trunk now uses -use-ocamlfind by default, but supporting -no-ocamlfind scenarios will still be useful for 4.01 (and possibly bugfixes releases).

* ocamlbuild -no-ocamlfind -pkgs lablgtk2 -tags warn_s tree.byte
gets the same strange warning : tag "package" does not expect a parameter, but is used with parameter "lablgtk2".
then there is an error (as modules from lablgtk2 are not found).
raising error explaining that "-pkgs" is not compatible with "-no-ocamlfind" would be more expressive for an end user point of view.

Right, it's not so obvious how to do this, and I'd like to postpone it for the next release. I care about the quality of such patches. If you write a good patch for it I will apply it straight away. And we need proper testing of these, preferable through the ocamlbuild testsuite.

There are two things that matter here:

* with the switches certain order is important, some of the flags just preclude other ones, but still you have a space for detecting these, and marking them redundant
* with the tags, the predicates might not trigger the tags to be included, especially the check might happen dynamically as the dependencies come.

> with the tags, the predicates might not trigger the tags to be included,
> especially the check might happen dynamically as the dependencies come.

I think that a tag that is never triggered by any dependency of any reasonable target for the project should ultimately trigger a warning, because it may be a typo (and is useless). I mentioned this in PR#5212, and I think that would an important but difficult improvement to OCamlbuild's usability.

So I think it's fine if we warn on cases where the tag would actually never have been used. I would be of the opinion to have a way to mark dependencies of some tags over some configuration options (may also be useful for, say, potential menhir-specific tags), and simply refuse to work (with a proper error message) when those dependencies are not satisfied.

There is something subtle here, which is that the -pkg option *can work* without -use-ocamlfind, it only uses a different (and somewhat complex and possibly fragile that I'm glad most users don't rely on anymore) way to do things, which is to call Findlib internally instead of offloading the work to ocamlfind. So the patch disables the warning, but it does not make mandatory to pass -use-ocamlfind in these circumstances.