Rechercher dans le manuel MySQL
29.2.4.3 Compiling and Installing Plugin Libraries
After your plugin is written, you must compile it and install
it. The procedure for compiling shared objects varies from
system to system. If you build your library using
CMake
, it should be able to generate the
correct compilation commands for your system. If the library
is named somepluglib
, you should end up
with a shared library file that has a name something like
somepluglib.so
. (The
.so
file name suffix might differ on your
system.)
To use CMake
, you'll need to set up the
configuration files to enable the plugin to be compiled and
installed. Use the plugin examples under the
plugin
directory of a MySQL source
distribution as a guide.
Create CMakeLists.txt
, which should look
something like this:
MYSQL_ADD_PLUGIN(somepluglib somepluglib.c
MODULE_ONLY MODULE_OUTPUT_NAME "somepluglib")
When CMake
generates the
Makefile
, it should take care of passing
to the compilation command the
-DMYSQL_DYNAMIC_PLUGIN
flag, and passing to
the linker the -lmysqlservices
flag, which
is needed to link in any functions from services provided
through the plugin services interface. See
Section 29.3, “MySQL Services for Plugins”.
Run CMake, then run make:
shell> cmake .
shell> make
If you need to specify configuration options to
CMake, see
Section 2.9.7, “MySQL Source-Configuration Options”, for a list.
For example, you might want to specify
CMAKE_INSTALL_PREFIX
to indicate
the MySQL base directory under which the plugin should be
installed. You can see what value to use for this option with
SHOW VARIABLES
:
- +---------------+------------------+
- +---------------+------------------+
- +---------------+------------------+
The location of the plugin directory where you should install
the library is given by the
plugin_dir
system variable.
For example:
- +---------------+-----------------------------------+
- +---------------+-----------------------------------+
- +---------------+-----------------------------------+
To install the plugin library, use make:
shell> make install
Verify that make install installed the plugin library in the proper directory. After installing it, make sure that the library permissions permit it to be executed by the server.
Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-compiling-plugin-libraries.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.