[MDEV-6248] GUI-friendly cmake options to enable/disable plugins Created: 2014-05-16  Updated: 2015-10-24  Due: 2014-09-18  Resolved: 2014-06-24

Status: Closed
Project: MariaDB Server
Component/s: None
Fix Version/s: 10.1.0

Type: Task Priority: Minor
Reporter: Sergei Golubchik Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None


 Description   

Currently cmake uses WITH_XXX, WITHOUT_XXX, WITH_XXX_STORAGE_ENGINE, WITHOUT_XXX_STORAGE_ENGINE to specify what plugins should be compiled and how. They are

  • mixed in the GUI with WITH_PCRE, WITH_JEMALLOC, WITH_PIC, and the such, plugin variables are not easy to spot
  • redundant and confusing, one can have any subset (including empty) of WITH_XXX, WITHOUT_XXX, WITH_XXX_STORAGE_ENGINE, WITHOUT_XXX_STORAGE_ENGINE defined, it's not immediately clear what the behavior is in these cases
  • they do not necessarily exist in a GUI, some of them are. E.g to disable innodb one needs to do cmake -DWITHOUT_INNOBASE=1 (creating the option), one cannot do it in a GUI, because there is no WITHOUT_INNOBASE option to change)

This is the current behavior (ignoring *_STORAGE_ENGINE variants):

WITH_XXX WITHOUT_XXX plugin XXX supports result
OFF OFF static builds only not built
OFF ON static builds only not built
ON OFF static builds only built statically
ON ON static builds only built statically
OFF OFF dynamic builds only built dynamically
OFF ON dynamic builds only not built
ON OFF dynamic builds only built dynamically
ON ON dynamic builds only not built
OFF OFF both built dynamically
OFF ON both not built
ON OFF both built statically
ON ON both built statically

In this task we implement a set of BUILD_PLUGIN_XXX options:

  • they will sort in a distinct group, all together, not intermixed with other non-plugin options
  • the values will be STATIC, DYNAMIC, NO, which (hopefully) clearly specifies whether a plugin will be built and how.
  • WITH_XXX, WITHOUT_XXX, etc values are recognized (if defined on the command line) and work as before, but they are never set in our cmake files, so they never show up in a GUI.

This is the new behavior:

BUILD_PLUGIN_XXX plugin XXX supports result
STATIC static builds only built statically
DYNAMIC static builds only not built
NO static builds only not built
STATIC dynamic builds only built dynamically
DYNAMIC dynamic builds only built dynamically
NO dynamic builds only not built
STATIC both built statically
DYNAMIC both built dynamically
NO both not built

Thus BUILD_PLUGIN_XXX can be explained as «the highest desired plugin integration level». For example, if it is set to STATIC, but plugin does not support static builds — okay, it'll be built dynamically. But if we want at most DYNAMIC integration level and the plugin only supports static, it will not be built at all.



 Comments   
Comment by Elena Stepanova [ 2014-05-16 ]

I think the semantics is not flawless, and I expect there will be some confusion (and probably bug reports), particularly due to this combination:

STATIC	dynamic builds only	built dynamically

The problem is, comparing to the old semantics, awful as it was, we are losing one value. Previously we had 4:

  • both dynamic and static are allowed (WITH=ON, WITHOUT=OFF) => build static if possible, dynamic otherwise;
  • only static is allowed (WITH=ON, WITHOUT=ON) => build static if possible, none otherwise;
  • only dynamic is allowed (WITH=OFF, WITHOUT=OFF) => build dynamic if possible, none otherwise;
  • nothing is allowed (WITH=OFF, WITHOUT=ON) => do not build.

With the new values, we have
BUILD=NO equals WITH=OFF, WITHOUT=ON
BUILD=DYNAMIC equals WITH=OFF, WITHOUT=OFF
BUILD=STATIC equals WITH=ON, WITHOUT=OFF.

Thus, we have lost WITH=ON, WITHOUT=ON, and semantics of the last line is wrong.
BUILD=STATIC should be equal to WITH=ON, WITHOUT=ON.
And for WITH=ON, WITHOUT=OFF, we should have a 4th value, BUILD="yes", or "auto", or something, which would be the default and which would mean choosing the best possible option.

IIRC we have a similar thing for SSL (yes/system/bundled/no).

Comment by Sergei Golubchik [ 2014-05-16 ]

Right. I considered the case when both WITH and WITHOUT are used as "undefined
behavior", I'm a bit surprised it actually provided consistent results

I don't know whether it was intentionally implemented to "allow only static"
or it just happened to behave this way. So, I didn't try to replicate this
case in the new implementation.

But ok, I can do it your way too.

Comment by Kristian Nielsen [ 2014-06-18 ]

We discussed on IRC the following idea:

Currently, if user specifies eg. -DWITH_CASSANDRA_STORAGE_ENGINE=1, but some dependency is missing and Cassandra cannot be built, the cmake run will still succeed. It does give a warning about not using the option, but since the exit code is zero, this might easily be missed by following outputs from eg. build scripts.

So if the new options could be made to fail the cmake run if the requested plugin could not be built, that might be a better semantics.

Comment by Sergei Golubchik [ 2014-06-18 ]

The original design was based on preserving the same functionality we had with WITH_ and WITHOUT_ but in a GUI-friendly and logically consistent matter. Adding new functionality was not the goal. But If I'll list all possible preference and combinations, I'd get something like

  1. do not compile the plugin at all
  2. compile statically, if possible, otherwise not at all
  3. compile dynamically, if possible, otherwise not at all
  4. compile statically, if possible, otherwise dynamically, if possible
  5. compile dynamically, if possible, otherwise statically, if possible
  6. compile statically, if possible, otherwise abort
  7. compile dynamically, if possible, otherwise abort
  8. compile statically, if possible, otherwise dynamically, if possible, otherwise abort
  9. compile dynamically, if possible, otherwise statically, if possible, otherwise abort

Those in bold were possible in 5.5 and 10.0. They are supported in my current implementation, with the values NO, STATIC, DYNAMIC, AUTO.

But I don't really know how to support all nine variants without making this option too confusing to use. And I don't know whether it makes sense to do that.

Comment by Sergei Golubchik [ 2014-06-22 ]

Suggestion:

BUILD_PLUGIN_X= {NO|STATIC|DYNAMIC} [, {NO|STATIC|DYNAMIC}] [, {NO|ABORT}]

Where NO is, basically, a noise word, always ignored. It's added for readability. Otherwise, all 9 variants as above can be specified as

  1. NO (or the empty string)
  2. STATIC,NO (or simply STATIC)
  3. DYNAMIC (I will omit NO from now on)
  4. STATIC,DYNAMIC
  5. DYNAMIC,STATIC
  6. STATIC,ABORT
  7. DYNAMIC,ABORT
  8. STATIC,DYNAMIC,ABORT
  9. DYNAMIC,STATIC,ABORT

also, I could allow abbreviating them to the first letter. Making it simply D,A or S,D, for example.

Comment by Sergei Golubchik [ 2014-06-22 ]

Alternatively, we can keep the list of NO, STATIC, DYNAMIC, AUTO. And add the value of FORCE (which means the same as AUTO, but aborts if the plugin cannot be build. It'd be S,D,A in the previous comment). This FORCE matches the behavior of --plugin-XXX=FORCE as the server command-line option

Comment by Sergei Golubchik [ 2014-06-23 ]

per irc discussion, I've renamed FORCE to YES

Comment by Elena Stepanova [ 2015-10-24 ]

Final implementation is described in the KB: https://mariadb.com/kb/en/mariadb/specifying-which-plugins-to-build/

Use PLUGIN_xxx cmake variables. They can be set on the command line with -DPLUGIN_xxx=value or in the cmake gui. Supported values are

Value Effect
NO the plugin will be not compiled at all
STATIC the plugin will be compiled statically, if supported. Otherwise it will be not compiled.
DYNAMIC the plugin will be compiled dynamically, if supported. Otherwise it will be not compiled. This is the default behavior.
AUTO the plugin will be compiled statically, if supported. Otherwise it will be compiled dynamically.
YES same as AUTO, but if plugin prerequisites (for example, specific libraries) are missing, it will not be skipped, it will abort cmake with an error.
Generated at Thu Feb 08 07:10:27 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.